This application performs periodic health checks against a LiveKit instance to ensure it is reachable and operational. The health check is done externally via a full client connection procedure, including:
- Room creation
- Signaling establishment
- WebRTC connection establishment
- Teardown
The goal is for this to be an E2E health checker that takes into account most of the moving parts of a LiveKit deployment from an end-user perspective.
The application is configured using environment variables.
| Variable | Description | Default |
|---|---|---|
LIVEKIT_HOST |
The WebSocket URL of the LiveKit server. | ws://localhost:7880 |
LIVEKIT_API_KEY |
The API key for connecting to LiveKit. | (none) |
LIVEKIT_API_SECRET |
The API secret for connecting to LiveKit. | (none) |
HEALTHCHECK_INTERVAL |
The interval at which to perform health checks (e.g., 30s, 1m, 5m). |
1m |
HEALTHCHECK_ABORT_BOOT_ON_FAILURE |
If true, the application will exit if the initial health check fails. |
false |
PROMETHEUS_ENABLED |
If true, exposes a /metrics endpoint for Prometheus. |
true |
PROMETHEUS_LISTEN_ADDRESS |
The address and port for the Prometheus metrics server. | 127.0.0.1:3201 |
To run the application directly from the source code, you can use the go run command.
# Set the required environment variables
export LIVEKIT_HOST="ws://your-livekit-host:7880"
export LIVEKIT_API_KEY="your-api-key"
export LIVEKIT_API_SECRET="your-api-secret"
# Run the application
go run .The application can also be run as a Docker container.
-
Build the Docker image:
Build the image:
docker build -t livekit-healthcheck . -
Run the Docker container:
Run the container, passing the configuration as environment variables.
docker run --rm -it \ -e LIVEKIT_HOST="ws://your-livekit-host:7880" \ -e LIVEKIT_API_KEY="your-api-key" \ -e LIVEKIT_API_SECRET="your-api-secret" \ -e HEALTHCHECK_INTERVAL="30s" \ --network="host" \ livekit-healthcheck