Skip to content

Instantly share code, notes, and snippets.

@Tmw
Created February 4, 2015 10:35
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 Tmw/2d0dc3002b4d24e6b2b4 to your computer and use it in GitHub Desktop.
Save Tmw/2d0dc3002b4d24e6b2b4 to your computer and use it in GitHub Desktop.
Setup Sidekiq on AWS EB with Ruby 2.1 (Amazon Linux 2014.09 v1.0.9)
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq":
mode: "000777"
owner: root
group: root
content: |
cd /var/app/current
mkdir -p /var/app/current/tmp/pids
mkdir -p /var/app/current/tmp/logs
if [ -f /var/app/current/tmp/pids/sidekiq.pid ]
then
kill -TERM `cat /var/app/current/tmp/pids/sidekiq.pid`
rm -rf /var/app/current/tmp/pids/sidekiq.pid
fi
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir)
EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user)
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
. $EB_SUPPORT_DIR/envvars
. $EB_SCRIPT_DIR/use-app-ruby.sh
sleep 10
bundle exec sidekiq -e $RACK_ENV -C /var/app/current/config/sidekiq.yml -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