<< March 6, 2006 | Home | March 8, 2006 >>

Capistrano: Automating Application Deployment

Capistrano: Automating Application Deployment
Application deployment is one of those things that becomes more and more complicated as the scale of your application increases. With just a single box running your database and your application, it’s quite simple. But when you start putting your database on a different server, and then separating your web servers from your app servers, and eventually splitting your database into master and slave servers… It can get to where you almost don’t want to deploy your application any more. SwitchTower is a standalone utility that can also integrate nicely with Rails. You simply provide SwitchTower with a deployment “recipe” that describes your various servers and their roles, and voila! You magically have single-command deployment. It even allows you to roll a bad version out of production and revert back to the previous release. It should be stated that the concepts that SwitchTower uses and encourages are not specific to Rails, or even Ruby. They are common-sense practices that are applicable to a variety of environments. In fact, you’ll find that there is very little that is Rails-specific about SwitchTower, aside from the fact that it is in Rails that it found its genesis. No matter where you are or what environment you are using, SwitchTower can probably help ease your deployment pains.
We have done some interesting things around automating our deployment, but this project looks interesting. Here is what we currently do though. Currently we have our CruiseControl build creating 2 zip files at build time (one for the App server and one for the web server) that have the correct directory structure. We also include a nAnt build file. The zip file is then checked into subversion. To get those installed, We have CruiseControl.net installed on the servers, and have a project set up so that by triggering a build (it has to be done manually), CC downloads the latest zip files from subversion, unzips them, and then runs the nant build to install them. It has taken us from what was sometimes a 2 hour ordeal to being able to deploy the latest version in less than a minute.