REQUEST A DEMO

Automated Deployment for Clarify Example

Last year I posted about automated deployments for Clarify. From that post:

 

Doing automatic deployments of Clarify changes is pretty straightforward. If I was starting off, I would use a contemporary build script tool such as nant or rake, and simply have it call out to your schema editing tool (Dovetail SchemaEditor, or ddcomp) to perform schema changes, use an import tool (such as Dovetail ArchiveManager, or dataex) for importing forms, and then compile your Clearbasic code using CBEX, or just import it as a DAT file using Dovetail ArchiveManager. File copying, registering components, configuring web servers, and setting permissions are all common tasks that are available in these build tools as well.

 

Should you also need to do additional stuff in your database, some code that uses the Dovetail SDK can be useful.

 

You could tie this in with a CI server if you wish, so when new code is checked in, the CI server could automatically push it to a test database.

 

Recently, I got a Please Send Me The Codez email, so I’ve shared an example of doing this.

Code

 

The code is freely available on GitHub: https://github.com/gsherman/Clarify-Deployment

Tools

 

In this example, I’m using the following tools:

 

Tool Description Alternatives
NAnt Free Build Tool for .NET. Overall automation scripting tool rake, psake, ant
Dovetail SchemaEditor Extends the Clarify Schema ddcomp, SchemaManager
Clarify CBEX Toolkit ClearBasic Code “Compiler”
Dovetail Archive Manager (DIET) DAT file importer dataex
Powershell Shell and scripting language for .NET
Dovetail SDK APIs for Clarify

 

You’ll notice I didn’t upload all of my tools under the tools directory into GitHub. This is intentional.  NAnt is free, so you can download this yourself. If you want to use the Dovetail tools, you’ll need to have a license to use them. CBEX is from Clarify/Amdocs.

 

Notice that I’ve also provided alternative tools to use, should you so desire.

NAnt Script

 

Everything starts with the NAnt script: dev.query.build

 

The NAnt script contains targets (sort of like functions). I’m using two main targets:

 

Target Description
reset-dev-database Reset my local development database
setup-dev Does all the real work

Setup-Dev Target

 

The setup-dev target basically calls the following other targets:

 

Target Description Tools Used
dev-properties defines the properties for my development environment
apply-schema-scripts apply all of the schema files in the /schema directory Dovetail SchemaEditor
setup-database-stored-procs apply the stored procedures necessary for Dovetail SDK sqlcmd.exe (Microsoft SQL Server Command Line Tool)
add-licenses add Dovetail licenses to the database NAnt built-in SQL task
import-dat-files import all of the DAT files in the /files directory Dovetail Archive Manager (DIET)
import-forms import all of the forms (DAT files) in the /files directory Dovetail Archive Manager (DIET)
setup-resource-config add the forms to the proper resource configuration.

 

 

add the current user into the proper resource configuration.

PowerShell and Dovetail SDK
compile-clearbasic-code compile all of the ClearBasic code Clarify CBEX Toolkit
clear-clarify-cache clear my Clarify cache files NAnt built-in delete file task

Execute the Script

 

To execute it, I simply type nant plus the target that I want to execute from a command line.

 

For example, to reset my database back to a good state (useful in development):

DOS> nant reset-dev-database

 

This is useful because I can screw stuff up as often as I want in development, and simply revert my database easily and quickly to put me back to a known good state. Then continue on developing and testing.

 

I then use the setup-dev task which does everything (schema, database setup, dat files, forms, resource config setup, CB code, etc.):

DOS> nant setup-dev

 

If needed, I can run just one target by itself, such as :

DOS> nant apply-schema-scripts

What about deploying to QA or Production?

 

You could add a qa-properties or prod-properties target, which define the properties for those environments.

 

Then, add a target such as deploy-to-qa or deploy-to-prod, such as :

<target name=”deploy-to-qa” description=”Deploy to QA” depends=”qa-properties apply-schema-scripts setup-database-stored-procs add-licenses import-dat-files import-forms setup-resource-config compile-clearbasic-code clear-clarify-cache” />

Giddy-Up

 

Obviously, what I’ve done and how I’ve done it may not exactly fit into your environment or toolset. That’s OK. I think it’s the concept here that’s more important than the specific example.

 

Fortunately, the build tools, CI servers, and scripting environments are widely used. This means that there are tons of examples and tutorials available online to help you accomplish your tasks.

 

I think you’ll find that once you start using automated scripts, you’ll never want to manually repeat steps again.

 

Hope you find this helpful.

 

Rock on.