Why Self Bootstrapping Deployments?
Regardless of whether you are operating within a cloud environment or not (internal Eucalyptus or external AWS), I have always preached the need to architect software in a cloud friendly manner. Ensuring your deployment process is cloud friendly is one of the most important steps.
Historically sysadmins and development teams rely on a server to pre-configured prior to deploying their application. Therefore things such as java, application container of choice (tomcat), libraries, file paths, etc are usually either manually done when a new server is provisioned or an image is built after all that work is done. This approach has the following downsides:
- When upgrades to an OS are needed, it requires manually making a new image
- When upgrades to java or the application are needed, it is a manual process outside of deployment and still requires the making of a new image
- Tracked changes of overrides to configuration files or other such actions are usually not captured or held with one person’s knowledge
When running in the cloud, new machines come and go, and we need processes that adapt along with that. RightScale has done a great job with their right scripts where a pull model is done. A small base image is made so that when a server boot, it contacts RightScale infrastructure and automatically runs any install/deployment scripts to get the server to a ready state.
The aforementioned approach is ideal, however can be overkill in smaller enterprises or when not dealing with a full blown cloud infrastructure. However, this doesn’t mean we can’t use a solution that gets the vast majority of the benefit in a cloud friendly manner
Practical Cloud Friendly Approach
Instead of baking knowledge into an image for servers to contact a deployment engine when they boot, we’ll instead deploy to set of known serves, however to grow/shrink only involves modifying a configuration file. The basis is as follows:
- Third party distributions (java, app container, etc) as well as the actual in house application to deploy should all be posted to a web location or Maven repository as part of your build procedures.
- All deployment scripts, configuration, SQL, etc. should be also included in your distribution and hosted at the same web location or Maven repository.
- When a deploy is performed, each server is logged into (some in parallel) and the appropriate scripts are fetched using wget from the distribution repository, ran, and then cleaned up. If a script needs other files (such as the JRE distribution) that is also fetched from the distribution repository as well.
I used ANT along with shell scripts to perform the task with the following flow generally happening:
- deploy - deploy java, app container, hyperichq, and in house app to the target servers
- stop - stop app container
- ddl - execute DML
- dml - execute DDL
- activate - change softlink on target servers to point to the pending deployment
- start - start app container (if it is running, it will be stopped first)
A zip file containing all the necessary scripts and tools to deploy a Web App inside an application container such as JBoss is linked at the end of this article.
Benefits
There are many of benefits from using the aforementioned process, of which I will highlight my favorite:
- No Secrets - all configuration, modifications, steps, etc. are self-documented in your source control repository and automated as part of a deployment. Therefore no hidden surprises.
- Everything is a Deployment - whether you’re rolling out a regular release, upgrading java, or switching to a whole new server farm, nothing changes! Since it’s all part of the deployment process no special action is needed.
- No Ghosts - Sometimes people will make changes to your environment (ie. tweak a java config) and it is unknown until you move servers or upgrade java. Since with each deployment, a fresh copy of everything is used, there are no “ghosts” or artifacts left behind from the previous application.
Zip file containing example implementation of model talked about in this article.





Recent Comments