Created
April 26, 2017 04:11
-
-
Save adamrunner/114faadb1e54796066d8a90e60e429d7 to your computer and use it in GitHub Desktop.
sidekiq staging configuration file for ubuntu upstart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sidekiq Preview/Staging Background worker | |
# sudo initctl sidekiq-staging {start, stop, restart} | |
# | |
description "Staging/Preview 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 deploy | |
setgid deploy | |
env HOME=/home/deploy | |
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 TSTP | |
# Upstart waits 5 seconds by default to kill the a process. Increase timeout to | |
# give sidekiq process enough time to exit. | |
kill timeout 15 | |
script | |
# this script runs in /bin/sh by default | |
# respawn as bash so we can source in rbenv | |
exec /bin/bash <<'EOT' | |
# Logs out to /var/log/upstart/sidekiq-staging.log by default | |
source /home/deploy/.bashrc | |
cd /home/deploy/stalnakers-rails-preview/current | |
/home/deploy/.rbenv/bin/rbenv exec bundle exec sidekiq -e staging | |
EOT | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment