pm2 reload test.config.js --only api-dev
//test.config.js
module.exports = {
apps : [{
name: "api-dev",
script: "/home/developer/api-dev/source/dist/src/bin/www.js",
instances: 4,
exec_mode: "fork", //OR "fork_mode"
instance_var: "PORT",
wait_ready: true,
max_restarts: 15,
autostart: true,
restart_delay: 4000,
watch: false,
force: true,
max_memory_restart: "2G",
env: {
"DEBUG": "test-backend:*",
"NODE_ENV": "development",
"GOOGLE_APPLICATION_CREDENTIALS": "XXXXXXXXX",
"ELASTIC_ID": "XXXXXXXXX",
"ELASTIC_USERNAME": "XXXXXXXX",
"ELASTIC_PASSWORD": "XXXXXXXXXX",
"PORT": 3002,
"EXPRESS_SESSION_SECRET": "XXXXXXX"
}
}]
}
I tried evey possible fixes out there on github or pm2 docs, but as soon as I hit reload command only 1 process starts and other keep on restarting with error
PM2 | App [api-dev:62] online
61|api-dev | Port 3002 is already in use
PM2 | App [api-dev:61] exited with code [1] via signal [SIGINT]
It's working with pm2 start..* OR stop && delete && start
but I can't always delete and start process as our deploy pipeline runs 5-10 times a day.
Upgraded PM2 to Latest version 5.3.0
but not fixed
Tried all the configuration combination and upgraded PM2 to Latest version 5.3.0
but no luck