Martynas Urbanavičius
03/12/2026, 1:09 PMMarvin
03/12/2026, 1:09 PMMarvin
03/12/2026, 1:14 PMPREFECT_SERVER_DOCKET_URL=redis://<host>:6379/<db>
- Do not use the default memory:// when running multiple instances (it will duplicate work)
- Two supported patterns:
1) Recommended: Run multiple API replicas with services disabled, and run one or more dedicated background-service processes
- API replicas:
prefect server start --host 0.0.0.0 --no-services
- Background services (on one or more VMs/containers):
prefect server services start
2) Acceptable: Keep background services enabled on every API replica; with Redis-backed Docket they will still coordinate and not double-execute. The trade-off is shared CPU/memory with the API.
- For multi-instance deployments also ensure:
- A shared Postgres database via PREFECT_API_DATABASE_CONNECTION_URL
- Run DB migrations once, then set PREFECT_API_DATABASE_MIGRATE_ON_START=false on all long-lived replicas
- Helpful CLI checks:
- prefect server start --help shows --no-services
- prefect server services --help shows start, stop, and ls (list) subcommands
Docs and references
- Server concepts and self-hosting: Prefect 3 Server concepts
- Server CLI: Server CLI guide
- Settings reference (Docket): Settings reference: ServerDocketSettings
If you want, I can share a minimal docker-compose that runs multiple API replicas plus one or more background-service containers using Redis-backed Docket.