Skip to content

Commit 4a74617

Browse files
KyleAMathewsclaude
andauthored
Add health check documentation to deployment guide (#3603)
Document the /v1/health endpoint for liveness and readiness probes, including HTTP status codes, response format, and note that it works without authentication when ELECTRIC_SECRET is set. Co-authored-by: Claude <[email protected]>
1 parent ed98c6b commit 4a74617

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

website/docs/guides/deployment.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,29 @@ The file system location configured via `ELECTRIC_STORAGE_DIR` and the data Elec
160160

161161
Electric provides an HTTP API exposed on a configurable [`ELECTRIC_PORT`](/docs/api/config#electric-port). You should make sure this is exposed to the Internet.
162162

163+
### Health checks
164+
165+
Electric provides a health check endpoint at `/v1/health` that can be used for liveness and readiness probes. This endpoint does not require authentication, so it works even when [`ELECTRIC_SECRET`](/docs/api/config#electric-secret) is set.
166+
167+
The endpoint returns a JSON response with a `status` field:
168+
169+
| HTTP Status | Response | Meaning |
170+
|-------------|----------|---------|
171+
| `200` | `{"status": "active"}` | Electric is fully operational and ready to serve requests |
172+
| `202` | `{"status": "waiting"}` | Electric is waiting to acquire the replication lock |
173+
| `202` | `{"status": "starting"}` | Electric is starting up and establishing connections |
174+
175+
For **liveness probes**, any response (200 or 202) indicates the service is alive.
176+
177+
For **readiness probes**, you should check for a `200` status code to ensure Electric is fully ready to handle shape requests.
178+
179+
Example health check using curl:
180+
181+
```shell
182+
curl http://localhost:3000/v1/health
183+
# {"status":"active"}
184+
```
185+
163186
### Caching proxy
164187

165188
Electric is designed to run behind a caching proxy, such as [Nginx](https://nginx.org/en), [Caddy](https://caddyserver.com), [Varnish](https://varnish-cache.org) or a CDN like [Cloudflare](https://www.cloudflare.com/en-gb/application-services/products/cdn) or [Fastly](https://www.fastly.com/products/cdn). You don't _have_ to run a proxy in front of Electric but you will benefit from radically better performance if you do.

0 commit comments

Comments
 (0)