Deploying a Rails App to Multiple Servers using Capistrano - Best Practices

Posted by Louise on Stack Overflow See other posts from Stack Overflow or by Louise
Published on 2010-04-13T22:56:00Z Indexed on 2010/04/14 9:03 UTC
Read the original article Hit count: 356

Filed under:
|

I have a rails application that I need to deploy to 3 servers - machine1.com, machine2.com and machine3.com. I want to be able to deploy it to all machines at once and each machine individually. Can someone help me out with a skeleton Capistrano config file / recipe? Should it all be in deploy.rb or should I break it out in machine1.rb, etc?

I thought I was on the right track getting Capistrano to take in command line arguments, but it choked when I tried set the roles within the namespaces. I'd pass in 'hosts=1,2,3' as an argument and set the role:app/web/db to "machine#{host}.com" after splitting on the command and going into an each do |host| {}...

Anyway, other than creating 4 different deploy.rb files and renaming it before running cap:deploy each time, I'm stumped. I'd like to be able to do the following:

cap deploy:machine1:latest_version_from_svn
cap deploy:all_machines:latest:version_from_svn

Just don't know if it should all be in deploy.rb split up with namespaces or if it should be broken into multiple deploy*.rb files.

© Stack Overflow or respective owner

Related posts about capistrano

Related posts about ruby-on-rails