I like continuous deployment just like continuous integration. However it can be pain if you have too many environments to deploy to.
In the project that I am currently involved in, we have 3 environments for which continuous deployment makes sense. Deployment frequency is different, deployment policies are different but I am sure it is possible to automatize the deployment process up to some extend.
Just for that reason (and also because I am bored of doing deployment and I like writing scripts time to time), I spent a couple of hours to write a script that can be invoked by
cron to do deployment to
tomcat. The process is easy;
- Scripts checks all the war files under a specific folder
- For every war file under in that directory
- Checks if the war file is complete
- If so stops tomcat (only for once:) )
- Removes all the files related to the current war file from tomcat/webapps
- Copies war file to tomcat/webapps
- Starts tomcat
The full script is as follows. I am not a experienced bash coder, so be fair. Now all you have to do is to transfer the file to inbound directory. There are different ways for different build management tools. I am using maven so I defined an
ant-run goal to copy the deployables via ssh.