Created
May 3, 2012 00:19
-
-
Save swoodtke/2582130 to your computer and use it in GitHub Desktop.
Upstart example for node.js application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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