{"_id":"15v-pm2","_rev":"1-0fd0d7d136e2c2665a2cc4cff9aa38d5","name":"15v-pm2","dist-tags":{"latest":"2.10.3"},"versions":{"2.10.3":{"name":"15v-pm2","preferGlobal":true,"version":"2.10.3","engines":{"node":">=0.12"},"directories":{"bin":"./bin","lib":"./lib","example":"./examples"},"author":{"name":"Jiang-Xuan","email":"645762213@qq.com"},"description":"Production process manager for Node.JS applications with a built-in load balancer.","main":"index.js","types":"types/index.d.ts","scripts":{"test":"NODE_ENV=test bash test/pm2_check_dependencies.sh && NODE_ENV=test bash test/pm2_programmatic_tests.sh && NODE_ENV=test bash test/pm2_behavior_tests.sh","bench-pmx":"pm2 delete all; pm2 install pm2-probe; node examples/pmx/app.js; pm2 ls"},"keywords":["cli","fault tolerant","sysadmin","tools","pm2","logs","log","json","express","hapi","kraken","reload","load balancer","lb","load-balancer","kubernetes","k8s","pm2-docker","runtime","source maps","graceful","microservice","programmatic","harmony","node-pm2","production","keymetrics","node.js monitoring","strong-pm","deploy","deployment","daemon","supervisor","supervisord","nodemon","pm2.io","ghost","ghost production","monitoring","keymetrics","process manager","forever","profiling","probes","apm","container","forever-monitor","keep process alive","process configuration","clustering","cluster cli","cluster","docker","cron","devops","dev ops"],"bin":{"pm2":"./bin/pm2","pm2-dev":"./bin/pm2-dev","pm2-docker":"./bin/pm2-docker","pm2-runtime":"./bin/pm2-runtime"},"dependencies":{"async":"^2.5","blessed":"^0.1.81","chalk":"^1.1","chokidar":"^2","cli-table-redemption":"^1.0.0","commander":"2.13.0","cron":"^1.3","debug":"^3.0","eventemitter2":"1.0.5","fclone":"1.0.11","mkdirp":"0.5.1","moment":"^2.19","needle":"^2.1.0","nssocket":"0.6.0","pidusage":"^1.2.0","pm2-axon":"3.1.0","pm2-axon-rpc":"0.5.0","pm2-deploy":"^0.3.9","pm2-multimeter":"^0.1.2","pmx":"^1.6","promptly":"2.2.0","semver":"^5.3","shelljs":"0.7.8","source-map-support":"^0.5","sprintf-js":"1.1.1","v8-compile-cache":"^1.1.0","vizion":"^0.2","yamljs":"^0.3.0","gkt":"https://tgz.pm2.io/gkt-1.0.0.tgz"},"devDependencies":{"mocha":"^3.5","should":"^11"},"optionalDependencies":{"gkt":"https://tgz.pm2.io/gkt-1.0.0.tgz"},"bugs":{"url":"https://github.com/Jiang-Xuan/pm2/issues"},"repository":{"type":"git","url":"git://github.com/Jiang-Xuan/pm2.git"},"license":"AGPL-3.0","gitHead":"ecdc3b9d85609c6c2b4f130a8c87f59c317b9e44","homepage":"https://github.com/Jiang-Xuan/pm2#readme","_id":"15v-pm2@2.10.3","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"jiang-xuan","email":"645762213@qq.com"},"dist":{"integrity":"sha512-tyzQf+JyHD/IS+qDWrkEbO4vg6VRT0ldanrRQ3P9WgVf9L0n4bDa9knnuHT3Uf9o+kggdDWYyxSq0bxpOPuXSA==","shasum":"7a088842e95e59530ff9ec59e3b1fad9ed2fd05e","tarball":"https://registry.npmjs.org/15v-pm2/-/15v-pm2-2.10.3.tgz","fileCount":108,"unpackedSize":764122,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1vFeCRA9TVsSAnZWagAA9DcQAKLyObbt7GUv5HACMEX+\n3ArOZSaikLyAFGdtS1AvgPEsQsw5E01H23D81SDW+KR4j2cDJ9VvRdUUS87X\nVZp99duOedTgA0rbopuQWQ8prOcsO9pHYtXNBJlfDnTZPl95yJdHPCukDHbM\nbBtsyp6es0W84rfDv6WpuRce0ydwpN6rvoxui+s1fuzJzPVGfjTBwCrLdWr3\nAMiLWE/MIUxdxT4esc8Nophq8D3Qq9HDliP2FkP2lGD4fFbMPI0lYAwoa2fb\ndqaUlSulje4nmYsyESGgHS6Af00WyEeWlEB0k4dhlq2k027R0Dpl8g1pUfna\n5Gr7wD2dJLdFjAJbHMD5Pt50vHLYzQVPvRJt2SC64mJ9A+gHhbmHGQeSWgNw\nyKafV5RxhyPlrxjRJPMjRGrLQIdikbmYeGIU39ajvNVllg89TC4UwbjD5Uxk\nyt0RUk9Cj/jP4eYO823EXlcmJKs9qzdE1bhziurl9J/V9SprUGG0CS5WbH6P\nxfQ5YJMrQWAgNZwkPBhiqyg7tmOCgA+CeMbJbD8p1P8kW5+2tvLbAl03cg9U\nrTFF1SvIygaBXGvDNmTIiYIdNBwSj2SYsyVltHcuTQYbk0naXHQ0PBMJRzXk\nqmFyXJMKo5Yjx+QPoDEjR94wF5KuQFO0rDSCDWMB1BupLPnDVM96YUHVzVOR\nyR4u\r\n=sn10\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICs9DnGZfKKu0k6hAqqEANhL/18J4u3hUfloIg3bk/sYAiEAjVdcjda1FTLC04lFVpaNHTb4VcSQcq6Th2U0VeZJPjE="}]},"maintainers":[{"name":"jiang-xuan","email":"645762213@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/15v-pm2_2.10.3_1524035933169_0.0950984968372115"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-18T07:18:53.169Z","2.10.3":"2018-04-18T07:18:53.320Z","modified":"2022-04-04T10:11:12.602Z"},"maintainers":[{"name":"jiang-xuan","email":"645762213@qq.com"}],"description":"Production process manager for Node.JS applications with a built-in load balancer.","homepage":"https://github.com/Jiang-Xuan/pm2#readme","keywords":["cli","fault tolerant","sysadmin","tools","pm2","logs","log","json","express","hapi","kraken","reload","load balancer","lb","load-balancer","kubernetes","k8s","pm2-docker","runtime","source maps","graceful","microservice","programmatic","harmony","node-pm2","production","keymetrics","node.js monitoring","strong-pm","deploy","deployment","daemon","supervisor","supervisord","nodemon","pm2.io","ghost","ghost production","monitoring","keymetrics","process manager","forever","profiling","probes","apm","container","forever-monitor","keep process alive","process configuration","clustering","cluster cli","cluster","docker","cron","devops","dev ops"],"repository":{"type":"git","url":"git://github.com/Jiang-Xuan/pm2.git"},"author":{"name":"Jiang-Xuan","email":"645762213@qq.com"},"bugs":{"url":"https://github.com/Jiang-Xuan/pm2/issues"},"license":"AGPL-3.0","readme":"<div align=\"center\">\n  <br/>\n  <a href=\"http://pm2.keymetrics.io\" title=\"PM2 Keymetrics link\">\n    <img width=710px src=\"https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-v4.png\" alt=\"pm2 logo\">\n  </a>\n  <br/>\n<br/>\n<b>P</b>(rocess) <b>M</b>(anager) <b>2</b><br/>\n  <i>Runtime Edition</i>\n<br/><br/>\n\n<a href=\"https://badge.fury.io/js/pm2\">\n   <img src=\"https://badge.fury.io/js/pm2.svg\" alt=\"npm version\" height=\"18\">\n</a>\n\n<a href=\"https://www.npmjs.com/package/pm2\" title=\"PM2 on NPM\">\n  <img alt=\"NPM Downloads\" src=\"https://img.shields.io/npm/dm/pm2.svg?style=flat-square\"/>\n</a>\n\n<a href=\"https://travis-ci.org/Unitech/pm2\" title=\"PM2 Tests\">\n  <img src=\"https://travis-ci.org/Unitech/pm2.svg?branch=master\" alt=\"Build Status\"/>\n</a>\n\n\n<br/>\n<br/>\n<br/>\n</div>\n\nPM2 is a General Purpose Process Manager and a Production Runtime for Node.js apps with a built-in Load Balancer.\n\nKey features:\n- Simple and efficient process management (start/stop/restart/delete/show/monit)\n- Keep your application ALWAYS ONLINE with auto restarts and init system script generation\n- Clusterize Node.js Applications without code change to increase performance and reliability\n- Hot Reload Node.js Applications without extra configuration\n\nStarting an application in production mode is as easy as:\n\n```bash\n$ pm2 start app.js\n```\n\nPM2 is constantly assailed by [more than 1800 tests](https://travis-ci.org/Unitech/pm2).\n\nOfficial website: [http://pm2.keymetrics.io/](http://pm2.keymetrics.io/)\n\nWorks on Linux (stable) & macOS (stable) & Windows (stable).\nAll Node.js versions are supported starting Node.js 0.12.\n\n[![NPM](https://nodei.co/npm/pm2.png?downloads=true&downloadRank=true)](https://nodei.co/npm/pm2/)\n\n### Installing PM2\n\n```bash\n$ npm install pm2 -g\n```\n\n*npm is a builtin CLI when you install Node.js - [Installing Node.js with NVM](https://keymetrics.io/2015/02/03/installing-node-js-and-io-js-with-nvm/)*\n\n### Start an application\n\nYou can start any application (Node.js, Python, Ruby, binaries in $PATH...) like that:\n\n```bash\n$ pm2 start app.js\n```\n\nYour app is now daemonized, monitored and kept alive forever.\n\n[More about Process Management](http://pm2.keymetrics.io/docs/usage/process-management/)\n\n### Managing a Process\n\nOnce applications are started you can manage them easily:\n\n![Process listing](https://github.com/unitech/pm2/raw/master/pres/pm2-list.png)\n\nTo list all running processes:\n\n```bash\n$ pm2 list\n```\n\nManaging processes is straightforward:\n\n```bash\n$ pm2 stop     <app_name|id|'all'|json_conf>\n$ pm2 restart  <app_name|id|'all'|json_conf>\n$ pm2 delete   <app_name|id|'all'|json_conf>\n```\n\nTo have more details on a specific process:\n\n```bash\n$ pm2 describe <id|app_name>\n```\n\nTo monitor logs, custom metrics, process information:\n\n```bash\n$ pm2 monit\n```\n\n[More about Process Management](http://pm2.keymetrics.io/docs/usage/process-management/)\n\n### Cluster Mode: Node.js Load Balancing & Hot Reload\n\nThe 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).\n\nStarting a Node.js application in cluster mode that will leverage all CPUs available:\n\n```bash\n$ pm2 start api.js -i <processes>\n```\n\n`<processes>` can be `'max'`, `-1` (all cpu minus 1) or a specified number of instances to start.\n\n**Hot Reload**\n\nHot Reload allows to update an application without any downtime:\n\n```bash\n$ pm2 reload all\n```\n\nSeamlessly supported by all major Node.js frameworks and any Node.js applications without any code change:\n\n![Framework supported](https://raw.githubusercontent.com/Unitech/PM2/development/pres/cluster-support.png)\n\n[More informations about how PM2 make clustering easy](https://keymetrics.io/2015/03/26/pm2-clustering-made-easy/)\n\n### Container Support\n\nWith the drop-in replacement command for `node`, called `pm2-runtime`, run your Node.js application in a proper production environment.\nWe also offer an [officialy supported Docker image](https://hub.docker.com/r/keymetrics/pm2/).\n\nUsing it is seamless:\n\n```\nFROM keymetrics/pm2:latest-alpine\n[...]\nCMD [ \"pm2-runtime\", \"npm\", \"--\", \"start\" ]\n```\n\n[Read More about the dedicated integration](http://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/)\n\n### Terminal Based Monitoring\n\n![Monit](https://github.com/Unitech/pm2/raw/master/pres/pm2-monit.png)\n\nMonitor all processes launched straight from the command line:\n\n```bash\n$ pm2 monit\n```\n\n### Monitor PM2 and Applications with our SaaS\n\nOnce you deploy your application in production, you can monitor, debug and profile it externally with our [SaaS Monitoring](https://keymetrics.io).\n\nTo start monitoring applications from the terminal:\n\n```bash\n$ pm2 register\n```\n\n[More about PM2 Monitoring](http://docs.keymetrics.io/)\n\n### Expose Custom Metrics\n\nTo get more insights on how your application behave, plug custom metrics inside your code and monitor them with the `pm2 monit` command:\n\nIn your project install [pmx](https://github.com/keymetrics/pmx):\n\n```bash\n$ npm install pmx --save\n```\n\nThen plug a custom metric:\n\n```javascript\nvar Probe = require('pmx').probe();\n\nvar counter = 1;\n\nvar metric = Probe.metric({\n  name    : 'Counter',\n  value   : function() {\n    return counter;\n  }\n});\n\nsetInterval(function() {\n  counter++;\n}, 1000);\n```\n\nThen to see the metric type from in the terminal:\n\n```bash\n$ pm2 monitor\n```\n\nMetric, Counter, Histogram and Meters are [available](http://pm2.keymetrics.io/docs/usage/process-metrics/)\n\n### Log facilities\n\n![Monit](https://github.com/unitech/pm2/raw/master/pres/pm2-logs.png)\n\nDisplaying logs of a specified process or all processes, in real time is easy:\n\n```bash\n$ pm2 logs ['all'|app_name|app_id] [--json] [--format] [--raw]\n```\n\nStandard, Raw, JSON and formated output are available.\n\nExamples:\n\n```bash\n$ pm2 logs APP-NAME       # Display APP-NAME logs\n$ pm2 logs --json         # JSON output\n$ pm2 logs --format       # Formated output\n\n$ pm2 flush               # Flush all logs\n$ pm2 reloadLogs          # Reload all logs\n```\n\n[More about log management](http://pm2.keymetrics.io/docs/usage/log-management/)\n\n### Startup script generation\n\nPM2 can generates and configure a startup script to keep PM2 and your processes alive at every server restart.\n\nSupports init systems like: **systemd** (Ubuntu 16, CentOS, Arch), **upstart** (Ubuntu 14/12), **launchd** (MacOSx, Darwin), **rc.d** (FreeBSD).\n\n```bash\n# Auto detect init system + generate and setup PM2 boot at server startup\n$ pm2 startup\n\n# Manually specify the startup system\n# Can be: systemd, upstart, launchd, rcd\n$ pm2 startup [platform]\n\n# Disable and remove PM2 boot at server startup\n$ pm2 unstartup\n```\n\nTo save/freeze a process list on reboot:\n\n```bash\n$ pm2 save\n```\n\n[More about startup scripts](http://pm2.keymetrics.io/docs/usage/startup/)\n\n### Commands Cheatsheet\n\n```bash\n# General\n$ npm install pm2 -g            # Install PM2\n$ pm2 start app.js              # Start, Daemonize and auto-restart application (Node)\n$ pm2 start app.py              # Start, Daemonize and auto-restart application (Python)\n$ pm2 start npm -- start        # Start, Daemonize and auto-restart Node application\n\n# Cluster Mode (Node.js only)\n$ pm2 start app.js -i 4         # Start 4 instances of application in cluster mode\n                                # it will load balance network queries to each app\n$ pm2 reload all                # Zero Second Downtime Reload\n$ pm2 scale [app-name] 10       # Scale Cluster app to 10 process\n\n# Process Monitoring\n$ pm2 list                      # List all processes started with PM2\n$ pm2 list --sort=<field>       # Sort all processes started with PM2\n$ pm2 monit                     # Display memory and cpu usage of each app\n$ pm2 show [app-name]           # Show all information about application\n\n# Log management\n$ pm2 logs                      # Display logs of all apps\n$ pm2 logs [app-name]           # Display logs for a specific app\n$ pm2 logs --json               # Logs in JSON format\n$ pm2 flush\n$ pm2 reloadLogs\n\n# Process State Management\n$ pm2 start app.js --name=\"api\" # Start application and name it \"api\"\n$ pm2 start app.js -- -a 34     # Start app and pass option \"-a 34\" as argument\n$ pm2 start app.js --watch      # Restart application on file change\n$ pm2 start script.sh           # Start bash script\n$ pm2 start app.json            # Start all applications declared in app.json\n$ pm2 reset [app-name]          # Reset all counters\n$ pm2 stop all                  # Stop all apps\n$ pm2 stop 0                    # Stop process with id 0\n$ pm2 restart all               # Restart all apps\n$ pm2 gracefulReload all        # Gracefully reload all apps in cluster mode\n$ pm2 delete all                # Kill and delete all apps\n$ pm2 delete 0                  # Delete app with id 0\n\n# Startup/Boot management\n$ pm2 startup                   # Detect init system, generate and configure pm2 boot on startup\n$ pm2 save                      # Save current process list\n$ pm2 resurrect                 # Restore previously saved processes\n$ pm2 unstartup                 # Disable and remove startup system\n\n$ pm2 update                    # Save processes, kill PM2 and restore processes\n$ pm2 init                      # Generate a sample js configuration file\n\n# Deployment\n$ pm2 deploy app.json prod setup    # Setup \"prod\" remote server\n$ pm2 deploy app.json prod          # Update \"prod\" remote server\n$ pm2 deploy app.json prod revert 2 # Revert \"prod\" remote server by 2\n\n# Module system\n$ pm2 module:generate [name]    # Generate sample module with name [name]\n$ pm2 install pm2-logrotate     # Install module (here a log rotation system)\n$ pm2 uninstall pm2-logrotate   # Uninstall module\n$ pm2 publish                   # Increment version, git push and npm publish\n```\n\nAlso check out the [example folder](https://github.com/Unitech/pm2/tree/master/examples) to discover all features.\n\n## Updating PM2\n\n```bash\n# Install latest PM2 version\n$ npm install pm2@latest -g\n# Save process list, exit old PM2 & restore all processes\n$ pm2 update\n```\n\n*PM2 updates are seamless*\n\n## Module system\n\nPM2 embeds a simple and powerful module system. Installing a module is straightforward:\n\n```bash\n$ pm2 install <module_name>\n```\n\nHere are some PM2 compatible modules (standalone Node.js applications managed by PM2):\n\n[**pm2-logrotate**](https://github.com/pm2-hive/pm2-logrotate) auto rotate logs of PM2 and applications managed<br/>\n[**pm2-webshell**](https://github.com/pm2-hive/pm2-webshell) expose a fully capable terminal in browsers<br/>\n[**pm2-server-monit**](https://github.com/pm2-hive/pm2-server-monit) monitor your server health<br/>\n\n[Writing your own module](http://pm2.keymetrics.io/docs/advanced/pm2-module-system/)\n\n## Keymetrics monitoring\n\n[![Keymetrics Dashboard](https://keymetrics.io/assets/images/application-demo.png)](https://app.keymetrics.io/#/register)\n\nIf you manage your NodeJS app with PM2, Keymetrics makes it easy to monitor and manage apps across servers.\nFeel free to try it:\n\n[Discover the monitoring dashboard for PM2](https://app.keymetrics.io/#/register)\n\nThanks in advance and we hope that you like PM2!\n\n## More about PM2\n\n- [Application Declaration via JS files](http://pm2.keymetrics.io/docs/usage/application-declaration/)\n- [Watch & Restart](http://pm2.keymetrics.io/docs/usage/watch-and-restart/)\n- [PM2 API](http://pm2.keymetrics.io/docs/usage/pm2-api/)\n- [Deployment workflow](http://pm2.keymetrics.io/docs/usage/deployment/)\n- [PM2 on Heroku/Azure/App Engine](http://pm2.keymetrics.io/docs/usage/use-pm2-with-cloud-providers/)\n- [PM2 auto completion](http://pm2.keymetrics.io/docs/usage/auto-completion/)\n- [Using PM2 in ElasticBeanStalk](http://pm2.keymetrics.io/docs/tutorials/use-pm2-with-aws-elastic-beanstalk/)\n- [PM2 Tutorial Series](https://futurestud.io/tutorials/pm2-utility-overview-installation)\n\n## CHANGELOG\n\n[CHANGELOG](https://github.com/Unitech/PM2/blob/master/CHANGELOG.md)\n\n## Contributors\n\n[Contributors](http://pm2.keymetrics.io/hall-of-fame/)\n\n## License\n\nPM2 is made available under the terms of the GNU Affero General Public License 3.0 (AGPL 3.0).\nWe can deliver other licenses, for more informations [contact sales](mailto:sales@keymetrics.io).\n\n[![GA](https://ga-beacon.appspot.com/UA-51734350-7/pm2/readme?pixel&useReferer)](https://github.com/igrigorik/ga-beacon)\n","readmeFilename":"README.md"}