Is host filtering supported?
ruudk opened this issue · 6 comments
Is it possible to do a deploy only to a specific server using host filtering when this plugin is enabled?
How did you solve this issue?
I monkey patched Capistrano a bit:
# Monkey Patch
module Capistrano
module DSL
def roles_filtered(*names)
hosts = env.roles_for(names.flatten)
roles = Configuration.env.filter(hosts)
roles.map { |host| env.server(host) }
end
end
end
Then, whenever I use roles_filtered
with HOSTS=host1,host2 bundle exec cap production deploy
it will filter correctly :)
Which one file did you change these codes?
I added the monkey patch to my own config.rb
@ruudk thanks for answering.
We don't get it properly where did you patch it.What is your own config.rb ? Are you mean the deploy.rb in config folder? I have tried to patch your code in deploy.rb nor configuration.rb of capistrano 3.5.0 gem,but doesnt't affect anything while trying to pass HOST env during deployment process even i set roles_filtered.
Capistrano files and directory structure:
├── Capfile
├── config
│ ├── deploy
│ │ ├── production.rb
│ │ └── staging.rb
│ └── deploy.rb
└── lib
└── capistrano
└── tasks
Could you please give more details your usage in deployment ? Thanks.
I put it in my deploy.rb
:)