Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multi-process sidekiq systemd commands #304

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions lib/capistrano/tasks/systemd.rake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ namespace :sidekiq do
task command do
on roles fetch(:sidekiq_roles) do |role|
git_plugin.switch_user(role) do
git_plugin.systemctl_command(command)
git_plugin.process_block do |process|
git_plugin.systemctl_command(command, process: process)
end
end
end
end
Expand Down Expand Up @@ -83,8 +85,9 @@ namespace :sidekiq do
git_plugin.create_systemd_config_symlink(process)
end
end
git_plugin.systemctl_command(:enable)

git_plugin.process_block do |process|
git_plugin.systemctl_command(:enable, process: process)
end
if fetch(:sidekiq_service_unit_user) != :system && fetch(:sidekiq_enable_lingering)
execute :loginctl, 'enable-linger', fetch(:sidekiq_lingering_user)
end
Expand All @@ -96,8 +99,10 @@ namespace :sidekiq do
task :uninstall do
on roles fetch(:sidekiq_roles) do |role|
git_plugin.switch_user(role) do
git_plugin.systemctl_command(:stop)
git_plugin.systemctl_command(:disable)
git_plugin.process_block do |process|
git_plugin.systemctl_command(:stop, process: process)
git_plugin.systemctl_command(:disable, process: process)
end
if git_plugin.config_per_process?
git_plugin.process_block do |process|
git_plugin.delete_systemd_config_symlink(process)
Expand Down Expand Up @@ -218,7 +223,9 @@ namespace :sidekiq do
end

def quiet_sidekiq
systemctl_command(:kill, '-s', :TSTP)
process_block do |process|
systemctl_command(:kill, '-s', :TSTP, process: process)
end
end

def switch_user(role, &block)
Expand Down