Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Unitech/pm2
Node.js Production Process Manager with a built-in Load Balancer.
https://github.com/Unitech/pm2
command-line command-line-tool deploy load-balancer monitoring node nodejs pm2 process-manager production
Last synced: 2 months ago
JSON representation
Node.js Production Process Manager with a built-in Load Balancer.
- Host: GitHub
- URL: https://github.com/Unitech/pm2
- Owner: Unitech
- License: other
- Created: 2013-05-21T03:25:25.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-05-23T09:09:55.000Z (5 months ago)
- Last Synced: 2024-05-23T09:45:44.445Z (5 months ago)
- Topics: command-line, command-line-tool, deploy, load-balancer, monitoring, node, nodejs, pm2, process-manager, production
- Language: JavaScript
- Homepage: https://pm2.keymetrics.io/docs/usage/quick-start/
- Size: 12.6 MB
- Stars: 40,825
- Watchers: 655
- Forks: 2,580
- Open Issues: 929
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome - pm2 - Node.js Production Process Manager with a built-in Load Balancer. (JavaScript)
- awesome-nodejs-cn - PM2 - 高级进程管理工具 (包 / 进程管理)
- awesome-nodejs - PM2 - Advanced Process Manager. ![](https://img.shields.io/github/stars/Unitech/pm2.svg?style=social&label=Star) (Repository / Process management)
- awesome-cli-apps - pm2 - Production Process Manager for Node.js. (Development / Devops)
- awesome-nodejs-cn - PM2 - **star:40962** 先进的流程管理 ![star > 2000][Awesome] (包 / 流程管理)
- awesome-nodejs - PM2 - 高级进程管理工具。 ![](https://img.shields.io/github/stars/Unitech/pm2.svg?style=social&label=Star) (GIT 仓库 / 进程管理)
- awesome-github-repos - Unitech/pm2 - Node.js Production Process Manager with a built-in Load Balancer. (JavaScript)
- my-awesome - pm2 - Production process manager for Node.js apps with a built-in load balancer (JavaScript)
- awesome-repositories - Unitech/pm2 - Node.js Production Process Manager with a built-in Load Balancer. (JavaScript)
- awesome-github-star - pm2 - in Load Balancer. | Unitech | 39703 | (JavaScript)
- awesome - pm2 - in Load Balancer (Node.js)
- Awesome-List - PM2 - Node.js Production Process Manager with a built-in Load Balancer. (📟 Terminal)
- awesome-nodejs - PM2 - Advanced Process Manager. (Packages / Process management)
- fucking-awesome-cli-apps - pm2 - Production Process Manager for Node.js. (Development / Devops)
- awesome-npm - pm2 - 支持热启动、负载、集群、监控、重启等功能 (1. 后端开发 / 1.6 项目管理)
- awesome - Unitech / pm2
- awesome-quick-dev - pm2 - square) (Web开发环境与工具 / Web管理后台通用)
- awesome-nodejs - pm2 - Node.js Production Process Manager with a built-in Load Balancer. - ★ 27006 (Process management)
- awesome-hacking-lists - Unitech/pm2 - Node.js Production Process Manager with a built-in Load Balancer. (JavaScript)
- awesome-node - PM2 - Advanced Process Manager. (Packages / Process management)
- awesome-nodejs-cn - PM2 - 高级进程管理工具. (目录 / 进程管理)
- awesome-nodejs - pm2 - 内置负载均衡的 node 进程管理器 (Uncategorized / Uncategorized)
- awesome-star-libs - Unitech / pm2
- awesome-tools - **pm2** - node 进程管理工具 (脚手架以及工具包)
- awesome-starred - Unitech/pm2 - Node.js Production Process Manager with a built-in Load Balancer. (nodejs)
- StarryDivineSky - Unitech/pm2
README
PM2 is a production process manager for Node.js 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.
Starting an application in production mode is as easy as:
```bash
$ pm2 start app.js
```PM2 is constantly assailed by [more than 1800 tests](https://github.com/Unitech/pm2/actions/workflows/node.js.yml).
Official website: [https://pm2.keymetrics.io/](https://pm2.keymetrics.io/)
Works on Linux (stable) & macOS (stable) & Windows (stable). All Node.js versions are supported starting Node.js 12.X.
### Installing PM2
With NPM:
```bash
$ npm install pm2 -g
```You can install Node.js easily with [NVM](https://github.com/nvm-sh/nvm#installing-and-updating) or [FNM](https://github.com/Schniz/fnm).
### Start an application
You can start any application (Node.js, Python, Ruby, binaries in $PATH...) like that:
```bash
$ pm2 start app.js
```Your app is now daemonized, monitored and kept alive forever.
### Managing Applications
Once applications are started you can manage them easily:
![Process listing](https://github.com/Unitech/pm2/raw/master/pres/pm2-ls-v2.png)
To list all running applications:
```bash
$ pm2 list
```Managing apps is straightforward:
```bash
$ pm2 stop
$ pm2 restart
$ pm2 delete
```To have more details on a specific application:
```bash
$ pm2 describe
```To monitor logs, custom metrics, application information:
```bash
$ pm2 monit
```[More about Process Management](https://pm2.keymetrics.io/docs/usage/process-management/)
### Cluster 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).
![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/cluster.png)
Starting a Node.js application in cluster mode that will leverage all CPUs available:
```bash
$ pm2 start api.js -i
````` 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:
```bash
$ pm2 reload all
```[More informations about how PM2 make clustering easy](https://pm2.keymetrics.io/docs/usage/cluster-mode/)
### 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](https://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/)
### Host monitoring speedbar
PM2 allows to monitor your host/server vitals with a monitoring speedbar.
To enable host monitoring:
```bash
$ pm2 set pm2:sysmonit true
$ pm2 update
```![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/master/pres/vitals.png)
### Terminal Based Monitoring
![Monit](https://github.com/Unitech/pm2/raw/master/pres/pm2-monit.png)
Monitor all processes launched straight from the command line:
```bash
$ pm2 monit
```### Log Management
To consult logs just type the command:
```bash
$ pm2 logs
```Standard, Raw, JSON and formated output are available.
Examples:
```bash
$ pm2 logs APP-NAME # Display APP-NAME logs
$ pm2 logs --json # JSON output
$ pm2 logs --format # Formated output$ pm2 flush # Flush all logs
$ pm2 reloadLogs # Reload all logs
```To enable log rotation install the following module
```bash
$ pm2 install pm2-logrotate
```[More about log management](https://pm2.keymetrics.io/docs/usage/log-management/)
### Startup Scripts Generation
PM2 can generate and configure a Startup Script to keep PM2 and your processes alive at every server restart.
Init Systems Supported: **systemd**, **upstart**, **launchd**, **rc.d**
```bash
# Generate Startup Script
$ pm2 startup# Freeze your process list across server restart
$ pm2 save# Remove Startup Script
$ pm2 unstartup
```[More about Startup Scripts Generation](https://pm2.keymetrics.io/docs/usage/startup/)
### Updating PM2
```bash
# Install latest PM2 version
$ npm install pm2@latest -g
# Save process list, exit old PM2 & restore all processes
$ pm2 update
```*PM2 updates are seamless*
## PM2+ Monitoring
If you manage your apps with PM2, PM2+ makes it easy to monitor and manage apps across servers.
![https://app.pm2.io/](https://pm2.io/img/app-overview.png)
Feel free to try it:
[Discover the monitoring dashboard for PM2](https://app.pm2.io/)
Thanks in advance and we hope that you like PM2!
## CHANGELOG
[CHANGELOG](https://github.com/Unitech/PM2/blob/master/CHANGELOG.md)
## Contributors
[Contributors](http://pm2.keymetrics.io/hall-of-fame/)
## License
PM2 is made available under the terms of the GNU Affero General Public License 3.0 (AGPL 3.0).
For other licenses [contact us](mailto:[email protected]).