Skip to content

Instantly share code, notes, and snippets.

@dieface
Created August 16, 2016 23:43
Show Gist options
  • Save dieface/ebe10776e5fd388050641e8f6e452e80 to your computer and use it in GitHub Desktop.
Save dieface/ebe10776e5fd388050641e8f6e452e80 to your computer and use it in GitHub Desktop.
Upstart Conf for Node Server - edited in /etc/init/upstart-node-server.conf
description "RESTful Server"
author "dieface"
# When to start the service
# used to be: start on startup
# until we found some mounts weren't ready yet while booting
start on started mountall and runlevel [2345]
# When to stop the service
stop on shutdown
# Automatically restart process if crashed
respawn
respawn limit 10 5
# drop root proviliges and switch to mymetorapp user
setuid ubuntu
setgid ubuntu
chdir /home/ubuntu/apps/production-rest
# we don't use buil-in log because we use a script below
# console log
script
exec /home/ubuntu/.nvm/versions/node/v5.2.0/bin/npm run upstart >> /home/ubuntu/production-rest.log 2>&1
end script
@dieface
Copy link
Author

dieface commented Aug 16, 2016

Remember to specify node with path in script in package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment