works:linux:pm2

Заметки по PM2

Пример скрипта ecosystem.config.js

ecosystem.config.js
module.exports = {
  apps: [
    {
      name: "project-name",
      cwd: "/opt/project-path/",
      exec_mode: "cluster",  // execution model - "fork", "cluster"
      instances: "1",
      script: "./server/index.js", // your script  (or executible like "/usr/bin/java")
      args: "start", // arguments or (set of arguments ["-jar", "/opt/project-path/project-name.jar"])
      env: {
        NODE_ENV: "production", 
        SOME_ENV: "some_value"...
      },
      // "watch": [  Watch files if required autorestart
      //      "/opt/project-path/project-name.jar",
      //      "/opt/project-path/application.properties"
      //],
      // "node_args": [], // nodejs arguments
      // "exec_interpreter": "", // interpreter
    },
  ],
};

pm2 run ecosystem.config.js

works/linux/pm2.txt · Last modified: 2022/06/02 11:03 by Chugreev Eugene