What the health check does
- An instance gets no traffic until it passes. So a deployment can wait for your app to finish starting before the first request arrives.
- An instance that fails
failureThresholdchecks in a row is restarted.
GET check passes on any status from 200 to 399. Anything else, including a timeout, is a failure.
Without a health check, an instance is ready as soon as its container is running, and it’s only restarted if the process exits. That’s fine for apps that are ready as soon as they open the port. Add a check if startup takes a while, or if your process can be running but unable to serve.
Choose what to check
Check the process, not its dependencies. A failing check restarts the container, so a check that queries your database takes every instance down when the database has a bad minute.GET /healthz returning 200 is enough.
Add a health check
In the dashboard, go to App settings > Environments, open the environment, and click Configure on its Runtime card. PickGET or POST, enter the path under Health check path, and set the Health check interval. Saving there applies the check to that environment only. In the API, set healthcheck in runtime settings with environments.updateSettings:
Add a check with a shorter timeout
"healthcheck": null.
Fields
Onlymethod and path are required. The others use the defaults below.
GET | POST
required
The HTTP method.
POST sends an empty body using wget inside your container, so your image must include wget.string
required
The path to request on your app’s port, 1 to 512 characters, starting with
/ and matching ^(/[\w\-]+)+(\.[\w]+)?$, for example /healthz.integer
default:"10"
Seconds between checks, 1 to 3600. The dashboard’s Health check interval field takes whole seconds and starts at 10.
integer
default:"5"
Seconds to wait for a response before the check fails, 1 to 3600. Only settable in the API. Saving from the dashboard keeps the current value, or sets 5 for a new check.
integer
default:"3"
Failures in a row before the instance is restarted, 1 to 100. Only settable in the API. Saving from the dashboard keeps the current value, or sets 3 for a new check.
integer
default:"0"
Seconds after the container starts before the first check, 0 to 3600. Only settable in the API. Saving from the dashboard keeps the current value, or sets 0 for a new check.