Last active
February 24, 2016 01:59
-
-
Save djsegal/00996ff315772649d4a1 to your computer and use it in GitHub Desktop.
Consolidated code snippet from seg.al/blog/sidekiq
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
#.ebextensions/04_sidekiq.config | |
commands: | |
create_post_dir: | |
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/usr/bin/env bash | |
source /usr/local/share/chruby/chruby.sh | |
chruby current | |
. /opt/elasticbeanstalk/support/envvars | |
cd /var/app/current | |
PIDFILE=/var/app/containerfiles/pids/sidekiq.pid | |
if [ -f ${PIDFILE} ] | |
then | |
kill -TERM `cat ${PIDFILE}` | |
rm -rf ${PIDFILE} | |
fi | |
. /opt/elasticbeanstalk/support/envvars.d/sysenv | |
sleep 10 | |
bundle exec sidekiq \ | |
-e $RAILS_ENV \ | |
-P ${PIDFILE} \ | |
-C /var/app/current/config/sidekiq.yml \ | |
-L /var/app/containerfiles/logs/sidekiq.log \ | |
-q default \ | |
-d | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/03_mute_sidekiq": | |
mode: "000755" | |
owner: root | |
group: root | |
ignoreErrors: true | |
content: | | |
#!/usr/bin/env bash | |
source /usr/local/share/chruby/chruby.sh | |
chruby current | |
. /opt/elasticbeanstalk/support/envvars | |
cd /var/app/current | |
PIDFILE=/var/app/containerfiles/pids/sidekiq.pid | |
if [ -f ${PIDFILE} ] | |
then | |
kill -USR1 `cat ${PIDFILE}` | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment