Node process manager, with load balancing, daemons, monitoring, logging, etc

Pm2. Keymetrics. IO/docs/usage /…

The installation

npm install -g pm2
// or
yarn global add pm2
Copy the code

Common commands

Pm2 start app.js - I 4 # cluster mode to start 4 app.js application instances. Pm2 start app.js --name index # Start the application and name it index pm2 start app.js --watch # Automatically restart pm2 start script.sh when the file changes Pm2 jlist pm2 jlist pm2 jlist pm2 jlist pm2 jlist pm2 jlist pm2 jlist pm2 jlist pm2 jlist pm2 jlist pm2 jlist pm2 jlist Describe [id] # describe [id] # describe [id] # describe [id] # describe [ID] # describe [ID] # describe [ID] # describe Pm2 stop all # Stop all applications pm2 stop [id] # Stop all applications pm2 restart all Pm2 delete all pm2 delete all pm2 delete all pm2 delete [id] # Pm2 save # save the list of applications. Pm2 update # Save the process, kill the pm2 and restore the processCopy the code

Advanced usage

Through ecosystem. Config. Js, configure, and see: pm2. Keymetrics. IO/docs/usage /…

Server.config.js for vue nuxt
module.exports = {
  apps: [{name: APPNAME,
      exec_mode: 'cluster'.instances: '10'.// Or a number of instances
      script: './node_modules/nuxt/bin/nuxt.js'.args: 'start'.env: {
        NUXT_ENV: 'dev'.NODE_ENV: 'development'
      },
      env_prod: {
        NUXT_ENV: 'prod'.NODE_ENV: 'production'}}};Copy the code