Skip to content

Commit f9542ce

Browse files
committed
Add health check to Directus service in Docker Compose example
Add a healthcheck configuration to the directus service block and a section explaining the /server/health and /server/ping endpoints. This helps users who run other containers that need to wait for Directus. Fixes #331
1 parent df6d872 commit f9542ce

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

content/self-hosting/3.deploying.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ services:
8383
condition: service_healthy
8484
cache:
8585
condition: service_healthy
86+
healthcheck:
87+
test: ["CMD-SHELL", "wget --spider -q http://localhost:8055/server/health || exit 1"]
88+
interval: 10s
89+
timeout: 5s
90+
retries: 5
91+
start_interval: 5s
92+
start_period: 30s
8693
environment:
8794
SECRET: "REPLACE_WITH_YOUR_SECRET"
8895

@@ -109,3 +116,12 @@ services:
109116
**Request Other Examples**
110117
We're keeping this section light for now, but if you need examples for other database providers, let us know!
111118
::
119+
120+
## Health Checks
121+
122+
The Docker Compose example above includes health checks for all services. If you run other containers that depend on Directus being ready, use `depends_on` with `condition: service_healthy` to wait for Directus to start accepting requests.
123+
124+
Directus exposes two endpoints for health monitoring:
125+
126+
- `/server/health` - returns detailed health status including database and cache connectivity. Returns a `503` if any dependency is unhealthy (for example, a missing email transport configuration).
127+
- `/server/ping` - returns `pong` if the HTTP server is running, regardless of dependency status. Use this if you only need to confirm the server is accepting requests.

0 commit comments

Comments
 (0)