pm2t v4.8.0
A process manager for Node.js applications.
Starting an application in production mode is as easy as:
$ pm2t start app.jsWorks on Linux (stable) & macOS (stable) & Windows (stable). All Node.js versions are supported starting Node.js 8.X.
Installing PM2t
With NPM:
$ npm install pm2t -gStart an application
You can start any application (Node.js, Python, Ruby, binaries in $PATH...) like that:
$ pm2t start app.jsYour app is now daemonized, monitored and kept alive forever.
Managing Applications
Once applications are started you can manage them easily:

To list all running applications:
$ pm2t listManaging apps is straightforward:
$ pm2t stop <app_name|namespace|id|'all'|json_conf>
$ pm2t restart <app_name|namespace|id|'all'|json_conf>
$ pm2t delete <app_name|namespace|id|'all'|json_conf>To have more details on a specific application:
$ pm2t describe <id|app_name>To monitor logs, custom metrics, application information:
$ pm2t monitCluster Mode: Node.js Load Balancing & Zero Downtime Reload
The Cluster mode is a special mode when starting a Node.js application, it starts multiple processes and load-balance HTTP/TCP/UDP queries between them. This increase overall performance (by a factor of x10 on 16 cores machines) and reliability (faster socket re-balancing in case of unhandled errors).
Starting a Node.js application in cluster mode that will leverage all CPUs available:
$ pm2t start api.js -i <processes><processes> can be 'max', -1 (all cpu minus 1) or a specified number of instances to start.
Zero Downtime Reload
Hot Reload allows to update an application without any downtime:
$ pm2t reload allMore informations about how PM2 make clustering easy
Container Support
With the drop-in replacement command for node, called pm2-runtime, run your Node.js application in a hardened production environment.
Using it is seamless:
RUN npm install pm2 -g
CMD [ "pm2-runtime", "npm", "--", "start" ]Read More about the dedicated integration
Terminal Based Monitoring

Monitor all processes launched straight from the command line:
$ pm2t monitLog Management
To consult logs just type the command:
$ pm2t logsStandard, Raw, JSON and formated output are available.
Examples:
$ pm2t logs APP-NAME # Display APP-NAME logs
$ pm2t logs --json # JSON output
$ pm2t logs --format # Formated output
$ pm2t flush # Flush all logs
$ pm2t reloadLogs # Reload all logsStartup Scripts Generation
PM2 can generates and configure a Startup Script to keep PM2 and your processes alive at every server restart.
Init Systems Supported: systemd, upstart, launchd, rc.d
# Generate Startup Script
$ pm2t startup
# Freeze your process list across server restart
$ pm2t save
# Remove Startup Script
$ pm2t unstartupMore about Startup Scripts Generation
PM2 Modules
PM2 embeds a simple and powerful module system. Installing a module is straightforward:
$ pm2t install <module_name>Here are some PM2 compatible modules (standalone Node.js applications managed by PM2):
pm2-logrotate automatically rotate logs and limit logs size pm2-server-monit monitor the current server with more than 20+ metrics and 8 actions
Updating PM2
# Install latest PM2 version
$ npm install pm2t@latest -g
# Save process list, exit old PM2 & restore all processes
$ pm2t updateContributors
License
2 years ago
2 years ago
2 years ago
2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago