Skip to content

Instantly share code, notes, and snippets.

@raecoo
Forked from brycejohnston/sidekiq.service
Created November 23, 2019 14:00
Show Gist options
  • Save raecoo/e862cb36ae6f44d4accc97e31ffb3427 to your computer and use it in GitHub Desktop.
Save raecoo/e862cb36ae6f44d4accc97e31ffb3427 to your computer and use it in GitHub Desktop.
Sidekiq systemd service for Debian
#
# systemd unit file for Debian
#
# Put this in /lib/systemd/system
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
#
[Unit]
Description=sidekiq
# start sidekiq only once the network, logging subsystems and local redis instance are available
After=syslog.target network.target redis-server.service postgresql.service
[Service]
# change path to bundle if not using rbenv
Type=simple
WorkingDirectory=/home/deploy/myapp/current
User=deploy
Group=deploy
UMask=0002
ExecStart=/home/deploy/.rbenv/shims/bundle exec sidekiq -e production -C config/sidekiq.yml -L log/sidekiq.log
ExecStop=/home/deploy/.rbenv/shims/bundle exec sidekiqctl stop /home/deploy/myapp/current/pids/sidekiq.pid
# if we crash, restart
RestartSec=1
Restart=on-failure
# output goes to /var/log/syslog
StandardOutput=syslog
StandardError=syslog
# This will default to "bundler" if we don't specify it
SyslogIdentifier=sidekiq
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment