From Keymetrics to PM2 +
Keymetrics is the new PM2 Plus. Here is the story about the "why?". Here we are more than 5 years after the first commit on the PM2 open source project. Which is now de facto process manager for Node.js
# Install pm2 globally using NPM or Yarn $ npm install -g pm2 # Start your application $ pm2 start app.js # That's it, your app is ready for production
Using PM2 is straightforward, install it via Yarn or NPM, start your application and get in full control
# Baremetal installation npm install -g pm2 pm2 start app.js # Or in docker RUN npm install pm2 -g CMD ["pm2-runtime", "app.js"]
# Start and load balance 4 instances of app.js pm2 start app.js -i 4 # Or load balance the maximum of applications pm2 start app.js -i max # Achieve a 0-second-downtime reload. pm2 reload app
# Start in production mode pm2 start api.js worker.js # List applications pm2 list # Restart them all pm2 restart all # Delete that api pm2 delete worker
# Display logs from app pm2 logs pm2 logs app # One command install: Automatic log rotation pm2 install pm2-logrotate
# Setup deployment at remote location $ pm2 deploy production setup # Update remote version $ pm2 deploy production update # Revert to -1 deployment $ pm2 deploy production revert 1 # execute command on remote machines $ pm2 deploy production exec "pm2 reload all"
We carefully crafted a documentation that you can consider like the reference for any PM2 questions.
Guides, Integrations, best practices and much more.
Once started, your app is forever alive, auto-restarting across crashes.
Restart even across server restart with startup scripts that can be generated with `pm2 startup`.
Run and manage your processes easily. Take full control of your Node.js application running in the background.
Monitor your app in the terminal to check your app health (CPU usage, memory used, request/min and more).
Don't spend hours finding and classifying your application logs, PM2 does it intelligently for you.
As Node.js is monothreaded, PM2 automatically duplicates the processes to use all the cores for your CPUs.
Thanks to this, you can also restart your app with zero-seconds downtimes.
Don't ssh one by one in all your servers anymore. PM2 gives you the possibility to deploy your apps remotely.
Look how to configure it.