You'll need an upstart script in your /etc/init/ directory
. Name it with your app's name, ending in .conf
, such as /etc/init/myapp.conf
. The basic upstart script looks something like this:
## /etc/init/myapp.conf
description "myapp.mydomain.com"
author "[email protected]"
# Automatically Run on Startup
start on started mountall
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 99 5
script
export HOME="/root"
export MONGO_URL='mongodb://myapp.compose.io:27017/meteor'
export ROOT_URL='http://myapp.mydomain.com'
export PORT='80'
exec /usr/local/bin/node /var/www/myapp/main.js >> /var/log/myapp.log 2>&1
end script