Forked from damontorgerson/gist:2231f42302da9f9f078b
Last active
August 26, 2015 23:35
-
-
Save dinjas/8b55e6e01503ea617cb2 to your computer and use it in GitHub Desktop.
Launch SIDEKIQ in Amazon Elastic Beanstalk (AMI 1.0.9)
This file contains hidden or 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
files: | |
"/etc/rsyslog.d/11-sidekiq.conf": | |
mode: '000644' | |
content: | | |
EB_CONFIG_APP_LOGS=$(/opt/elasticbeanstalk/bin/get-config container -k app_log_dir) | |
$InputFileName $EB_CONFIG_APP_LOGS/sidekiq.log | |
$InputFileTag sidekiq | |
$InputFileStateFile sidekiq-state | |
$InputFileSeverity info | |
$InputFileFacility local6 | |
$InputRunFileMonitor | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq": | |
mode: "000777" | |
owner: root | |
group: root | |
content: | | |
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_CONFIG_APP_CURRENT=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir) | |
EB_CONFIG_APP_LOGS=$(/opt/elasticbeanstalk/bin/get-config container -k app_log_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_CONFIG_APP_PIDS=$(/opt/elasticbeanstalk/bin/get-config container -k app_pid_dir) | |
. $EB_SUPPORT_DIR/envvars | |
. $EB_SCRIPT_DIR/use-app-ruby.sh | |
cd $EB_CONFIG_APP_CURRENT | |
if [ -f $EB_CONFIG_APP_PIDS/sidekiq.pid ] | |
then | |
kill -TERM `cat $EB_CONFIG_APP_PIDS/sidekiq.pid` | |
rm -rf $EB_CONFIG_APP_PIDS/sidekiq.pid | |
fi | |
. $EB_SUPPORT_DIR/envvars.d/sysenv | |
sleep 10 | |
bundle exec sidekiq \ | |
-P $EB_CONFIG_APP_PIDS/sidekiq.pid \ | |
-C $EB_CONFIG_APP_CURRENT/config/sidekiq.yml \ | |
-L $EB_CONFIG_APP_LOGS/sidekiq.log \ | |
-d | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/03_mute_sidekiq": | |
mode: "000777" | |
content: | | |
EB_CONFIG_APP_PIDS=$(/opt/elasticbeanstalk/bin/get-config container -k app_pid_dir) | |
if [ -f $EB_CONFIG_APP_PIDS/sidekiq.pid ] | |
then | |
kill -USR1 `cat $EB_CONFIG_APP_PIDS/pids/sidekiq.pid` | |
rm -rf $EB_CONFIG_APP_PIDS/sidekiq.pid | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment