Skip to content

Instantly share code, notes, and snippets.

@djsegal
Last active February 24, 2016 01:59
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 djsegal/00996ff315772649d4a1 to your computer and use it in GitHub Desktop.
Save djsegal/00996ff315772649d4a1 to your computer and use it in GitHub Desktop.
Consolidated code snippet from seg.al/blog/sidekiq
#.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