Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
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.
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
Forever is a simple CLI tool for ensuring that a given script runs continuously (i.e., forever). It is similar to PM2 but lacks some of its advanced features like application monitoring and load balancing.
Nodemon is a utility that monitors for any changes in your source and automatically restarts your server. It is often used in development environments, unlike PM2 which is tailored for production use.
StrongLoop Process Manager (strong-pm) is a production process manager for Node.js applications with features like remote deployment and performance monitoring. It is part of the StrongLoop suite, which is now owned by IBM.
Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems. It is not specifically designed for Node.js and is more general-purpose.
The next generation daemon process manager for Node.js with native clusterization.
PM2 is mainly a production module for Linux servers.
npm install -g pm2
$ 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
// You can also pass the 'max' params to start
// the right numbers of processes depending of CPUs
$ 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 pm2_id // Stop specific process id
$ pm2 stopAll // Stop all processes
$ pm2 resurect // Put online previously dumped processes
$ pm2 restart pm2_id // Restart specific process
$ pm2 restartAll // Restart all proccesses
$ pm2 stopAll
$ pm2 generate app // Generate a JSON process configuration
$ pm2 web // Health computer API endpoint (http://localhost:9615)
List infos about all processes managed by pm2. It shows also how many times a process has been restarted because of an unhandled exception.
Monitor CPU and memory usage of every node process (and also clustered processes) managed by pm2.
Display logs in streaming of all processes, without having to do a tail -f or something else.
You can dump all currently running processes, including their environment and execution path.
After restarting or stopping PM2 you can resurect
them.
PM2 can disserve an API endpoint to monitor processes and computer health (cpu usage, memory, network interfaces...)
pm2 web
processes.json :
[{
"name" : "echo",
"script" : "./examples/echo.js",
"max" : "10",
"args" : "-d 1"
},{
"name" : "api",
"script" : "./examples/child.js",
"instances" : "4"
},{
"name" : "bus",
"script" : "./examples/echokill.js"
}]
Then with the cli :
$ pm2 start processes.json
npm test
You can install processes and communicate with them
$ m2 install web-pm2
$ m2 list
$ m2 start web-pm2
$ m2 info web-pm2 // list
(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.
FAQs
Production process manager for Node.JS applications with a built-in load balancer.
We found that pm2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.