Skip to content

Instantly share code, notes, and snippets.

@nnarhinen
Created November 8, 2013 08:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nnarhinen/7367732 to your computer and use it in GitHub Desktop.
Save nnarhinen/7367732 to your computer and use it in GitHub Desktop.
Upstart script for running node as non-root service
description "Foo application Node.js service"
author "Niklas Närhinen"
setuid foo
start on (local-filesystems and net-device-up)
stop on shutdown
respawn
respawn limit 5 60
script
export NODE_ENV="production"
export PORT=3000
export PATH="$PATH:/home/foo/.nvm/v0.10.16/bin"
export COUCHDB_USER=""
export COUCHDB_PASS=""
export COUCHDB_HOST=""
export REDIS_PASS=""
export REDIS_HOST=""
export REDIS_PORT=""
$(which node) /home/foo/foo/migrate.js &&
$(which node) /home/foo/foo/app.js >> /var/log/foo/foo.com.log 2>&1
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment