Skip to content

Instantly share code, notes, and snippets.

@dyatlov
Created January 13, 2016 17:19
Show Gist options
  • Save dyatlov/4ca6ab8eb291d520036e to your computer and use it in GitHub Desktop.
Save dyatlov/4ca6ab8eb291d520036e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
. /opt/elasticbeanstalk/support/envvars
DIR=/var/app/current
if [ "$WORKER_MODE" = "1" ]
then
if [ -f /var/run/shoryuken.pid ]
then
su -l -c "kill -USR1 `cat /var/run/shoryuken.pid`" root || echo "no process"
su -l -c "rm -f /var/run/shoryuken.pid" root || echo "no file"
fi
su -l -c "cd $DIR && bundle exec shoryuken -d -R -C config/shoryuken.yml -P /var/run/shoryuken.pid -L log/shoryuken.log" root
fi
packages:
yum:
git: []
ImageMagick: []
commands:
01_node_install:
cwd: /tmp
test: '[ ! -f /usr/bin/node ] && echo "node not installed"'
command: 'yum install -y nodejs --enablerepo=epel'
option_settings:
- namespace: aws:elasticbeanstalk:command
option_name: Timeout
value: 1800
container_commands:
01_npm_install_webpack:
command: "npm install --global webpack"
02_reload_nginx_conf:
test: '[ ! "$WORKER_MODE" = "1" ]'
command: service nginx reload
03_migrate:
test: '[ ! "$WORKER_MODE" = "1" ]'
command: rake db:migrate
leader_only: true
04_npm_install:
command: "npm install"
ignoreErrors: false
05_webpack:
command: "webpack"
ignoreErrors: false
06_rails_asset_compilation:
command: "bundle exec rake assets:precompile > /tmp/asset_precompile.log 2>&1"
ignoreErrors: false
96_change_permissions_for_hook:
command: "chmod 755 .ebextensions/hooks/restart_shoryuken.sh"
97_set_post_deploy_hook:
command: "cp .ebextensions/hooks/restart_shoryuken.sh /opt/elasticbeanstalk/hooks/appdeploy/post/"
98_set_post_config_hook:
command: "cp .ebextensions/hooks/restart_shoryuken.sh /opt/elasticbeanstalk/hooks/configdeploy/post/"
99_set_post_restart_hook:
command: "cp .ebextensions/hooks/restart_shoryuken.sh /opt/elasticbeanstalk/hooks/restartappserver/post/"
files:
"/etc/nginx/conf.d/proxy.conf":
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 50M;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment