Last active
March 19, 2016 05:53
-
-
Save octoberstorm/e97e35756eb1a16deec2 to your computer and use it in GitHub Desktop.
ElasticBeanstalk common
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
# http://stackoverflow.com/questions/18908426/increasing-client-max-body-size-in-nginx-conf-on-aws-elastic-beanstalk | |
files: | |
"/etc/nginx/conf.d/proxy.conf" : | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
client_max_body_size 20M; |
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: | |
"/opt/elasticbeanstalk/support/eb-sidekiq.sh": | |
mode: "000777" | |
content: | | |
#!/bin/bash | |
case $1 in | |
start) | |
cd /var/app/current | |
. /opt/elasticbeanstalk/support/envvars | |
sleep 10 | |
sudo -u webapp -E env "PATH=/opt/rubies/ruby-current/bin:$PATH" bundle exec sidekiq -P /var/app/support/pids/sidekiq.pid -L /var/app/support/logs/sidekiq.log -d | |
;; | |
stop) | |
if [ -f /var/app/support/pids/sidekiq.pid ]; then | |
kill -TERM `cat /var/app/support/pids/sidekiq.pid` | |
rm -rf /var/app/support/pids/sidekiq.pid | |
fi | |
;; | |
*) | |
echo "usage: eb-sidekiq.sh {start|stop}" ;; | |
esac | |
exit 0 | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/31_restart_sidekiq": | |
mode: "000777" | |
content: | | |
/opt/elasticbeanstalk/support/eb-sidekiq.sh start | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_mute_sidekiq": | |
mode: "000777" | |
content: | | |
/opt/elasticbeanstalk/support/eb-sidekiq.sh stop | |
"/etc/monit.d/sidekiq": | |
mode: "000644" | |
owner: root | |
group: root | |
content: | | |
check process sidekiq | |
with pidfile /var/app/support/pids/sidekiq.pid every 2 cycles | |
start program = "/opt/elasticbeanstalk/support/eb-sidekiq.sh start" | |
stop program = "/opt/elasticbeanstalk/support/eb-sidekiq.sh stop" | |
commands: | |
remove_bak: | |
command: "rm -f /etc/monit.d/sidekiq.bak" | |
ignoreErrors: true | |
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
commands: | |
create_post_dir: | |
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_create_cron_jobs.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/usr/bin/env bash | |
echo "0 * * * * . /opt/elasticbeanstalk/support/envvars;PATH=/opt/rubies/ruby-current/bin:$PATH; cd /var/app/current; bundle exec rake db:system_report >> /var/app/current/log/cron.log 2>&1" > /tmp/crontab | |
echo "0 20 * * * . /opt/elasticbeanstalk/support/envvars;PATH=/opt/rubies/ruby-current/bin:$PATH; cd /var/app/current; bundle exec rake db:process_user_achievement >> /var/app/current/log/cron.log 2>&1" >> /tmp/crontab | |
crontab /tmp/crontab |
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
commands: | |
create_post_dir: | |
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_start_faye_server.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/usr/bin/env bash | |
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 | |
. $EB_SUPPORT_DIR/envvars.d/sysenv | |
su -c "bundle exec thin -p 9292 -e $RAILS_ENV -R config.ru --timeout 60 start -d" $EB_CONFIG_APP_USER |
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: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/22_restart_monit": | |
mode: "000777" | |
content: | | |
service monit start | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/08_mute_monit": | |
mode: "000777" | |
content: | | |
service monit stop |
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
packages: | |
yum: | |
git: [] | |
monit: [] |
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
services: | |
sysvinit: | |
monit: | |
enabled: true | |
ensureRunning: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment