Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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