Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pm2t

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pm2t

Production process manager for Node.JS applications with a built-in load balancer.

  • 4.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
92
decreased by-27.56%
Maintainers
1
Weekly downloads
 
Created
Source
A Typescript version of PM2 4.5.0
P(rocess) M(anager) 2
Runtime Edition
Don't use for your production app. Use PM2 instead

Downloads per Month npm version node version Build Status


A process manager for Node.js applications.

Starting an application in production mode is as easy as:

$ pm2t start app.js

Works on Linux (stable) & macOS (stable) & Windows (stable). All Node.js versions are supported starting Node.js 8.X.

Installing PM2t

With NPM:

$ npm install pm2t -g

Start an application

You can start any application (Node.js, Python, Ruby, binaries in $PATH...) like that:

$ pm2t 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

To list all running applications:

$ pm2t list

Managing apps is straightforward:

$ pm2t stop     <app_name|namespace|id|'all'|json_conf>
$ pm2t restart  <app_name|namespace|id|'all'|json_conf>
$ pm2t delete   <app_name|namespace|id|'all'|json_conf>

To have more details on a specific application:

$ pm2t describe <id|app_name>

To monitor logs, custom metrics, application information:

$ pm2t monit

More about 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).

Starting a Node.js application in cluster mode that will leverage all CPUs available:

$ pm2t start api.js -i <processes>

<processes> 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:

$ pm2t reload all

More informations about how PM2 make clustering easy

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

Terminal Based Monitoring

Monit

Monitor all processes launched straight from the command line:

$ pm2t monit

Log Management

To consult logs just type the command:

$ pm2t logs

Standard, Raw, JSON and formated output are available.

Examples:

$ pm2t logs APP-NAME       # Display APP-NAME logs
$ pm2t logs --json         # JSON output
$ pm2t logs --format       # Formated output

$ pm2t flush               # Flush all logs
$ pm2t reloadLogs          # Reload all logs

More about log management

Startup Scripts Generation

PM2 can generates and configure a Startup Script to keep PM2 and your processes alive at every server restart.

Init Systems Supported: systemd, upstart, launchd, rc.d

# Generate Startup Script
$ pm2t startup

# Freeze your process list across server restart
$ pm2t save

# Remove Startup Script
$ pm2t unstartup

More about Startup Scripts Generation

PM2 Modules

PM2 embeds a simple and powerful module system. Installing a module is straightforward:

$ pm2t install <module_name>

Here are some PM2 compatible modules (standalone Node.js applications managed by PM2):

pm2-logrotate automatically rotate logs and limit logs size
pm2-server-monit monitor the current server with more than 20+ metrics and 8 actions

Updating PM2

# Install latest PM2 version
$ npm install pm2t@latest -g
# Save process list, exit old PM2 & restore all processes
$ pm2t update

Contributors

License

Keywords

FAQs

Package last updated on 21 May 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc