Skip to content

Running in production

Luke Duncalfe edited this page May 8, 2018 · 6 revisions

Create a user to run the processes

adduser nanostream

Daemonizing the executables

You can daemonize the executables however you like on your server. One very handy and node-friendly method is to use pm2 that also lets you monitor, and restarts them if they crash.

npm install pm2@latest -g

Log in as the non-root user:

sudo su - nanostream

Then tell pm2 to manage the two executables:

pm2 start nano-stream-x
pm2 start nano-stream-ws

Any arguments can be passed like this:

pm2 start nano-stream-ws -- port=8081

Check that the executables are running correctly by tailing their logs:

pm2 logs
Clone this wiki locally