We have a setup where a nodejs program is being started by the pm2 process manager. And the pm2 process itself is started & being monitored by supervisor process.
My conf looks like below:
[program:node-service]
process_name=%(program_name)s
command=pm2 start /home/deploy/nodeJS/app.js
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/deploy/logs/appjs.log
Expected Outcome:
Supervisor starts PM2 Deamon. PM2 starts node process.
Command: ps aux | grep pm2
root 664 0.8 0.2 1436832 70992 ? Ssl 13:57 0:02 PM2 v5.2.0: God Daemon (/etc/.pm2)
Command: ps aux | grep node
root 20893 0.5 0.2 1309368 70692 ? Ssl 14:02 0:01 node /home/deploy/nodeJS/app.js
Actual Outcome:
Supervisor starts PM2 Daemon. PM2 starts node process. Supervisor or pm2 is trying to start node process again.
Command: ps aux | grep pm2
root 664 0.8 0.2 1436832 70992 ? Ssl 13:57 0:02 PM2 v5.2.0: God Daemon (/etc/.pm2)
root 21259 61.0 0.2 1164964 74040 ? Rl 14:02 0:00 node /usr/bin/pm2 start /home/deploy/nodeJS/app.js
Command: ps aux | grep node
root 20893 0.5 0.2 1309368 70692 ? Ssl 14:02 0:01 node /home/deploy/nodeJS/app.js
I couldn't figure out why is it trying to create the other process "node /usr/bin/pm2 start /home/deploy/nodeJS/app.js" is started.