PM2 is a production process manager for node applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
As we will see belowm Edge Microgateway, been a node app can benefit greatly from using this tool,
Find below the steps required to use PM2 with edgemicro:
$ pm2 start edgemicro -- start -o <org> -e <env> -k <key> -s <secret>
$ pm2 logs edgemicro<br>
$ pm2 list
$ pm2 startup
It automaticallly detects the available init system, but you can specify it yourself to (eg: pm2 startup systemd). You can also use option -u to specify the user and --hp to specify the home directory.
$ pm2 save
$ pm2 monit
$ pm2 link <secret-key> <public-key>
Give it a try and let me know how it goes.
Very nice write up, thanks Miren.
It is also worth noting that Edge Cloud developers that want to debug NodeJS proxies locally can also use PM2 and follow similar steps... although nodemon may be simpler for this purpose.