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

Support for one process per profile #309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
32 changes: 24 additions & 8 deletions lib/capistrano/tasks/systemd.rake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ namespace :sidekiq do
task command do
on roles fetch(:sidekiq_roles) do |role|
git_plugin.switch_user(role) do
git_plugin.systemctl_command(command)
if git_plugin.config_per_process?
git_plugin.process_block do |process|
git_plugin.systemctl_command(command, process: process)
end
else
git_plugin.systemctl_command(command)
end
end
end
end
Expand Down Expand Up @@ -81,9 +87,11 @@ namespace :sidekiq do
if git_plugin.config_per_process?
git_plugin.process_block do |process|
git_plugin.create_systemd_config_symlink(process)
git_plugin.systemctl_command(:enable, process: process)
end
else
git_plugin.systemctl_command(:enable)
end
git_plugin.systemctl_command(:enable)

if fetch(:sidekiq_service_unit_user) != :system && fetch(:sidekiq_enable_lingering)
execute :loginctl, 'enable-linger', fetch(:sidekiq_lingering_user)
Expand All @@ -96,17 +104,25 @@ 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)
if git_plugin.config_per_process?
git_plugin.process_block do |process|
git_plugin.systemctl_command(:stop, process: process)
git_plugin.systemctl_command(:disable, process: process)
git_plugin.delete_systemd_config_symlink(process)
execute :sudo, :rm, '-f', File.join(
fetch(:service_unit_path, git_plugin.fetch_systemd_unit_path),
git_plugin.sidekiq_service_file_name(process)
)
end
else
git_plugin.systemctl_command(:stop)
git_plugin.systemctl_command(:disable)
execute :sudo, :rm, '-f', File.join(
fetch(:service_unit_path, git_plugin.fetch_systemd_unit_path),
git_plugin.sidekiq_service_file_name
)
end
execute :sudo, :rm, '-f', File.join(
fetch(:service_unit_path, git_plugin.fetch_systemd_unit_path),
git_plugin.sidekiq_service_file_name
)

end
end
end
Expand Down