2013-03-09 16:18:03 -05:00
|
|
|
# /etc/init/puma.conf - Puma config
|
|
|
|
|
|
|
|
# This example config should work with Ubuntu 12.04+. It
|
|
|
|
# allows you to manage multiple Puma instances with
|
|
|
|
# Upstart, Ubuntu's native service management tool.
|
|
|
|
#
|
|
|
|
# See workers.conf for how to manage all Puma instances at once.
|
|
|
|
#
|
2013-06-05 13:28:32 -04:00
|
|
|
# Save this config as /etc/init/puma.conf then manage puma with:
|
2013-03-09 16:18:03 -05:00
|
|
|
# sudo start puma index=0
|
|
|
|
# sudo stop puma index=0
|
|
|
|
# sudo status puma index=0
|
|
|
|
#
|
|
|
|
# or use the service command:
|
|
|
|
# sudo service puma {start,stop,restart,status}
|
|
|
|
#
|
|
|
|
|
|
|
|
description "Puma Background Worker"
|
|
|
|
|
|
|
|
# no "start on", we don't want to automatically start
|
|
|
|
stop on (stopping puma-manager or runlevel [06])
|
|
|
|
|
|
|
|
# change apps to match your deployment user if you want to use this as a less privileged user (recommended!)
|
|
|
|
# setuid apps
|
|
|
|
# setgid apps
|
|
|
|
|
|
|
|
respawn
|
|
|
|
respawn limit 3 30
|
|
|
|
|
|
|
|
instance ${app}
|
|
|
|
|
|
|
|
script
|
|
|
|
# this script runs in /bin/sh by default
|
|
|
|
# respawn as bash so we can source in rbenv/rvm
|
|
|
|
exec /bin/bash <<EOT
|
|
|
|
export HOME=/home/apps
|
2013-06-05 13:28:32 -04:00
|
|
|
|
2013-03-09 16:18:03 -05:00
|
|
|
# Pick your poison :) Or none if you're using a system wide installed Ruby.
|
|
|
|
# rbenv
|
|
|
|
# source /home/apps/.bash_profile
|
|
|
|
# OR
|
|
|
|
# source /home/apps/.profile
|
|
|
|
#
|
|
|
|
# rvm
|
|
|
|
# source /home/apps/.rvm/scripts/rvm
|
|
|
|
|
|
|
|
logger -t puma "Starting server: $app"
|
|
|
|
|
|
|
|
cd $app
|
|
|
|
exec bundle exec puma -C config/puma.rb
|
|
|
|
EOT
|
|
|
|
end script
|