Running the service Recommended
Separate alive from ready
Expose one check that says the process is alive and another that says it can serve traffic now.
How to do it
Keep the liveness check trivial, so a slow database never causes a restart loop. Make the readiness check test dependencies, as the health check rule describes. Load balancers and orchestrators use readiness to route traffic. For a slow start, add a startup check, so liveness waits until the service is up.
How to check
Stop the database on staging. Readiness answers 503 and traffic stops, while liveness still answers 200 and the process is not restarted.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers operations playbook: https://agentwranglers.se/playbook/operations/running-the-service/liveness-and-readiness.