From 9a44071af1ba2b2a155dd3f3e607d6aec24af6ae Mon Sep 17 00:00:00 2001 From: Narath Carlile Date: Thu, 8 Jul 2021 16:44:43 +0200 Subject: [PATCH] Update Sidekiq.service as a user service (#4938) You recommend the use of capistrano-sidekiq. This uses a user service (which is likely a good idea for most users from a security perspective). In order to get it to work, changes need to be made to the Sidekiq.service file (and location) --- examples/systemd/sidekiq.service | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/examples/systemd/sidekiq.service b/examples/systemd/sidekiq.service index 5df9cdc84..a0848657c 100644 --- a/examples/systemd/sidekiq.service +++ b/examples/systemd/sidekiq.service @@ -2,6 +2,14 @@ # This file tells systemd how to run Sidekiq as a 24/7 long-running daemon. # # Customize this file based on your bundler location, app directory, etc. +# +# If you are going to run this as a user service (or you are going to use capistrano-sidekiq) +# Customize and copy this to ~/.config/systemd/user +# Then run: +# - systemctl --user enable sidekiq +# - systemctl --user {start,stop,restart} sidekiq +# +# If you are going to run this as a system service # Customize and copy this into /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu). # Then run: # - systemctl enable sidekiq @@ -55,10 +63,12 @@ ExecStart=/home/deploy/.rvm/bin/rvm in /opt/myapp/current do bundle exec sidekiq # Use `systemctl kill -s TSTP sidekiq` to quiet the Sidekiq process -# !!! Change this to your deploy user account !!! -User=deploy -Group=deploy -UMask=0002 +# Uncomment this if you are going to use this as a system service +# if using as a user service then leave commented out, or you will get an error trying to start the service +# !!! Change this to your deploy user account if you are using this as a system service !!! +# User=deploy +# Group=deploy +# UMask=0002 # Greatly reduce Ruby memory fragmentation and heap usage # https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/