How to Set Up and Manage Health Checks

Validated on 21 May 2025 • Last edited on 25 Mar 2026

App Platform is a fully managed Platform-as-a-Service (PaaS) that deploys applications from Git repositories or container images. It automatically builds, deploys, and scales components while handling all underlying infrastructure.

Health checks in App Platform serve as readiness probes to determine when an application is ready to start handling traffic. When you deploy an app, App Platform uses a set of parameters to determine when health checks should begin, how often they should run, and how many times they must fail before considering the app unhealthy and sending an email to the account’s email address.

App Platform has default health check settings that work for most apps, but you can customize them for your specific app’s needs. For example, if you know your app takes longer to deploy than the default time before health checks start, you may want to increase that value.

You can customize your app’s health check settings using the Control Panel, the CLI or API, or the app spec.

Configure Health Checks Using Automation

You can configure health checks using the CLI’s app update command or the API’s app update endpoint. Add or update the health_check object (and optionally liveness_health_check) in your app spec for the component, then submit the spec using the following command or endpoint. The app spec must completely define all of your app’s configurations. We recommend downloading your current app spec from the control panel, API, or CLI, and modifying it to include the health check settings.

How to Configure Health Checks Using the DigitalOcean CLI
  1. Install doctl, the official DigitalOcean CLI.
  2. Create a personal access token and save it for use with doctl.
  3. Use the token to grant doctl access to your DigitalOcean account.
    doctl auth init
  4. Finally, run doctl apps update. Basic usage looks like this, but you can read the usage docs for more details:
    doctl apps update <app id> [flags]
    The following example updates an app with the ID f81d4fae-7dec-11d0-a765-00a0c91e6bf6 using an app spec located in a directory called /src/your-app.yaml. Additionally, the command returns the updated app’s ID, ingress information, and creation date:
    doctl apps update f81d4fae-7dec-11d0-a765-00a0c91e6bf6 --spec src/your-app.yaml --format ID,DefaultIngress,Created
How to Configure Health Checks Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.
  2. Send a PUT request to https://api.digitalocean.com/v2/apps/{id}.

cURL

Using cURL:

curl -X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/apps/{id}" \
-d '{"alerts":[{"rule":"DEPLOYMENT_FAILED"},{"rule":"DOMAIN_FAILED"}],"domains":[{"domain":"example.com","type":"PRIMARY","zone":"example.com"}],"envs":[{"key":"API_KEY","scope":"RUN_AND_BUILD_TIME","type":"SECRET","value":"EV[1:zqiRIeaaYK/NqctZDYzy6t0pTrtRDez8:wqGpZRrsKN5nPhWQrS479cfBiXT0WQ==]"}],"features":["buildpack-stack=ubuntu-22"],"ingress":{},"name":"example-app","region":"nyc","services":[{"autoscaling":{"max_instance_count":4,"metrics":{"cpu":{"percent":70}},"min_instance_count":2},"git":{"branch":"main","repo_clone_url":"https://github.com/digitalocean/sample-nodejs.git"},"internal_ports":[8080],"log_destinations":[{"name":"your_log_consumer_name","open_search":{"endpoint":"logs.example.com:12345","basic_auth":{"user":"doadmin","password":"1234567890abcdef"},"index_name":"example-index","cluster_name":"example-cluster"}}],"name":"sample-nodejs","run_command":"yarn start","source_dir":"/"}]}'

Python

Using PyDo, the official DigitalOcean API client for Python:

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
req = {
"spec": {
    "name": "web-app-01",
    "region": "nyc",
    "domains": [
        {
            "domain": "app.example.com",
            "type": "DEFAULT",
            "wildcard": True,
            "zone": "example.com",
            "minimum_tls_version": "1.3",
        }
    ],
    "services": [],
    "static_sites": [
        {
            "cors": {
                "allow_origins": [
                    {"exact": "https://www.example.com"},
                    {"regex": "^.*example.com"},
                ],
                "allow_methods": [
                    "GET",
                    "OPTIONS",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE",
                ],
                "allow_headers": ["Content-Type", "X-Custom-Header"],
                "expose_headers": ["Content-Encoding", "X-Custom-Header"],
                "max_age": "5h30m",
                "allow_credentials": False,
            },
            "routes": [{"path": "/api", "preserve_path_prefix": True}],
        }
    ],
    "jobs": [
        {
            "name": "api",
            "gitlab": {
                "branch": "main",
                "deploy_on_push": True,
                "repo": "digitalocean/sample-golang",
            },
            "image": {
                "registry": "registry.hub.docker.com",
                "registry_type": "DOCR",
                "repository": "origin/master",
                "tag": "latest",
            },
            "dockerfile_path": "path/to/Dockerfile",
            "build_command": "npm run build",
            "run_command": "bin/api",
            "source_dir": "path/to/dir",
            "envs": [
                {
                    "key": "BASE_URL",
                    "scope": "BUILD_TIME",
                    "type": "GENERAL",
                    "value": "http://example.com",
                }
            ],
            "environment_slug": "node-js",
            "log_destinations": {
                "name": "my_log_destination",
                "papertrail": {
                    "endpoint": "https://mypapertrailendpoint.com"
                },
                "datadog": {
                    "endpoint": "https://mydatadogendpoint.com",
                    "api_key": "abcdefghijklmnopqrstuvwxyz0123456789",
                },
                "logtail": {
                    "token": "abcdefghijklmnopqrstuvwxyz0123456789"
                },
               "open_search": {
                    "endpoint": "https://myopensearchendpoint.com:9300"
                    "index_name": "logs"
                    "basic_auth": {
                        "user": "doadmin",
                        "password": "password"
                    }
                },
            },
            "instance_count": 2,
            "instance_size_slug": "apps-s-1vcpu-0.5gb",
            "kind": "PRE_DEPLOY",
        }
    ],
    "workers": [
        {
            "name": "api",
            "gitlab": {
                "branch": "main",
                "deploy_on_push": True,
                "repo": "digitalocean/sample-golang",
            },
            "image": {
                "registry": "registry.hub.docker.com",
                "registry_type": "DOCR",
                "repository": "origin/master",
                "tag": "latest",
            },
            "dockerfile_path": "path/to/Dockerfile",
            "build_command": "npm run build",
            "run_command": "bin/api",
            "source_dir": "path/to/dir",
            "envs": [
                {
                    "key": "BASE_URL",
                    "scope": "BUILD_TIME",
                    "type": "GENERAL",
                    "value": "http://example.com",
                }
            ],
            "environment_slug": "node-js",
            "log_destinations": {
                "name": "my_log_destination",
                "papertrail": {
                    "endpoint": "https://mypapertrailendpoint.com"
                },
                "datadog": {
                    "endpoint": "https://mydatadogendpoint.com",
                    "api_key": "abcdefghijklmnopqrstuvwxyz0123456789",
                },
                "logtail": {
                    "token": "abcdefghijklmnopqrstuvwxyz0123456789"
                },
               "open_search": {
                    "endpoint": "https://myopensearchendpoint.com:9300"
                    "index_name": "logs"
                    "basic_auth": {
                        "user": "doadmin",
                        "password": "password"
                    }
                },
            },
            "instance_count": 2,
            "instance_size_slug": "apps-s-1vcpu-0.5gb",
        }
    ],
    "functions": [
        {
            "cors": {
                "allow_origins": [
                    {"exact": "https://www.example.com"},
                    {"regex": "^.*example.com"},
                ],
                "allow_methods": [
                    "GET",
                    "OPTIONS",
                    "POST",
                    "PUT",
                    "PATCH",
                    "DELETE",
                ],
                "allow_headers": ["Content-Type", "X-Custom-Header"],
                "expose_headers": ["Content-Encoding", "X-Custom-Header"],
                "max_age": "5h30m",
                "allow_credentials": False,
            },
            "routes": [{"path": "/api", "preserve_path_prefix": True}],
            "name": "api",
            "source_dir": "path/to/dir",
            "alerts": [
                {
                    "rule": "CPU_UTILIZATION",
                    "disabled": False,
                    "operator": "GREATER_THAN",
                    "value": 2.32,
                    "window": "FIVE_MINUTES",
                }
            ],
            "envs": [
                {
                    "key": "BASE_URL",
                    "scope": "BUILD_TIME",
                    "type": "GENERAL",
                    "value": "http://example.com",
                }
            ],
            "gitlab": {
                "branch": "main",
                "deploy_on_push": True,
                "repo": "digitalocean/sample-golang",
            },
            "log_destinations": {
                "name": "my_log_destination",
                "papertrail": {
                    "endpoint": "https://mypapertrailendpoint.com"
                },
                "datadog": {
                    "endpoint": "https://mydatadogendpoint.com",
                    "api_key": "abcdefghijklmnopqrstuvwxyz0123456789",
                },
                "logtail": {
                    "token": "abcdefghijklmnopqrstuvwxyz0123456789"
                },
               "open_search": {
                    "endpoint": "https://myopensearchendpoint.com:9300"
                    "index_name": "logs"
                    "basic_auth": {
                        "user": "doadmin",
                        "password": "password"
                    }
                },
            },
        }
    ],
    "databases": [
        {
            "cluster_name": "cluster_name",
            "db_name": "my_db",
            "db_user": "superuser",
            "engine": "PG",
            "name": "prod-db",
            "production": True,
            "version": "12",
        }
    ],
    vpc: {
        id: c22d8f48-4bc4-49f5-8ca0-58e7164427ac,
    }
}
update_resp = client.apps.update(id="bb245ba", body=req)

Using the Control Panel

To customize your app’s health check settings, go to the Apps page, select your app, then click the Settings tab. Select the component you want to customize health settings for. Scroll to the Health Checks section and click Edit.

Health checks section

Enter the health check’s type (TCP or HTTP) and its port. Then, you can optionally configure the following or leave them at their default values:

  • Initial Delay: The number of seconds before App Platform begins initiating health checks after a deployment.
  • Period: The number of seconds (interval) between health checks.
  • Timeout: The number of seconds before a health check is considered failed.
  • Success Threshold: The number of consecutive successful health checks required before the app is considered healthy.
  • Failure Threshold: The number of consecutive failed health checks required before the app is considered unhealthy.

You can enable liveness probes for services and workers that automatically restart your app if its health check fails. We recommend using liveness checks (which restart the app) in conjunction with health checks (which stop traffic). To do so, click Add liveness check and enter the same information as above.

Liveness checks section

When finished, click Save.

Using the App Spec

To customize your app’s health check settings, edit the app’s spec and add the health_check object to your service component, like this:

app.yaml
health_check:
  initial_delay_seconds: 30
  period_seconds: 10
  timeout_seconds: 5
  success_threshold: 1
  failure_threshold: 5
  http_path: /api
  port: 8080

Each field in the health_check object has the following meaning:

  • initial_delay_seconds: The number of seconds before the App Platform begins initiating health checks after a deployment.
  • period_seconds: The number of seconds (interval) between health checks.
  • timeout_seconds: The number of seconds before a health check is considered failed.
  • success_threshold: The number of consecutive successful health checks required before the app is considered healthy.
  • failure_threshold: The number of consecutive failed health checks required before the app is considered unhealthy.
  • http_path: The HTTP path on which to perform health checks. If not set, App Platform disables the HTTP health check and a TCP health check is used instead.
  • port: The port on which to perform health checks. If not set, App Platform performs the health check on the component’s http_port.

Once you add the health_check object to your app spec, upload the spec to your app’s repo or deploy it directly using the control panel.

Set Up Liveness Probes

You can enable liveness probes for services and workers that automatically restart your app if its health check fails.

We recommend using liveness_health_check (which restarts the app) in conjunction with health_check (which stops traffic).

Services

To enable liveness probes for a service, specify liveness_health_check in your app spec, like this:

name: sample-golang 
services: 
 - name: web 
   github: 
     repo: digitalocean/sample-golang 
     branch: master 
   liveness_health_check: 
     initial_delay_seconds: 10 
     period_seconds: 10 
     timeout_seconds: 5 
     success_threshold: 1 
     failure_threshold: 6 
     http_path: / 
     port: 8080

Workers

To enable liveness probes on workers, specify liveness_health_check in your app spec and ensure your worker application is listening to the designated port and responds to health checks, like this:

name: sample-golang 
workers: 
 - name: background-service 
   envs: 
     - key: PORT 
       value: "8080" 
   github: 
     repo: digitalocean/sample-golang 
     branch: master 
   liveness_health_check: 
     initial_delay_seconds: 10 
     period_seconds: 10 
     timeout_seconds: 5 
     success_threshold: 1 
     failure_threshold: 5 
     http_path: / 
     port: 8080

We can't find any results for your search.

Try using different keywords or simplifying your search terms.