Skip to main content
Health checks are HTTP requests that Sevalla sends to each instance of the web process. The readiness probe decides when an instance gets traffic: during a deployment, new instances receive requests only once it passes. The liveness probe restarts an instance that stops responding. A Flask application needs two endpoints for them, one that checks the database and one that only checks that the application answers.

At a glance

Environment variables

This guide adds no variables. The application uses the ones in Deploy a Flask application.

Before you begin

  • The storefront project from Deploy Flask, deployed on Sevalla. This guide replaces its app/__init__.py.

Add the endpoints

Replace app/__init__.py with this version, which adds /healthz and /livez to the application factory:
app/__init__.py
  • /healthz returns 200 when the database answers a query and 503 with {"status":"database unavailable"} when it doesn’t. Use it for readiness: an instance that can’t reach the database gets no traffic.
  • /livez returns 200 whenever the application runs. Use it for liveness, so that a database outage doesn’t restart every instance.
Ingot starts Gunicorn with 4 threads per worker process, so one slow request doesn’t hold up the probes. Add more checks to /healthz for each service the application can’t work without, such as cache.get("health") for a Redis cache. Commit and push the changes, and wait for the deployment to finish before you turn on the probes:
If Auto-deploy is off, click Deploy now on the application’s Overview tab.

Turn on the health checks

1

Open the web process

On the application’s Processes tab, click ⋯ on the Web process, then click Update process.
2

Turn on the readiness probe

Under Health checks, turn on Readiness probe and set the Path to /healthz. Keep the Port at the web process’s port, 8080 unless you changed it.
3

Turn on the liveness probe

Turn on Liveness probe, set the Path to /livez, and set the Initial delay to 10 seconds, so a slow start doesn’t count as a failure.
4

Save and deploy

Click Update process, then click Deploy in the undeployed changes bar at the bottom of the page.
The sheet for updating the web process, with its start command, resource, scaling and the Health checks section with the readiness probe onThe sheet for updating the web process, with its start command, resource, scaling and the Health checks section with the readiness probe on
A probe passes when the path answers with a status from 200 to 399 within the timeout (1 second by default). Only the web process has health checks. See Health checks for every probe setting and its default.

Verify

  1. Request the endpoint through your domain. The command prints the body, which Flask ends with a newline, then the status code:
  2. On the Deployments tab, the deployment that turned on the probes reaches Deployed: its new instance passed the readiness probe before it took traffic.
  3. To read the probes back, use Get process (getProcessV3) with APP_ID and WEB_ID from Deploy with the API:
    The CLI shows the process with sevalla apps processes get "$WEB_ID" --app-id "$APP_ID" --json, and the MCP server with get_application.
If the deployment doesn’t finish, click App health on the Overview tab to see each instance’s status. An instance that fails the readiness probe shows Unready: request the path yourself and check that it returns 200, and that the Port matches the port Gunicorn listens on.

Deploy with the API

These calls deploy the endpoints, then turn on the probes, as the steps on this page do. APP_ID and WEB_ID, the web process, come from Deploy with the API in the deploy guide, which also turned on auto-deploy, and SEVALLA_API_KEY holds the same API key. Commit the code from this page first, without pushing it, and run the commands in the project folder.
1

Push and find the deployment

Push the commit. Auto-deploy starts a deployment of it, and List deployments (listDeploymentsV3), newest first, returns it once it exists:
With auto-deploy off, start it with Trigger deployment (triggerDeploymentV3) instead. CLI: sevalla apps deployments list --app-id "$APP_ID". MCP: list_deployments.
2

Wait for the deployment

Get deployment (getDeploymentV3) until status is success or failed:
It prints success when the deployment finishes, or failed; after 30 minutes without either, it prints the status it last read. CLI: sevalla apps deployments get "$DEPLOYMENT_ID" --app-id "$APP_ID". MCP: get_deployment, then get_deployment_logs if it failed.
3

Turn on the health checks

Update process (updateProcessV3) on the web process. Send every probe field, timeoutSeconds included: a probe set through the API without it waits up to 120 seconds for an answer, not the dashboard’s 1 second. The values are the dashboard’s defaults, with the paths from this page and a 10-second initial delay for the liveness probe:
It prints {"readiness":"/healthz","liveness":"/livez","timeout":1}. CLI: not available. MCP: sevalla_api_update with updateProcessV3 and the same body.
4

Deploy the health checks

The probes apply at the next deployment. Trigger deployment (triggerDeploymentV3) with is_restart reuses the last build:
CLI: sevalla apps deployments trigger "$APP_ID" --restart. MCP: trigger_deployment with restart set to true.
5

Wait for the deployment

Get deployment (getDeploymentV3) until status is success or failed:
success means the new instance passed the readiness probe. CLI: sevalla apps deployments get "$DEPLOYMENT_ID" --app-id "$APP_ID". MCP: get_deployment.
Then run the checks in Verify, with the domain from List application domains (listApplicationDomainsV3) as in the deploy guide.