Skip to content

Instantly share code, notes, and snippets.

@bnhansn
Created October 24, 2016 11:58
Show Gist options
  • Save bnhansn/bcabab9a04a06898a92362581c2278d0 to your computer and use it in GitHub Desktop.
Save bnhansn/bcabab9a04a06898a92362581c2278d0 to your computer and use it in GitHub Desktop.
files:
"/opt/elasticbeanstalk/support/conf/sidekiq.conf":
mode: "000755"
content: |
description "Elastic Beanstalk Sidekiq Upstart Manager"
start on runlevel [2345]
stop on runlevel [06]
# explained above
respawn
respawn limit 3 30
script
# scripts run in /bin/sh by default
# respawn as bash so we can source in rbenv
exec /bin/bash <<"EOT"
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
EB_APP_DEPLOY_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)
EB_APP_PID_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_pid_dir)
cd $EB_APP_DEPLOY_DIR
su -s /bin/bash -c "bundle exec sidekiq -e production -L ${EB_APP_DEPLOY_DIR}/log/sidekiq.log -C ${EB_APP_DEPLOY_DIR}/config/sidekiq.yml -P ${EB_APP_PID_DIR}/sidekiq.pid"
EOT
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment