Health checks and automatic restarts
Check that an app really answers, and let Deplo restart it when it stops.
Deplo asks every app with a domain whether it still answers, and restarts it when it does not. This is on by default.
Set your own health check
Your own check decides what "answering" means. For a single-image app.
Turn it on
Open the app, then Settings -> Advanced, and turn on Health check.
Pick the check
- HTTP request: a Path, like
/healthz. Any status under 400 is healthy. Fill Port only if the check answers on another port than the app's. - Command: a shell line that exits 0 when things are fine, like
pg_isready -U app.
Set the timings, then save
| Field | What it means | Default |
|---|---|---|
| Interval | Seconds between checks | 30 |
| Timeout | Seconds one check may take, shorter than the interval | 5 |
| Retries | Failures in a row before the app is unhealthy | 3 |
| Start period | Seconds of grace while the app boots | 10 |
Save. The check starts with the next deploy.
What gets checked
| The app has | What Deplo asks | Restarted after |
|---|---|---|
| A domain, no check of its own | GET / every 30 seconds. Any answer counts, a 404 too | 3 failures in a row |
| Its own health check | Your check | Retries failures in a row |
| No domain, no check | Nothing | Only a crash restarts it |
Give a worker with no domain a Command check to have it restarted when it hangs.
Reading the result
The status shows on the app's badge, on the Overview and on Monitoring.
- Healthy: the last check was answered.
- Unhealthy: running, but it failed enough checks in a row.
- Starting: inside the start period.
Error is not unhealthy
Error means the last deploy failed. An app can be Error and healthy at once, because the previous version is still serving.
Automatic restarts
Deplo restarts an app that crashes or stops answering, until restarting clearly does not help:
| The app | Deplo stops trying after | Then |
|---|---|---|
| Is up but does not answer | 5 restarts in 30 minutes | The app keeps running and reads Not answering · restarts paused |
| Crashes | 10 restarts in 30 minutes | The app is stopped. Logs reads Stopped, with a Start button |
Paused restarts resume after your next deploy, a manual restart, or 30 minutes with no failed check. A deploy also starts the crash count again.
You get the alerts App stopped answering at the first restart, App still not answering when restarts pause, and App keeps restarting when a crashing app is stopped. Activity records each restart for not answering, and each stop.
Both switches are in the app's Settings -> Advanced:
- Restart when it stops answering: turn it off for an app meant to be slow to answer. It applies from the next deploy.
- Restart loop protection, on a database too: turn it off to let a container keep crashing. It applies at once.
Good to know
- An unhealthy app keeps its traffic. A check never changes routing.
- Each replica is checked on its own. One stuck replica restarts while the others serve.
Something wrong? See Deploys and builds.
Did this page help you?