Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • 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 [email protected], [email protected], 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/[email protected]
[Service]
Type=oneshot
ExecStart=/bin/systemctl --no-block start [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
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 [email protected], [email protected], 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/[email protected]
[Service]
Type=oneshot
ExecStart=/bin/systemctl --no-block start [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
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 [email protected]
#
# where n is 1 ... number of processes you wish enabled.
#
# Then control each process
# with:
# - systemctl {start,stop,restart} [email protected]
#
# 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