Skip to content

Instantly share code, notes, and snippets.

@errordeveloper
Last active February 9, 2022 09:21
Show Gist options
  • Select an option

  • Save errordeveloper/4329034 to your computer and use it in GitHub Desktop.

Select an option

Save errordeveloper/4329034 to your computer and use it in GitHub Desktop.
Upstart config for a Rails app using Unicorn HTTP server
description "My App"
author "Ilya Dmitrichenko"
start on virtual-filesystems
stop on runlevel [06]
env PATH=/etc/rbenv/shims:/usr/local/rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
env RAILS_ENV=production
setuid rails
setgid rails
chdir /opt/my_app/current
pre-start exec bundle exec unicorn_rails -D -c /opt/my_app/shared/config/unicorn.rb --env production
post-stop exec kill `cat /opt/my_app/shared/pids/unicorn.pid`
@dadarek
Copy link

dadarek commented Jul 14, 2014

Why did you leave out the respawn stanza? Does this restart unicorn when it crashes for any reason?

@hudsantos
Copy link

Very good. This worked fine for me. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment