pm2-runtime: wait-ready not supported?
What's going wrong?
CLI options --wait-ready and --listen-timeout are unsupported when using pm2-runtime
How could we reproduce this issue?
pm2-runtime start server.js -i 2 --wait-ready --listen-timeout 30000
error: unknown option `--wait-ready'
Supporting information
We run an application in Docker that runs 2 instances for failover purposes. However due to the time it takes to connect to various databases and connections, upon a restart after a crash, it could take up to 20 seconds for the process to start listening to connections. Before we moved to docker, we were using the wait_ready option which worked perfectly.
However now, pm2-runtime thinks our restarted process is online even though it's not and starts routing requests to the node. This in turn causes our load balancers to think the container is unhealthy because it gets a 502 from the newly started process that isn't ready yet which then causes the container to be removed from the cluster and results in undesirable behavior.
Our current workaround is increasing the health check interval from the loadbalancer, but we'd like to get this done right. Any insight is appreciated.
Thank you for the project by the way, we've been using it in production for many years now, and it's been a life saver many times over.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@adi87 I just leave this in case somebody stumbles upon the same issue:
Yes, [email protected] is still not working with --wait-ready.
Use this alternative:
pm2 start --wait-ready -config pm2.config.json; pm2 logs all