Skip to content

Instantly share code, notes, and snippets.

@jackcompton
Created March 31, 2015 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackcompton/a4ec784d219ff5440926 to your computer and use it in GitHub Desktop.
Save jackcompton/a4ec784d219ff5440926 to your computer and use it in GitHub Desktop.
description "Elastic Beanstalk Puma Upstart Manager"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
script
exec /bin/bash <<"EOF"
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
if grep -eq 'true' /etc/elasticbeanstalk/has_puma.txt; then
exec su -s /bin/bash -c "bundle exec puma -C $EB_SUPPORT_DIR/conf/pumaconf.rb" webapp
else
exec su -s /bin/bash -c "puma -C $EB_SUPPORT_DIR/conf/pumaconf.rb" webapp
fi
EOF
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment