Skip to content

Instantly share code, notes, and snippets.

@swoodtke
Created May 3, 2012 00:19
Show Gist options
  • Save swoodtke/2582130 to your computer and use it in GitHub Desktop.
Save swoodtke/2582130 to your computer and use it in GitHub Desktop.
Upstart example for node.js application
#!upstart
description "Node.js Application Server"
author "Shawn Woodtke"
# Add dependencies on mongodb (or other database) if required
# start on started mongodb
# stop on stopping mongodb
respawn
env APP="application"
env COMPANY="company"
# unfortunately, cannot use $APP and $COMPANY variables here
chdir /opt/application/company
limit nofile 65536 65536
script
env HOME="/opt/$COMPANY/$APP"
echo $$ > /var/run/$COMPANY.$APP.pid
exec sudo -u $COMPANY NODE_ENV=production $HOME/node_modules/.bin/coffee $HOME/app.coffee >> /var/log/$COMPANY.$APP.stdout.log 2>&1
end script
pre-start script
echo "** `date -u +%b\ %d\ %T` -- ($APP) Starting **" >> /var/log/$COMPANY.$APP.stdout.log
end script
pre-stop script
echo "** `date -u +%b\ %d\ %T` -- ($APP) Stopping **" >> /var/log/$COMPANY.$APP.stdout.log
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment