Is there a way to specify a per-host deploy_to path with Capistrano?

Posted by Chad Johnson on Stack Overflow See other posts from Stack Overflow or by Chad Johnson
Published on 2010-06-08T20:52:04Z Indexed on 2010/06/08 21:32 UTC
Read the original article Hit count: 187

Filed under:
|

I have searched and searched and asked a question already and have not received a clear answer.

I have the following deploy script (snippet):

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

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

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

As you see, I have set deploy_to to a specific path. And, I also have specified multiple web servers. However, each web server should have a different deployment path.

I want to be able to run "cap deploy" and deploy to all hosts in one shot. I am NOT trying to deploy to staging and then to production. This is all production.

My question is: how exactly do I specify a path per server? I have read the "Roles" documentation for Capistrano, and this is unclear. Can someone please post a deploy file example? I have read the documentation, and it is unclear how to do this.

Does anyone know? Am I crazy? Am I thinking of this wrong or something? No answers anywhere online. Nowhere. Nothing. Please, someone help.

© Stack Overflow or respective owner

Related posts about deployment

Related posts about capistrano