How can I make `run` or `download` methods to always use the :roles I declared in the code?

14 views
Skip to first unread message

赵 耀

unread,
May 22, 2012, 3:52:15 AM5/22/12
to Capistrano
Hi everyone,

When I tried to do this:
1. remove the target server from my nginx upstream
2. reload nginx
3. restart my app server #
4. add back to nginx upstream
5. reload nginx.

Because I declared a ROLES or HOSTS env, all commands are running at the app server. The env hide the :roles => :nginx I passed into the `run` `download` methods.
For some reasons I can not declare :roles => on the task, which means I must use the env vars to declare which host I want to deploy.
How can do this?



Best regards.

Lee Hambley

unread,
May 22, 2012, 3:58:28 AM5/22/12
to capis...@googlegroups.com
Hi,

Unfortunately this is expected to behave differently for everyone, host or role filters should be additive, or subtractive; there is no "correct behaviour"

I encourage you to engineer your recipes to use servers_for_role() when you need to bypass filters that filter out too much, and to avoid engineering your recipes to rely on host/role specific configuration.

> 1. remove the target server from my nginx upstream

Configuration file management is better served with Chef, Puppet, BOSH or similar [1]. 

If steps 1&3 were about making a "Deployment in progress" page, You can do that with try_files (NGinx directive), and upload a maintenance message, removing it when you are done, `cap web:disable` does this (and might be removed, depending which version you are using)

--
--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en

Reply all
Reply to author
Forward
0 new messages