Filter based on namespace

15 views
Skip to first unread message

Christopher J. Bottaro

unread,
Aug 27, 2015, 3:49:36 PM8/27/15
to Capistrano
The deploy task doesn't appear to do any filtering, so when I deploy, Capistrano tries to deploy application code to my load balancers.

I tried doing something like this:

before "deploy", "do_filter" do
  set :filter, role: %w[app work]
end

But it still deploys code to my servers tagged with the "web" role.

I know that I can do this:

ROLES=app,work cap production deploy

But that is a pain.

It seems very reasonable to put in the configuration the idea of "all tasks within the deploy namespace should affect servers with [these] roles".  In fact, most Capistrano plugins do something like this; they give you a variable to set which restricts tasks to a certain role or roles.

Why doesn't the out of the box "deploy" namespace do something like this?

Thanks,
-- C

Lee Hambley

unread,
Aug 28, 2015, 3:14:31 AM8/28/15
to Capistrano
Hi Christopher,

As is clearly documented the filter has to be set before the tasks is loaded - http://capistranorb.com/documentation/advanced-features/host-filtering/#in-configuration there you will see other methods for achieving the same.

If you commonly do something like this, I suggest adding a Rakefile with some common shortcuts.

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/da44cc56-0bd8-43e0-80d8-e1021d9d7ad3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages