Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tschwaerzl/011efc3d799aafb08aca57727c10a611 to your computer and use it in GitHub Desktop.
Save tschwaerzl/011efc3d799aafb08aca57727c10a611 to your computer and use it in GitHub Desktop.
systemd unit files for sidekiq service. note backslashes in filenames are really front slashes.
# This file actually fires up multiple sidekiq services.
# to start: systemctl start sidekiq.target
#
[Unit]
Description=Fire up up to 6 sidekiqs
# If you want more than 6 processes, append sidekiq@7.service, sidekiq@8.service, etc. to the ExecStart line below
# Note that only as many as have been enabled will actually start.
# Note also that the Unit data for each sidekiq process is in /lib/systemd/system/sidekiq@.service
[Service]
Type=oneshot
ExecStart=/bin/systemctl --no-block start sidekiq@1.service sidekiq@2.service sidekiq@3.service sidekiq@4.service sidekiq@5.service sidekiq@6.service
RemainAfterExit=true
# This file doesn't seem to do much but it's presence is required so one may startup multiple
# sidekiq instances with a single command
#
# sudo systemctl start sidekiq.target
#
# The command actually executed is in /lib/systemd/system/sidekiq.target.wants/sidekiq-static.service
#
[Unit]
Description=sidekiq
# This file actually fires up multiple sidekiq services.
# to start: systemctl start sidekiq.target
#
[Unit]
Description=Fire up up to 6 sidekiqs
# If you want more than 6 processes, append sidekiq@7.service, sidekiq@8.service, etc. to the ExecStart line below
# Note that only as many as have been enabled will actually start.
# Note also that the Unit data for each sidekiq process is in /lib/systemd/system/sidekiq@.service
[Service]
Type=oneshot
ExecStart=/bin/systemctl --no-block start sidekiq@1.service sidekiq@2.service sidekiq@3.service sidekiq@4.service sidekiq@5.service sidekiq@6.service
RemainAfterExit=true
#
# systemd unit file for CentOS 7, Ubuntu 15.04
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file allows for multiple Sidekiq process.
# To run multiple processes, first enable each (one time)
# with:
# - systemctl enable sidekiq@n.service
#
# where n is 1 ... number of processes you wish enabled.
#
# Then control each process
# with:
# - systemctl {start,stop,restart} sidekiq@n.service
#
# See sidekiq.target to start and stop all processes at once.
#
[Unit]
Description=SideKiq Process %I
PartOf=sidekiq.service
ReloadPropagatedFrom=sidekiq.service
# start us only once the network and logging subsystems are available,
# consider adding redis-server.service if Redis is local and systemd-managed.
After=syslog.target network.target
# See these pages for lots of options:
# http://0pointer.de/public/systemd-man/systemd.service.html
# http://0pointer.de/public/systemd-man/systemd.exec.html
[Service]
Type=simple
WorkingDirectory=/mnt/esebco-production/current
# If you use rbenv:
# ExecStart=/bin/bash -lc 'bundle exec sidekiq -e production'
# If you use the system's ruby:
Environment=PATH=/usr/local/rubies/2.2.5/bin:$PATH
ExecStart=/usr/local/rubies/2.2.5/bin/bundle exec sidekiq -C /mnt/esebco-production/current/config/sidekiq.yml -i %I -e production
User=ubuntu
Group=ubuntu
UMask=0002
KillSignal=SIGTERM
# 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
# The pixie dust that allows multiple processes to be starte
[Install]
WantedBy=sidekiq.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment