-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup deployment of sidekiq for worker process on Elastic Beanstalk. #…
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
files: | ||
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq": | ||
mode: "000755" | ||
content: | | ||
#!/bin/bash | ||
initctl restart sidekiq || initctl start sidekiq | ||
|
||
ln -sf /var/app/current/log/sidekiq.log /var/app/containerfiles/logs/sidekiq.log | ||
|
||
"/opt/elasticbeanstalk/hooks/appdeploy/pre/03_mute_sidekiq": | ||
mode: "000755" | ||
content: | | ||
#!/bin/bash | ||
|
||
. /opt/elasticbeanstalk/support/envvars | ||
|
||
PIDFILE=/var/app/containerfiles/pids/sidekiq.pid | ||
if [ -f ${PIDFILE} ]; then | ||
if [ -d /proc/`cat ${PIDFILE}` ]; then | ||
kill -USR1 `cat ${PIDFILE}` | ||
fi | ||
fi | ||
|
||
"/opt/elasticbeanstalk/support/conf/sidekiq.conf": | ||
mode: "000644" | ||
content: | | ||
description "Elastic Beanstalk Sidekiq Upstart Manager" | ||
|
||
start on runlevel [2345] | ||
stop on runlevel [!2345] | ||
|
||
# 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 | ||
|
||
exec su -s /bin/bash -c "sidekiq -e ${RACK_ENV} -c ${SIDEKIQ_WORKERS:-2} -L ${EB_APP_DEPLOY_DIR}/log/sidekiq.log -C ${EB_APP_DEPLOY_DIR}/config/sidekiq.yml -P ${EB_APP_PID_DIR}/sidekiq.pid" webapp | ||
EOT | ||
end script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
files: | ||
"/etc/init/sidekiq.conf" : | ||
mode: "120400" | ||
content: "/opt/elasticbeanstalk/support/conf/sidekiq.conf" | ||
|
||
commands: | ||
reload_initctl_for_sidekiq: | ||
command: "initctl reload-configuration" |