mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Merge pull request #560 from Tho85/sidekiq_cmd_configurable
Capistrano integration: Make sidekiq command configurable
This commit is contained in:
commit
db46142086
1 changed files with 5 additions and 3 deletions
|
@ -4,6 +4,8 @@ Capistrano::Configuration.instance.load do
|
|||
after "deploy:start", "sidekiq:start"
|
||||
after "deploy:restart", "sidekiq:restart"
|
||||
|
||||
_cset(:sidekiq_cmd) { "#{fetch(:bundle_cmd, "bundle")} exec sidekiq" }
|
||||
_cset(:sidekiqctl_cmd) { "#{fetch(:bundle_cmd, "bundle")} exec sidekiqctl" }
|
||||
_cset(:sidekiq_timeout) { 10 }
|
||||
_cset(:sidekiq_role) { :app }
|
||||
_cset(:sidekiq_pid) { "#{current_path}/tmp/pids/sidekiq.pid" }
|
||||
|
@ -19,14 +21,14 @@ Capistrano::Configuration.instance.load do
|
|||
desc "Quiet sidekiq (stop accepting new work)"
|
||||
task :quiet, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
|
||||
for_each_process do |pid_file|
|
||||
run "if [ -d #{current_path} ] && [ -f #{pid_file} ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl quiet #{pid_file} ; fi"
|
||||
run "if [ -d #{current_path} ] && [ -f #{pid_file} ]; then cd #{current_path} && #{fetch(:sidekiqctl_cmd)} quiet #{pid_file} ; fi"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Stop sidekiq"
|
||||
task :stop, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
|
||||
for_each_process do |pid_file|
|
||||
run "if [ -d #{current_path} ] && [ -f #{pid_file} ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl stop #{pid_file} #{fetch :sidekiq_timeout} ; fi"
|
||||
run "if [ -d #{current_path} ] && [ -f #{pid_file} ]; then cd #{current_path} && #{fetch(:sidekiqctl_cmd)} stop #{pid_file} #{fetch :sidekiq_timeout} ; fi"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -34,7 +36,7 @@ Capistrano::Configuration.instance.load do
|
|||
task :start, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
|
||||
rails_env = fetch(:rails_env, "production")
|
||||
for_each_process do |pid_file|
|
||||
run "cd #{current_path} ; nohup #{fetch(:bundle_cmd, "bundle")} exec sidekiq -e #{rails_env} -C #{current_path}/config/sidekiq.yml -P #{pid_file} >> #{current_path}/log/sidekiq.log 2>&1 &", :pty => false
|
||||
run "cd #{current_path} ; nohup #{fetch(:sidekiq_cmd)} -e #{rails_env} -C #{current_path}/config/sidekiq.yml -P #{pid_file} >> #{current_path}/log/sidekiq.log 2>&1 &", :pty => false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue