Skip to content

Instantly share code, notes, and snippets.

@afuggini
Created April 14, 2014 01:38
Show Gist options
  • Save afuggini/10610010 to your computer and use it in GitHub Desktop.
Save afuggini/10610010 to your computer and use it in GitHub Desktop.
#!upstart
description "Snapter Upstart"
author "Ariel Fuggini"
env APP_NAME='snapter'
env PORT='3000'
#env METEOR_SETTINGS="$(cat /vagrant/snapter/config/production/settings.json)"
env ROOT_URL="http://snapter.co"
env NODE_BIN='/usr/local/bin/node'
env MONGO_URL="mongodb://localhost:27017/meteor"
env SCRIPT_FILE="/home/snapter/bundle/main.js"
env RUN_AS="snapter"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
script
export LOG_FILE="/home/snapter/tracer.upstart.log"
touch $LOG_FILE
chown $RUN_AS:$RUN_AS $LOG_FILE
chdir "/home/snapter/"
exec sudo -u $RUN_AS sh -c "PORT=$PORT MONGO_URL=$MONGO_URL ROOT_URL='$ROOT_URL' $NODE_BIN $SCRIPT_FILE >> $LOG_FILE 2>&1"
end script
respawn
respawn limit 20 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment