2012-02-26 23:36:30 -05:00
|
|
|
Capistrano::Configuration.instance.load do
|
2012-03-08 23:58:51 -05:00
|
|
|
before "deploy", "sidekiq:quiet"
|
2012-02-26 23:36:30 -05:00
|
|
|
after "deploy", "sidekiq:restart"
|
|
|
|
|
2012-03-27 23:19:24 -04:00
|
|
|
_cset(:sidekiq_timeout) { 10 }
|
2012-03-08 23:58:51 -05:00
|
|
|
|
2012-02-26 23:36:30 -05:00
|
|
|
namespace :sidekiq do
|
|
|
|
|
2012-03-08 23:58:51 -05:00
|
|
|
desc "Quiet sidekiq (stop accepting new work)"
|
|
|
|
task :quiet do
|
2012-03-29 02:25:45 -04:00
|
|
|
run "cd #{current_path} && bundle exec sidekiqctl quiet #{current_path}/tmp/pids/sidekiq.pid"
|
2012-02-26 23:36:30 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Stop sidekiq"
|
|
|
|
task :stop do
|
2012-03-29 02:25:45 -04:00
|
|
|
run "cd #{current_path} && bundle exec sidekiqctl stop #{current_path}/tmp/pids/sidekiq.pid #{fetch :sidekiq_timeout}"
|
2012-02-26 23:36:30 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Start sidekiq"
|
|
|
|
task :start do
|
|
|
|
rails_env = fetch(:rails_env, "production")
|
2012-03-11 15:21:34 -04:00
|
|
|
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 &"
|
2012-02-26 23:36:30 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Restart sidekiq"
|
|
|
|
task :restart do
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|