Capistrano* is a lightweight web application deployment tool suited to all codebases. It's written in ruby and hooks into the rake gem, but you don't need to be deploying a Rails app for it to come in useful. Ruby only needs to be installed on the box doing the deploying. Check out the other assumptions it makes. It's very practical and i highly recommend it for web shops with a cluster of web/db servers.
Having come out of the rails community, it sticks to some of the design principles of said project, including 'convention over configuration'. However, the creator's conventions aren't neccessarily your team's conventions - there was one core convention that didn't hold true in my deployment scenario: Capistrano deploys the latest revision of your repo and uses timestamps to identify the release on the participating servers. However, we use subversion and we deploy 'tags'.
Tags are named snapshots of your repository (more on tags). We typically use version numbers as tags, e.g. 'v1.2.2' or some such scheme. This allows us to say with certainty what is deployed at any one time, without having to scan logs etc. Tags give context to a release name (you can easily associate the release with project milestones) that revision numbers and timestamps do not. Tags are usually kept in a 'tags' subfolder, in the top level of the repository.
I've produced a small task library which allows you to deploy and rollback subversion tags with this kind of syntax:
rake remote:deploy_tag [tagname]
- Your 'releases' folder will hold your releases by tag name, not timestamp.
- The library adds a capistrano variable, 'svn_tag_dir' which defaults to 'tags', to describe your tag subdirectory.
- You can customize the deploy_tag script for your particular deploy scenario.
To install just place the task library in 'lib/tasks' in your particular rails app, and add the following to your 'config/deploy.rb' script:
require 'tasks/capistrano_svn_tags'
You can then use the new deploy_tag task. Assumptions made:
- Your :repository variable will now have to point to the top level of your application's repository.
- Your tag names follow an enumerable convention like v1, v2, v3 (ie sortable by Array#sort)
If you want to use the default capistrano deployment convention again (last revision, timestamps) then just comment out the require statement and use the default deployment tasks.
Download the task library:
* Wins my award for Most Emo Sounding Dev Tool of All Time.