Skip to content

Instantly share code, notes, and snippets.

@tareksamni
Last active March 8, 2016 08:59
Show Gist options
  • Save tareksamni/c8ff8b8d1a6234c9137c to your computer and use it in GitHub Desktop.
Save tareksamni/c8ff8b8d1a6234c9137c to your computer and use it in GitHub Desktop.
AWS Elastic BeansTalk configuration to run Sidekiq after each deployment
## For more details refer to: http://tsamni.com/post/84515089035/sidekiq-performing-background-or-delayed-jobs-with
## .ebextensions/sidekiq.config
commands:
create_post_dir:
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq":
mode: "000777"
content: |
cd /var/app/current
if [ -f /var/app/support/pids/sidekiq.pid ]
then
kill -TERM `cat /var/app/support/pids/sidekiq.pid`
rm -rf /var/app/support/pids/sidekiq.pid
fi
. /opt/elasticbeanstalk/support/envvars.d/sysenv
sleep 10
bundle exec sidekiq \
-e production \
-P /var/app/support/pids/sidekiq.pid \
-L /var/app/support/logs/sidekiq.log \
-q default \
-d
"/opt/elasticbeanstalk/hooks/appdeploy/pre/03_mute_sidekiq":
mode: "000777"
content: |
if [ -f /var/app/support/pids/sidekiq.pid ]
then
kill -USR1 `cat /var/app/support/pids/sidekiq.pid`
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment