I have a dev and prod instance of a microservice running on one machine. My ecosystem file gives them the same name. PM2 will not start the second instance when the first is running due to the name (presumably). Any ideas for a workaround here?
I have a dev and prod instance of a microservice running on one machine. My ecosystem file gives them the same name. PM2 will not start the second instance when the first is running due to the name (presumably). Any ideas for a workaround here?
Thanks for the help... I ended up with this:
require("dotenv").config();
module.exports = {
apps: [
{
name: "app-" + process.env.environment,
script: "./app.js",
max_memory_restart: "150M"
}
]
};
Pm2 do not sensitive filename because the name is usual for human not for PM2 process.
The usual mistake:
The solution is start first process with pm2 and second process normal start with nodejs and you can see the log and error if not start, or started successfully then start second process first, first process second.
and you can use pm2panel for easily add or remove process in pm2.