sudo apt-get install supervisor
Add into file /etc/supervisor/supervisor.conf these lines:
[inet_http_server]
port = *:9001
username = admin
password = 123
Create new job file:
sudo touch /etc/supervisor/conf.d/worker.conf
Edit file like this:
[program:worker]
environment = NODE_ENV="production"
command=/usr/bin/node /home/user/app/index.js
autostart=true
autorestart=true
stderr_logfile=/var/log/worker.err.log
stdout_logfile=/var/log/worker.out.log
sudo service supervisor restart
##Access Supervisor GUI http://localhost:9001