views:

93

answers:

1

Capistrano is working great to deploy to a single server. However, I have multiple production API servers for my web application. When I deploy, my code needs to get deployed to every API server at once. Specifying each server manually is NOT the solution I am looking for (e.g. I don't want to do "cap api1 deploy; cap api2 deploy").

Is there a way, using Capistrano, to deploy to all servers at once, with just a simple "cap deploy"? I'm wondering what changes I would need to make to a typical deploy.rb file, whether I'd need to create a separate file for each server, and whether and how the Capfile would need to be changed. Also, I need to be able to specify a different deploy_to path for each server. And ideally, I wouldn't have to repeat things in different config files for different servers (eg. wouldn't have to specify :repository, :application, etc. multiple times).

I have spent hours searching Google on this and looking through tutorials, but I have found nothing helpful.

Here is a snippet from my current deploy.rb file:

set :application, "testapplication" 
set :repository,  "ssh://domain.com//srv/hg/#{application}" 
set :scm, :mercurial

set :deploy_to, "/srv/www/#{application}" 

role :web, "domain.com" 
role :app, "domain.com" 
role :db,  "domain.com", :primary => true, :norelease => true

Should I just use the multistage extension and do this?

task :deploy_everything do
  system "cap api1 deploy" 
  system "cap api2 deploy" 
  system "cap api2 deploy" 
end

That could work, but I feel like this isn't what this extension is meant for...

A: 

It seems like you might be interested in the "Multiple Servers" heading on the Getting Started page. Is that what you're after?

Adam
I saw that, but they only specify domain names. Like I said: I need to specify domain name AND a custom path per server. I can do 'role :libs, "private.capify.org", "mail.capify.org"', but how do I also specify a path per server (and in such a way that is compatible with capistrano)?
Chad Johnson
Now that you reiterated the custom path requirement, I'm kind of at a loss. I have not made extensive use of the system.
Adam
Okay. Thanks for trying.
Chad Johnson