This example assumes your running a recent Ubuntu with upstart installed and you have install n
from npm
.
To see an example use of this ina a wider context, look at this gist for deploying node.js + nginx
Adapt as required.
- Put the
node.conf
in/etc/init/
- Create a folder for individual site configs to live in
/etc/node
- Put the
node-test.conf
inside/etc/node
- Create the folder for the logs
/var/logs/node
- Put some the test code from
index.js
inside a folder at/var/www/node-test
- Start the app by running
sudo start node NAME=node-test
- Stop/restart/status the app by running
sudo [restart|stop|status] node NAME=node-test
- Profit
##cons
- It requires making a new config every time you need a new site
- It's config is pretty verbose
- There could do to be more awesome-sauce in the upstart script.
- port configurations for multiple sites is pain unless done automatically by some tool externally
##pros
- doesn't use forever
- is pretty flexible and un-opinionated
- fits in with the rest of system process monitoring shizzle