Process managers for NodeJS apps - ChuanyuWang/test GitHub Wiki

Copy from http://www.expressjs.com.cn/advanced/pm.html

When running Express apps for production, it is helpful to use a process manager to:

  • Restart the app automatically if it crashes.
  • Gain insights into runtime performance and resource consumption.
  • Modify settings dynamically to improve performance.
  • Control clustering.

A process manager is somewhat like an application server: it’s a “container” for applications that facilitates deployment, provides high availability, and enables you to manage the application at runtime.

The most popular process managers for Express and other Node applications are:

Using any of these three tools can be very helpful. Here’s a brief look at each of these tools. For a detailed comparison, see http://strong-pm.io/compare/.

Useful command of PM2

pm2 logs
pm2 <list|status|ls>
pm2 show <id|name>
pm2 -v

How to Update PM2

Install the latest PM2 version or specific version by root user:

npm install pm2 -g

update the in-memory PM2 daemon via command:

pm2 update

How to Start app

#pm2 hot reload with zero downtime - new way
pm2 startOrReload process.pm2.json --env production
pm2 show eshop
⚠️ **GitHub.com Fallback** ⚠️