Skip to content

Instantly share code, notes, and snippets.

@dimidd
Created February 24, 2017 13:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dimidd/64c43ef5e26ad55320d0a27098a7d466 to your computer and use it in GitHub Desktop.
Save dimidd/64c43ef5e26ad55320d0a27098a7d466 to your computer and use it in GitHub Desktop.
#
# 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 corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
#
# See Inspeqtor's Systemd wiki page for more detail about Systemd:
# https://github.com/mperham/inspeqtor/wiki/Systemd
#
[Unit]
Description=shoryuken
# 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=/home/myuser/apps/myapp/current/
# If you use rbenv:
# ExecStart=/bin/bash -lc 'bundle exec sidekiq -e production'
# If you use the system's ruby:
#ExecStart=/usr/local/bin/bundle exec sidekiq -e production
Environment='RAILS_ENV=production'
ExecStart=/home/myuser/.rvm/bin/rvm default do bundle exec shoryuken --pidfile '/home/myuser/apps/myapp/shared/tmp/pids/shoryuken.pid' --logfile '/home/myuser/apps/myapp/shared/log/shoryuken.log' --config '/home/myuser/apps/myapp/shared/config/shoryuken.yml' --rails
User=myuser
Group=myuser
UMask=0002
# 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=shoryuken
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment