Some time ago a customer of AMIS asked me to setup the automatic deployment of the software for their application. Till then this was done manually, took an awful lot of time and was rather error-sensitive.
The application itself is a multi-tier application with an Oracle database, a Micro Focus COBOL application server and an Oracle Application server for OC4J and Oracle Reports. The deployments contains -among others- SQL-scripts, RDF-files, COBOL binaries, JAR- and EAR files etc. After examining the requirements I remembered ANT. Originally created to ‘make’ JAVA code, but evolved to much more than that, it is capable to run SQL-files against the database, to copy, ftp, remove files on a file system, execute other (system)programs, zip and unzip and interface with several CVS applications.
To deploy a patch or a new release of the software my ANT tool had to be able to stop and start the application servers, to backup the original files, to copy the new files to the appropriate destination and to run SQL-scripts against the database. Since there were also several environments (Development, UAT, Production etc.) all the source and destination directories, database names, users and passwords had to be put in property files.
The final tool uses three ‘stages’: a pre-stage, a deployment-stage and a post-stage. For each stage I wrote a XML file wich controls the process. The pre- and post stage are run only once, the deployment stage is run once for each patch so it is possible to deploy more than one patch in a single run.
In the pre-stage both application servers are stopped as well as a queue handler process in the database. Finally it determines the SCN of the database for flashback purposes in case of trouble.
The next stage takes care of the actual deployment. The original files are all copied and zipped to a special backup-directory and then the new files are put in place of them. Also the DDL and DML SQL-scripts are run against the database. We don’t need a backup first, we have the SCN and Flashback rememberâ€¦.
Finally the post-stage. This stage starts the application servers as well as the queue-handler. It also collects all the log files of the entire deployment and sends it by email to the administrators.
In case of trouble there is not really a problem: stop the application servers, unzip the saved files back to their original position and flashback the database. Not really complex to automate that as well.
The end result: one tool to deploy and one tool to ‘undeploy’. The advantages: software deploying can be done by almost everyone, no special skills are required, in much less time and there is an easy way to undo it in case of errors. Manually deploying of a patch took originally almost 4 hours. Automatic deploying of the same patch took only 20 minutes an undoing it 5 minutes. Talk about saving time; one happy customer as you can imagineâ€¦.