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

Update systemd.rb, add explicit sidekiq_systemctl_user #318

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
5 changes: 3 additions & 2 deletions lib/capistrano/sidekiq/systemd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def set_defaults
set_if_empty :service_unit_user, :user
set_if_empty :systemctl_user, fetch(:service_unit_user, :user) == :user

set_if_empty :sidekiq_systemctl_user, -> { fetch(:service_unit_user) }
set_if_empty :sidekiq_service_unit_name, -> { "#{fetch(:application)}_sidekiq_#{fetch(:stage)}" }
set_if_empty :sidekiq_lingering_user, -> { fetch(:lingering_user, fetch(:user)) }

Expand All @@ -24,15 +25,15 @@ def set_defaults
def systemd_command(*args)
command = [fetch(:systemctl_bin)]

unless fetch(:service_unit_user) == :system
unless fetch(:sidekiq_systemctl_user) == :system
command << "--user"
end

command + args
end

def sudo_if_needed(*command)
if fetch(:service_unit_user) == :system
if fetch(:sidekiq_systemctl_user) == :system
backend.sudo command.map(&:to_s).join(" ")
else
backend.execute(*command)
Expand Down