Using Git with multiple staged deployments - Part 2
August 21st, 2008
I wrote about this a little while a go and said I'd report back my findings.
It's been a few months now and generally I've been pleased with the method. Here's what we're doing:
- We have a centralised repository containing development branches, plus a production branch
- We're using capistrano multi-stage deployments - production & staging have their own configurations, overriding the base details
config/deploy/production.rb:
set :deploy_to, "/curve21/www/application"
set :branch, "production"
set :deploy_via, :remote_cache
config/deploy/staging.rb:
set :deploy_to, "/curve21/www/application"
set :branch, "staged-feature"
Pushing out changes to production
With this setup, pushing changes live is simply a matter of merging a development branch into production and running:
cap production deploy
If there is a small bug to fix, we fix it in the production branch and deploy straight away. Those changes can be merged into development branches if needed.
Staging
Initially, we tried having a 'staging' branch, but that got very messy. Sometimes, we have more than one project or feature on the go at the same time for the same site. What we really needed was to be able to point the staging server to which ever branch we wanted. To achieve this, we ditched the staging branch and just set it to what ever we want at the time.
In conclusion...
I've been really pleased with this setup so far. Overall it's given us the flexibility to work on features, push them out for showing the client while still being able to easily bug fix and maintain the live site.

Sorry, comments are closed for this article.