Skip to content

Instantly share code, notes, and snippets.

@zacksiri
Created November 25, 2013 07:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zacksiri/7637411 to your computer and use it in GitHub Desktop.
Save zacksiri/7637411 to your computer and use it in GitHub Desktop.
upstart script for unicorn app server
#/etc/init/change_this_to_your_app_name.conf
description "App Name"
author "Admin Name <admin@app.com>"
start on virtual-filesystems
stop on runlevel [06]
env PATH=/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/bin:/usr/bin:/bin
env RAILS_ENV=staging # what environment
env RACK_ENV=staging # what environment
setuid deployer # linux user
setgid admin # group
chdir /opt/apps/app_name
pre-start script
exec /usr/local/rbenv/shims/unicorn -D -c /opt/apps/app_name/config/unicorn.rb --env staging
end script
post-stop script
exec kill `cat /tmp/unicorn.app_name.pid`
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment