Omar Faruk
03/24/2025, 9:06 AMMarvin
03/24/2025, 9:06 AMyaml
version: '3.8'
services:
prefect-server:
image: prefecthq/prefect:3.2.14-python3.10
ports:
- "4200:4200"
healthcheck:
test: ["CMD", "curl", "-f", "<http://localhost:4200/api/health>"]
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
### Explanation:
- test: This uses curl
to check if the Prefect server's API is responding. Adjust the URL to match your server's actual API endpoint.
- interval: How often to perform the healthcheck.
- timeout: The time to wait for a response before considering the healthcheck to have failed.
- retries: The number of consecutive failures needed to consider the container unhealthy.
- start_period: The time to wait before starting the healthchecks after the container starts.
For more advanced healthcheck setups, you might consider integrating a Prefect flow to perform the healthcheck logic, as demonstrated in this example code.
For more information about self-hosting Prefect, refer to the Prefect server documentation.