Skip to content

Instantly share code, notes, and snippets.

@jacoelho
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacoelho/a234644b14a4cd072d53 to your computer and use it in GitHub Desktop.
Save jacoelho/a234644b14a4cd072d53 to your computer and use it in GitHub Desktop.
Upstart rvm sidekiq
description "Sidekiq Background Worker"
start on runlevel [2345]
stop on runlevel [06]
setuid ubuntu
setgid ubuntu
env HOME=/home/ubuntu/
# This indicate that we want to restart the Job if it crashes
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
script
exec /bin/bash <<EOT
source $HOME/.rvm/scripts/rvm;
export GITHUB_TOKEN=<TOKEN>
export RAILS_ENV=<env>
cd $HOME/public_html/app/current
nohup bundle exec sidekiq -C config/sidekiq.yml >> log/sidekiq.log 2>&1
EOT
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment