Writing an upstart config file for Unicorn

ruby-on-railsubuntu-10.04unicornupstart

I've had a good hunt and can't find a good example of an upstart script for Unicorn.

From what I've read however I think that upstart and unicorn might step on each others toes if I just try to set up a basic upstart config file given that unicorn manages its own workers etc…

Any tips or shortcuts before I dig in myself?

Best Answer

You may use this config, but my personal choice is to use BluePill instead. It will give you more flexibility

description "Starts unicorn as the user 'rails'"
start on filesystem
chdir /apps/rails/sample_app
exec sudo -u deployer -i 'rvm ree; unicorn_rails -c /apps/rails/sample_app/config/unicorn.rb -E production' 
respawn