Commit 69595ea1 by zmj

修改部署脚本,sidekiq 配置

修改god group name

fix deploy config
parent da69b935
......@@ -4,7 +4,11 @@ lock '~> 3.11.0'
set :rvm_type, :auto # Defaults to: :auto
set :rvm_ruby_version, '2.6.0'
set :god_sidekiq_group, 'app_push_sidekiq'
set :god_sidekiq_group, 'push_service'
# 当前服务器有app 这个角色。
# gem capistrano-sidekiq 默认值 set :sidekiq_roles, fetch(:sidekiq_role, :app)
# 因此会造成执行cap sidekiq:start,但是生产环境因为使用了god,不需要执行这个任务
set :sidekiq_roles, 'sidekiq' #生产环境没有这个角色。
set :puma_role, 'app'
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
......@@ -12,6 +16,7 @@ set :linked_files, %w[
config/credentials.yml.enc
config/master.key
config/settings.yml
config/puma.rb
]
set :linked_dirs, %w[
......@@ -30,9 +35,9 @@ namespace :sidekiq do
'source ~/.rvm/scripts/rvm',
'god',
"god stop #{fetch(:god_sidekiq_group)}",
'sleep 30',
'sleep 10',
"god remove #{fetch(:god_sidekiq_group)}",
"god load #{release_path}/config/sidekiq.god"
"god load #{release_path}/config/sidekiq.god",
].join('; ')
end
end
......
......@@ -18,8 +18,8 @@ QUEUES.each { |queue_name, queue_conf|
w.log = sidekiq_log_file
w.interval = 30.seconds
w.name = "ikcrm_operating_sidekiq_#{queue_name}-#{pid_index}"
w.group = "ikcrm_operating_sidekiq"
w.name = "push_service_#{queue_name}-#{pid_index}"
w.group = "push_service"
w.start = "cd #{APP_ROOT}; DB_USE_SLAVE=#{!!(queue_name.to_s =~ /slave/)} DB_POOL_SIZE=#{queue_conf[:concurrency] + 2} nohup bundle exec sidekiq -C config/sidekiq.yml -c #{queue_conf[:concurrency]} -e production --queue #{queue_name},#{queue_conf[:priority]} -i #{pid_index} -P #{sidekiq_pid_file} >> #{sidekiq_log_file} 2>&1 &"
w.stop = "if [ -d #{APP_ROOT} ] && [ -f #{sidekiq_pid_file} ] && kill -0 `cat #{sidekiq_pid_file}`> /dev/null 2>&1; then cd #{APP_ROOT} && bundle exec sidekiqctl stop #{sidekiq_pid_file} 10 ; else echo 'Sidekiq is not running'; fi"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment