Skip to content

Instantly share code, notes, and snippets.

@sotayamashita
Last active December 4, 2018 05:25
Show Gist options
  • Save sotayamashita/1c044aefc57549f2b149ccf593e2b610 to your computer and use it in GitHub Desktop.
Save sotayamashita/1c044aefc57549f2b149ccf593e2b610 to your computer and use it in GitHub Desktop.
Setup shoryuken on Elastic Beanstalk
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_shoryuken":
mode: "000777"
content: |
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
. $EB_SUPPORT_DIR/envvars
. $EB_SCRIPT_DIR/use-app-ruby.sh
mkdir -p /var/app/support/pids
mkdir -p /var/app/support/logs
cd /var/app/current
if [ -f /var/app/support/pids/shoryuken.pid ]
then
kill -TERM `cat /var/app/support/pids/shoryuken.pid`
rm -rf /var/app/support/pids/shoryuken.pid
fi
sleep 10
bundle exec shoryuken \
-R \
-P /var/app/support/pids/shoryuken.pid \
-C /var/app/current/config/shoryuken.yml \
-L /var/app/support/logs/shoryuken.log \
-d
"/opt/elasticbeanstalk/hooks/appdeploy/pre/03_mute_shoryuken":
mode: "000777"
content: |
if [ -f /var/app/support/pids/shoryuken.pid ]
then
kill -USR1 `cat /var/app/support/pids/shoryuken.pid`
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment