Score:0

PM2 cluster mode additional processes use wrong script path

uy flag

I have a nodejs app running on a server with the following ecosystem.config.js:

    module.exports = {
      apps : [
    {
        name      : "app.website.com",
        script    : "/var/www/app.website.com/node/server.js",
        cwd       : "/var/www/app.website.com/node/",
        instances : "max",
        exec_mode : "cluster",
        max_memory_restart: "500M",
        out_file  : "/var/log/pm2.app.website.com.out.log",
        error_file: "/var/log/pm2.app.website.com.err.log",
        merge_logs: true,
        pid_file  : "/var/run/pm2.app.website.com.pid"
    },
    {
        name      : "dev1.website.com",
        script    : "/var/www/dev1.website.com/node/server.js",
        cwd       : "/var/www/dev1.website.com/node/",
        instances : 1,
        exec_mode : "cluster",
        max_memory_restart: "500M",
        out_file  : "/var/log/pm2.dev1.website.com.out.log",
        error_file: "/var/log/pm2.dev1.website.com.err.log",
        merge_logs: true,
        pid_file  : "/var/run/pm2.dev1.website.com.pid"
    },
      ]
    }

When I start this, I see in pm2 status:

  • 3 processes started for app.website.com
  • 2 of them constantly restarting

in pm2 monit

I see that one of the 3 processes has a script path of

/var/www/app.website.com/node/server.js

whereas the 2 others have a script path of

/var/www/app.website.com/node

therefore they are erroring.

I can't see why the script paths of the 3 processes would not be the same?

Pm2 version 5.1.1 nodejs version 14.17.6

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.