Skip to content

Instantly share code, notes, and snippets.

@panmari
Created August 16, 2015 12:49
Show Gist options
  • Save panmari/b7caa2171fb21de2f299 to your computer and use it in GitHub Desktop.
Save panmari/b7caa2171fb21de2f299 to your computer and use it in GitHub Desktop.
# /etc/init/sidekiq.conf - Sidekiq config
# This example config should work with Ubuntu 12.04+. It
# allows you to manage multiple Sidekiq instances with
# Upstart, Ubuntu's native service management tool.
#
# See workers.conf for how to manage all Sidekiq instances at once.
#
# Save this config as /etc/init/sidekiq.conf then manage sidekiq with:
# sudo start sidekiq index=0
# sudo stop sidekiq index=0
# sudo status sidekiq index=0
#
# or use the service command:
# sudo service sidekiq {start,stop,restart,status}
#
description "Sidekiq Background Worker"
# This script is not meant to start on bootup, workers.conf
# will start all sidekiq instances explicitly when it starts.
#start on runlevel [2345]
#stop on runlevel [06]
# change to match your deployment user
setuid panmari
setgid panmari
env HOME=/home/panmari
respawn
respawn limit 3 30
# TERM is sent by sidekiqctl when stopping sidekiq. Without declaring these as
# normal exit codes, it just respawns.
normal exit 0 TERM
# Older versions of Upstart might not support the reload command and need
# this commented out.
reload signal USR1
instance $index
script
# this script runs in /bin/sh by default
# respawn as bash so we can source in rbenv
exec /bin/bash <<'EOT'
# rvm
source /etc/profile
# Logs out to /var/log/upstart/sidekiq.log by default
cd /opt/webapps/my_app
exec bundle exec sidekiq -i ${index} -e production
EOT
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment