From be4814e6311d10b4f4017776ab6d3d20fbb1ec6b Mon Sep 17 00:00:00 2001 From: kazjote Date: Mon, 12 Oct 2015 17:52:36 +0200 Subject: [PATCH] Monit configuration respects options_per_process --- lib/capistrano/tasks/monit.rake | 4 ++++ .../capistrano/sidekiq/monit/templates/sidekiq_monit.conf.erb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/capistrano/tasks/monit.rake b/lib/capistrano/tasks/monit.rake index 0655366..dd2ad39 100644 --- a/lib/capistrano/tasks/monit.rake +++ b/lib/capistrano/tasks/monit.rake @@ -119,6 +119,10 @@ namespace :sidekiq do end end + def sidekiq_options_per_process + fetch(:sidekiq_options_per_process) || [] + end + def sudo_if_needed(command) send(use_sudo? ? :sudo : :execute, command) end diff --git a/lib/generators/capistrano/sidekiq/monit/templates/sidekiq_monit.conf.erb b/lib/generators/capistrano/sidekiq/monit/templates/sidekiq_monit.conf.erb index aa55e3a..3f923e1 100644 --- a/lib/generators/capistrano/sidekiq/monit/templates/sidekiq_monit.conf.erb +++ b/lib/generators/capistrano/sidekiq/monit/templates/sidekiq_monit.conf.erb @@ -2,7 +2,7 @@ <% processes_pids.each_with_index do |pid_file, idx| %> check process <%= sidekiq_service_name(idx) %> with pidfile "<%= pid_file %>" - start program = "/bin/su - <%= @role.user %> -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:sidekiq] %> <%= sidekiq_config %> --index <%= idx %> --pidfile <%= pid_file %> --environment <%= fetch(:sidekiq_env) %> <%= sidekiq_concurrency %> <%= sidekiq_logfile %> <%= sidekiq_queues %> -d'" with timeout 30 seconds + start program = "/bin/su - <%= @role.user %> -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:sidekiq] %> <%= sidekiq_config %> --index <%= idx %> --pidfile <%= pid_file %> --environment <%= fetch(:sidekiq_env) %> <%= sidekiq_concurrency %> <%= sidekiq_logfile %> <%= sidekiq_queues %> <%= sidekiq_options_per_process[idx] %> -d'" with timeout 30 seconds stop program = "/bin/su - <%= @role.user %> -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:sidekiqctl] %> stop <%= pid_file %>'" with timeout <%= fetch(:sidekiq_timeout).to_i + 10 %> seconds group <%= fetch(:sidekiq_monit_group, fetch(:application)) %>-sidekiq