views:

165

answers:

2

I'm trying to set up multiple roles, one for live, and another for dev. They look like this:

role :live, "example.com"
role :dev, "dev.example.com"

When I run cap deploy, however, it executes for both servers. I've tried the following and it always executes on both.

cap deploy live
cap ROLE=live deploy

What am I missing? I know I can write a custom task that only responds to one role, but I don't want to have to write a whole bunch of tasks just to tell it to respond to one role or another. Thanks!

A: 

Try capistrano multistage:

http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage

Roles are intended to deploy different segments on different servers, as apposed to deploying the whole platform to just one set of servers.

cwninja
+1  A: 

You can do something like this:

task :dev do
    role :env, "dev.example.com"
end

task :prod do
    role :env, "example.com"
end

Then use:

cap dev deploy
cap prod deploy
Ken Struys
Very cool idea!
Sean Clark Hess