Pool Controller with nodejs-poolController via MQTT

Regarding running the nodejs-PC process and backgrounding, I ended up using pm2 as suggested in gitter: https://gitter.im/nodejs-poolController/Lobby?at=5cda2be3bdc3b64fcf4158b7

Basically:

How to get PM2 installed and running poolController on RPi or Linux

  1. Install PM2 with npm sudo npm install -g pm2
  2. Quit nodejs-poolController if its running.
  3. Launch nodejs-poolController with PM2 pm2 start /home/pi/nodejs-poolController/src/index.js —name=“poolController” —watch
  4. Adding the —watch in the line above will auto restart the app if you make a change such as an update with git pull. If you don’t want that action to occur simply don’t include the watch flag.
  5. Run pm2 ls to see your app(s) running with pm2. It will show uptime of the app and reset counter.
  6. Type pm2 startup If you want pm2 to auto-start at boot (recommended). This command will give you a command based on your platform to run so pm2 starts on its own. pm2 unstartup will reverse this behavior.
  7. Finally run pm2 save to save what apps you have running so if your machine reboots or crashes, it when PM2 starts back up again it will launch your saved apps again.

pm2 logs is useful for looking at the console logs of your app(s) for troubleshooting.

I’m not using --watch and have a cron job doing pm2 restart all overnight for stability.

1 Like