diff --git a/examples/upstart.conf b/examples/upstart.conf deleted file mode 100644 index dd4982ec..00000000 --- a/examples/upstart.conf +++ /dev/null @@ -1,39 +0,0 @@ -# /etc/init/sidekiq.conf - Sidekiq config - -# This example config should work with Ubuntu 12.04+ -# -# Save this config as /etc/init/sidekiq.conf then mange sidekiq with: -# sudo start sidekiq -# sudo stop sidekiq -# sudo status sidekiq -# -# or use the service command: -# sudo service sidekiq {start,stop,restart,status} -# -# This is the exact script used to manage Sidekiq on TheClymb.com -# - -description "Sidekiq Background Worker System" - -start on runlevel [2345] -stop on shutdown - -setuid deploy -setgid deploy - -respawn -respawn limit 3 30 - -script -# this script runs in /bin/sh by default -# respawn as bash so we can source in rbenv -exec /bin/bash </dev/kmsg 2>&1 - # pull in system rbenv - source /etc/profile.d/rbenv.sh - - cd /opt/theclymb/current - exec bin/sidekiq -e production -C config/sidekiq.yml -P tmp/pids/sidekiq.pid -EOT -end script diff --git a/examples/upstart/sidekiq.conf b/examples/upstart/sidekiq.conf new file mode 100644 index 00000000..b112bd9d --- /dev/null +++ b/examples/upstart/sidekiq.conf @@ -0,0 +1,46 @@ +# /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 mange 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" + +# no "start on", we don't want to automatically start +stop on (stopping workers or runlevel [06]) + +# change to match your deployment user +setuid deploy +setgid deploy + +respawn +respawn limit 3 30 + +instance $index + +script +# this script runs in /bin/sh by default +# respawn as bash so we can source in rbenv +exec /bin/bash < /dev/kmsg + + # pull in system rbenv + export HOME=/home/deploy + source /etc/profile.d/rbenv.sh + + cd /opt/theclymb/current + exec bin/sidekiq -i ${index} -e production -C config/sidekiq.yml -P tmp/pids/sidekiq-${index}.pid +EOT +end script diff --git a/examples/upstart/workers.conf b/examples/upstart/workers.conf new file mode 100644 index 00000000..ccf71a1a --- /dev/null +++ b/examples/upstart/workers.conf @@ -0,0 +1,30 @@ +# /etc/init/workers.conf - manage a set of Sidekiqs + +# 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 sidekiq.conf for how to manage a single Sidekiq instance. +# +# Use "stop workers" to stop all Sidekiq instances. +# Use "start workers" to start all instances. +# Use "restart workers" to restart all instances. +# Crazy, right? +# + +description "manages the set of sidekiq processes" + +# This starts upon bootup and stops on shutdown +start on runlevel [2345] +stop on runlevel [06] + +# Set this to the number of Sidekiq processes you want +# to run on this machine +env NUM_WORKERS=2 + +pre-start script + for i in `seq 0 $((${NUM_WORKERS} - 1))` + do + start sidekiq index=$i + done +end script