Anyone was able to configure pm2 with nest.js and wait_ready signal? Idea is that when I run pm2 reload I would hope app being accessible during the whole reload if I run in it in cluster mode.
This is config I am using for pm2:
module.exports = {
apps: [
{
name: "pm2test",
script: "dist/pm2ReloadTest.js",
instances: "3",
exec_mode: "cluster",
autorestart: true,
time: true,
wait_ready: true,
},
],
};
and this is what I add to app.module
export class AppModule implements OnApplicationBootstrap {
async onApplicationBootstrap() {
console.log('All modules initialized');
process.send('ready');
}
}
Instead what happen is that the user might experience 502 error coming from nginx (acting as reverse proxy for nest.js app)