mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Support custom capistrano role, fixes #113
This commit is contained in:
parent
ff3417c381
commit
16fa99c875
2 changed files with 11 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
HEAD
|
||||
-----------
|
||||
|
||||
- Add support for a custom Capistrano role to limit Sidekiq to
|
||||
a set of machines. [#113]
|
||||
|
||||
0.11.1
|
||||
-----------
|
||||
|
||||
|
|
|
@ -3,27 +3,28 @@ Capistrano::Configuration.instance.load do
|
|||
after "deploy", "sidekiq:restart"
|
||||
|
||||
_cset(:sidekiq_timeout) { 10 }
|
||||
_cset(:sidekiq_role) { :app }
|
||||
|
||||
namespace :sidekiq do
|
||||
|
||||
desc "Quiet sidekiq (stop accepting new work)"
|
||||
task :quiet do
|
||||
task :quiet, :roles => lambda { fetch(:sidekiq_role) } do
|
||||
run "cd #{current_path} && if [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then bundle exec sidekiqctl quiet #{current_path}/tmp/pids/sidekiq.pid ; fi"
|
||||
end
|
||||
|
||||
desc "Stop sidekiq"
|
||||
task :stop do
|
||||
task :stop, :roles => lambda { fetch(:sidekiq_role) } do
|
||||
run "cd #{current_path} && if [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then bundle exec sidekiqctl stop #{current_path}/tmp/pids/sidekiq.pid #{fetch :sidekiq_timeout} ; fi"
|
||||
end
|
||||
|
||||
desc "Start sidekiq"
|
||||
task :start do
|
||||
task :start, :roles => lambda { fetch(:sidekiq_role) } do
|
||||
rails_env = fetch(:rails_env, "production")
|
||||
run "cd #{current_path} ; nohup bundle exec sidekiq -e #{rails_env} -C #{current_path}/config/sidekiq.yml -P #{current_path}/tmp/pids/sidekiq.pid >> #{current_path}/log/sidekiq.log 2>&1 &"
|
||||
end
|
||||
|
||||
desc "Restart sidekiq"
|
||||
task :restart do
|
||||
task :restart, :roles => lambda { fetch(:sidekiq_role) } do
|
||||
stop
|
||||
start
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue