forward / capify-cloud

MIT License
25 stars 6 forks source link

cannot pass multiple roles to cap tasks #2

Open btaitelb opened 12 years ago

btaitelb commented 12 years ago

I have the following ec2 setup:

server-1 Tag: Roles => "app"
server-2 Tag: Roles => "solr"

And have put the following in my config/deploy.rb:

cloud_roles :app, :solr

But when I execute the following command, capistrano only connects to the solr instance, not to both:

cap app solr shell
  * 16:10:56 == Currently executing `app'
  * 16:10:56 == Currently executing `solr'
  * 16:10:56 == Currently executing `shell'
cap> date
[establishing connection(s) to <server2-ip>]

Similarly, when I reverse the order (cap solr app shell), it connects to server-1, so it appears that the roles are overwriting each other rather than being additive.

As a workaround, I can use the following config:

cloud_roles :name => :app, :options=>{ :default => true }
cloud_roles :name => :solr, :options=>{ :default => true }

And then simply calling cap shell works as desired, but the documentation describing this configuration has a warning about this not working with load balancers, so I'm not sure if this is the correct approach.

jmonteiro commented 12 years ago

Great catch. I believe that the :options => { :default => true } should be set to all cloud_roles, so capify-cloud would be a drop-in gem for avoiding manually writing roles on your Capistrano configuration.