Skip to content

Health Checks ​

A health check tells Zenavo when an instance is ready to receive traffic. A deploy starts the new instance next to the old one and switches traffic only once the new one passes, which is what makes rollouts zero-downtime.

Choose the check under Service → Settings → Health Check:

  • Port (default): Zenavo checks that the service's first TCP or HTTP port accepts connections, every 10 seconds, with a 5-second timeout and 3 failures allowed. Services without such a port have no check and count as ready once they start.
  • HTTP: Zenavo requests a path, such as /healthz, on the service's first TCP or HTTP port or on a port you set. Any 2xx or 3xx answer means ready. The request comes from the cluster, so the image needs no curl or wget. This is the best choice for web apps.
  • Command: a command run inside the container, such as pg_isready -U postgres; exit code 0 means ready. It runs without a shell, so for &&, | or $VARIABLES write sh -c "…". Databases added from the console and many templates include one.

HTTP and command checks have adjustable timing: the interval between checks, the timeout of one check, the failures allowed before the instance counts as unhealthy (default 6), and the start period to wait after the container starts (default 10 seconds). Raise the start period for apps that start slowly, such as Java apps or apps that run migrations on start.

Until a new instance passes its check for the first time, Zenavo runs the check every 2 seconds, so an app that starts in a second is ready in about two, not at the next interval. After that the interval above applies.

In a manifest:

json
"healthcheck": { "http": { "path": "/healthz" }, "interval": 10, "timeout": 5, "retries": 6, "start_period": 10 }

or "command": ["pg_isready", "-U", "postgres"] in place of "http".

Turning the check off ​

Switch off Enable health checks for a service that keeps a port but does not listen on it, such as a background worker or scheduler. Otherwise the port check never passes, so the instance never becomes ready and its deploy fails. With the check off, an instance gets traffic as soon as it starts and a deploy does not wait for it. The change applies on the next deploy. In a manifest: "healthcheck": { "disabled": true }.

When a check fails ​

  • During a deploy: if the new instance keeps failing its check, the deploy fails as soon as that is clear, with the reason from the last check (for example HTTP probe failed with statuscode: 404) and the instance's latest logs. The old instance keeps serving.
  • After a deploy: an instance that stops passing gets no traffic, and the service shows as Unhealthy. Zenavo does not restart it for failing the check; check its logs, then redeploy or restart it.

Crashes during a deploy ​

A deploy does not wait for a crashing instance to restart again and again:

  • One retry. An instance may crash once; it is restarted at once or 10 seconds later. If it crashes again, the service's deploy fails with the exit code and the logs of the run that crashed.
  • Services it depends on. A service with depends_on may crash while the services it depends on are still starting in the same deployment, since many apps exit when their database is not up yet. Once those are ready (or have failed), it gets the same one retry.
  • Failures a retry cannot fix end the deploy at the first crash: running out of memory (raise the memory limit), and a command that is not found or cannot be run (exit code 127 or 126).

The deploy's other services are not affected. The crash limit below is separate: it applies to a service that is already deployed.

Crash limit ​

If a service keeps crashing, Zenavo suspends it after a number of consecutive crashes (its crash limit, 5 unless you change it) instead of restarting it forever. A crash that follows 10 minutes of running starts the count again, so a service that crashes once in a while is not suspended. The service then shows a notice; check its logs, then resume it or deploy a fix.