在进行部署时,使用capistrano进行部署时,运行的sidekiq进程是否受到影响,停止或被杀?
答案 0 :(得分:6)
将require 'sidekiq/capistrano
放入deploy.rb将在部署时添加these default tasks。
如果你做的事情不是纯粹的香草,例如。使用monit,那么你可能不想添加require 'sidekiq/capistrano
语句并编写自己的任务和钩子。
例如
Capistrano::Configuration.instance(:must_exist).load do
before "deploy:update_code", "sidekiq:quiet"
after "deploy:stop", "sidekiq:stop"
after "deploy:start", "sidekiq:start"
before "deploy:restart", "sidekiq:restart"
namespace :sidekiq do
desc "Quiet sidekiq (stop accepting new work)"
task :quiet, :roles => :app, :on_no_matching_servers => :continue do
run "/usr/sbin/service sidekiq quiet"
end
desc "Stop sidekiq"
task :stop, :roles => :app, :on_no_matching_servers => :continue do
run "sudo /usr/bin/monit stop sidekiq"
end
desc "Start sidekiq"
task :start, :roles => :app, :on_no_matching_servers => :continue do
run "sudo /usr/bin/monit start sidekiq"
end
desc "Restart sidekiq"
task :restart, :roles => :app, :on_no_matching_servers => :continue do
run "sudo /usr/bin/monit restart sidekiq"
end
end
end