module Capistrano::Helpers::DelayedJob::Monit
Module Monit
provides helpers for Monit/Puma combination
Public Instance Methods
app_env_service_name(worker_number)
click to toggle source
# File lib/capistrano/helpers/delayed_job/monit.rb, line 14 def app_env_service_name(worker_number) "#{user_app_env_underscore}_#{fetch(:delayed_job_monit_base_service_name)}_#{worker_number}" end
available_configuration_file(worker_number)
click to toggle source
# File lib/capistrano/helpers/delayed_job/monit.rb, line 36 def available_configuration_file(worker_number) "#{service_name(worker_number)}.conf" end
available_configuration_with_path(worker_number)
click to toggle source
# File lib/capistrano/helpers/delayed_job/monit.rb, line 32 def available_configuration_with_path(worker_number) File.join(fetch(:monit_available_path), "#{service_name(worker_number)}.conf") end
pid_file(worker_number)
click to toggle source
# File lib/capistrano/helpers/delayed_job/monit.rb, line 10 def pid_file(worker_number) service_pid("#{service_name(worker_number)}") end
service_name(worker_number)
click to toggle source
# File lib/capistrano/helpers/delayed_job/monit.rb, line 18 def service_name(worker_number) "#{fetch(:delayed_job_monit_base_service_name)}_#{worker_number}" end
start_command(worker_number)
click to toggle source
# File lib/capistrano/helpers/delayed_job/monit.rb, line 22 def start_command(worker_number) "/bin/bash -c '[ ! -h #{runit_service_path(service_name(worker_number))}/run ] || /usr/bin/sv start #{runit_service_path(service_name(worker_number))}'" # rubocop:disable Metrics/LineLength end
stop_command(worker_number)
click to toggle source
# File lib/capistrano/helpers/delayed_job/monit.rb, line 26 def stop_command(worker_number) # Give delayed job 60 seconds to finish any jobs it's currently handling. # (Tasks that are longer than 60 seconds should be split!) "/usr/bin/sv -w 60 force-stop #{runit_service_path(service_name(worker_number))}" # rubocop:disable Metrics/LineLength end