I was looking for a way to deploy our website to different servers and this snippet did it very well.
The idea is very simple: in config/deploy.rb create a couple of new tasks to set the deployment variables:
task :production do role :web, "production.server.com" role :app, "production.server.com" role :db, "production.server.com", :primary=>true end task :staging do role :web, "staging.server.com" role :app, "staging.server.com" role :db, "staging.server.com", :primary=>true end
After these tasks were added you can deploy using cap staging deploy or cap production deploy.