Socket
Socket
Sign inDemoInstall

pm2

Package Overview
Dependencies
14
Maintainers
1
Versions
276
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pm2

The next generation process manager for Node.js with native clusterization


Version published
Maintainers
1
Created

Package description

What is pm2?

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.

What are pm2's main functionalities?

Process Management

Start an application with PM2 and keep it running in the background.

pm2 start app.js

Load Balancing

Enable load balancing by starting multiple instances of the application across all CPUs.

pm2 start app.js -i max

Monitoring

Monitor all processes launched with PM2 using a terminal-based dashboard.

pm2 monit

Logging

Display logs of all processes in real-time, or target specific processes.

pm2 logs

Startup Script

Generate a startup script to resurrect PM2 and all processes on server reboot.

pm2 startup

Update Processes

Reload all processes in the cluster without downtime.

pm2 reload all

Other packages similar to pm2

Readme

Source

Monit

Build Status Build Status NPM version

The next generation daemon process manager for Node.js with native clusterization.

Installation

npm install -g pm2

Usage/Features

$ npm install pm2 -g     // Install pm2 command line globally
$ pm2 start app.js -i 4  // Daemonize pm2 and Start 4 clustered instances of app.js

$ pm2 list               // Display all processes status
$ pm2 monit              // Monitor all processes
$ pm2 logs               // Display all processes logs in streaming
$ pm2 dump               // Dump the states of all processes
$ pm2 stop               // Stop all processes
$ pm2 resurect           // Put online previously dumped processes
$ pm2 restart            // Restart all proccesses
$ pm2 stop
$ pm2 generate app       // Generate a JSON process configuration

pm2 list

List infos about all processes managed by pm2. It shows also how many times a process has been restarted because of an unhandled exception.

Monit

pm2 monit

Monitor CPU and memory usage of every node process (and also clustered processes) managed by pm2.

Monit

pm2 logs

Display logs in streaming of all processes, without having to do a tail -f or something else.

Monit

pm2 dump/resurect

You can dump all currently running processes, including their environment and execution path. After restarting or stopping PM2 you can resurect them.

Monit

Features

  • Clusterize your Node networked script without adding one line of code
  • Fully tested
  • Monitor process/cluster processes health (status, memory, cpu usage, restarted time) via CLI (htop like)
  • Monitor server health (processes, cpu core...) via JSON api (pm2 web)
  • Launch multiple applications via JSON
  • Forever keep alive processes
  • Log streaming in realtime (pm2 logs)
  • Log uncaught exceptions in error logs
  • Track restarted time
  • Auto stop processes who exit too fast
  • Dump current processes and resurect (upstart)

Multi process JSON declaration

processes.json :

[{
    "name" : "echo",
    "script" : "./examples/echo.js",
    "max" : "10"
},{
    "name" : "api",
    "script" : "./examples/child.js",
    "instances" : "4"
},{
    "name" : "bus",
    "script" : "./examples/echokill.js"
}]

Then with the cli :

$ pm2 start processes.json

Test

npm test

Next Features

  • Remote administration/status checking
  • Builtin Inter process communication channel (message bus)
  • Auto start of the script at start (upstart)
  • V8 GC memory leak detection
  • Web interface
  • Keeping monitoring data
  • Integrated wrk utils endpoint benchmark

Install a process (draft, not implemented)

You can install processes and communicate with them

$ m2 install web-pm2
$ m2 list
$ m2 start web-pm2
$ m2 info web-pm2    // list 
  • Add homogen communication channel (pubsub/eventemitter2 - wildcard events) (axon pub/sub-message.js)

License

(The MIT License)

Copyright (c) 2011-2013 Strzelewicz Alexandre as@unitech.io

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Last updated on 09 Jun 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc