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