Skip to main content

Health and Monitoring

Check whether the appliance is healthy with its liveness and readiness endpoints, Docker's health check, and the control panel's heartbeats.

Liveness and Readiness

EndpointAnswer
GET /healthHTTP 200 with "ok" whenever the web service answers
GET /readyHTTP 200 when PostgreSQL answers, HTTP 503 when it doesn't, with "ready" either way

The readiness check depends on the database, not on the Discord bot, so a stopped or failed bot leaves the appliance healthy.

Docker Health Check

Docker runs the image's health check every 30 seconds, with a 5-second timeout, a 30-second start period, and 3 retries. It checks the s6-overlay status of the bot, PostgreSQL, the web service, and the worker, then sends GET /health to port 22604 with a 4-second limit. Every check must pass.

bash
docker ps --filter name=discord-stonker-bot

With Compose, run docker compose ps instead. The STATUS column shows the result of the latest check.

Service Supervision

s6-overlay starts the services in order: it prepares PostgreSQL, starts it, runs the database migrations, and then starts the bot, the web service, and the worker.

The image's s6 timing limits keep a normal whole-container shutdown inside Docker's 10-second stop window.

Heartbeats in the Panel

The Services section of the Overview page shows each service's status from its latest heartbeat, such as Ready. Hovering over one shows when that heartbeat arrived.

Services section of the Overview page showing Ready for the Bot process, the Control panel, and Scheduled jobs
Heartbeats on the Overview page

A service that hasn't reported yet shows "No heartbeat yet". A service whose last heartbeat is more than 90 seconds old shows Not responding and when that heartbeat arrived. When the bot is set to run and its process goes quiet that long, the bot status changes to Not responding too.

Get Alerts

The Notifications page sends an alert to ntfy, Telegram, email, or another service, so you hear about problems without checking the panel.

Monitor From a Script

GET /api/v1/bot answers with the bot's status and each service's latest heartbeat, for an access token with the bot:control scope. That scope also allows starting and stopping the bot, so it is recommended to keep the token's other scopes off, as described in Access Tokens and API.

Only an Operator, an Administrator, or the Owner can give a token the bot:control scope, because a Viewer can only grant features:read and logs:read.

Logs

The Logs page shows the events of the bot, the web service, and the worker, as described in Logs. docker compose logs --follow app shows those too, plus the startup checks, the database migration, the setup code, the installation key lines, PostgreSQL, and s6-overlay.