Chalama Reddy
03/02/2026, 11:31 AMMarvin
03/02/2026, 11:31 AMMarvin
03/02/2026, 11:33 AMexport PREFECT_API_DATABASE_CONNECTION_URL="<postgresql+asyncpg://user:pass@db/prefect>"
export PREFECT_SERVER_API_HOST="0.0.0.0"
export PREFECT_SERVER_API_PORT="4200"
export PREFECT_UI_API_URL="<https://prefect.example.com/api>"
# no PREFECT_SERVER_DOCKET_URL needed here
Background services (use Docket; Redis strongly recommended for multi-server):
export PREFECT_API_DATABASE_CONNECTION_URL="<postgresql+asyncpg://user:pass@db/prefect>"
export PREFECT_SERVER_DOCKET_URL="<redis://redis:6379/1>"
References
- Docket settings in source: ServerDocketSettings (defines PREFECT_SERVER_DOCKET_URL)
- UI API URL setting: Server UI settings (PREFECT_UI_API_URL)
- API settings (client URL and server binding): API settings
- Self-hosting architecture (multi-server vs single-server): Self-hosted guide
If you can share whether you’re running an all-in-one node or separate API + services, I can suggest the exact env set you need.Chalama Reddy
03/02/2026, 11:36 AMChalama Reddy
03/02/2026, 11:41 AMMarvin
03/02/2026, 11:41 AMMarvin
03/02/2026, 11:42 AM# Database
PREFECT_API_DATABASE_CONNECTION_URL=<postgresql+asyncpg://user:pass@db/prefect>
# Bind and UI
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_API_PORT=4200
PREFECT_UI_API_URL=<https://your.public.prefect/api>
# Do NOT set PREFECT_SERVER_DOCKET_URL here
Background services (use Docket via Redis):
# Same database as API
PREFECT_API_DATABASE_CONNECTION_URL=<postgresql+asyncpg://user:pass@db/prefect>
# Docket (coordination)
PREFECT_SERVER_DOCKET_URL=<redis://redis-host:6379/1>
# or: rediss://... for TLS, include auth if needed
Notes
- Docket is distinct from any Redis you may use for messaging/events; those have separate env vars. Using Redis for messaging does not automatically configure Docket — you still set PREFECT_SERVER_DOCKET_URL for the services.
- It’s fine (and common) to use Redis-backed Docket even if you currently run a single services process; it keeps you ready to scale.
CLI references
- Server (API) start (no Docket option): run prefect server start --help
- Background services: prefect server services start --help
Source links
- ServerDocketSettings (PREFECT_SERVER_DOCKET_URL)
- Server UI settings (PREFECT_UI_API_URL)
- Self-hosted guide (multi-server vs. services)
If you plan to run multiple replicas of the background services, make sure all replicas share the same PREFECT_SERVER_DOCKET_URL and Redis is reachable from each. Want me to review your compose/k8s manifests to double-check the env splits?Chalama Reddy
03/02/2026, 11:54 AMChalama Reddy
03/02/2026, 12:03 PMMarvin
03/02/2026, 12:04 PMMarvin
03/02/2026, 12:06 PM# Required: install the integration
pip install prefect-redis
# Events/messaging stack (real-time updates, automations, etc.)
PREFECT_SERVER_EVENTS_MESSAGING_BROKER=prefect_redis.messaging
PREFECT_SERVER_EVENTS_MESSAGING_CACHE=prefect_redis.messaging
PREFECT_SERVER_EVENTS_CAUSAL_ORDERING=prefect_redis.ordering
# Deployment concurrency limits (lease storage)
PREFECT_SERVER_CONCURRENCY_LEASE_STORAGE=prefect_redis.lease_storage
# Redis connection details used by the above
PREFECT_REDIS_MESSAGING_HOST=redis-host
PREFECT_REDIS_MESSAGING_PORT=6379
PREFECT_REDIS_MESSAGING_DB=0
# If auth is required:
PREFECT_REDIS_MESSAGING_USERNAME=prefect_user
PREFECT_REDIS_MESSAGING_PASSWORD=****
# If TLS is required:
PREFECT_REDIS_MESSAGING_SSL=true
Notes
- Use a different Redis DB (or separate Redis instance) for Docket on the background services to avoid key collisions (e.g., messaging on DB 0; Docket on DB 1).
- Background services should also use the same messaging/ordering/lease storage settings as the API so events and concurrency are consistent across components, plus set PREFECT_SERVER_DOCKET_URL for the services only.
- If you run multiple API server replicas, apply the same settings on each.
Example split deployment (API only)
PREFECT_API_DATABASE_CONNECTION_URL=<postgresql+asyncpg://user:pass@postgres:5432/prefect>
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_API_PORT=4200
# Redis-backed events + concurrency
PREFECT_SERVER_EVENTS_MESSAGING_BROKER=prefect_redis.messaging
PREFECT_SERVER_EVENTS_MESSAGING_CACHE=prefect_redis.messaging
PREFECT_SERVER_EVENTS_CAUSAL_ORDERING=prefect_redis.ordering
PREFECT_SERVER_CONCURRENCY_LEASE_STORAGE=prefect_redis.lease_storage
PREFECT_REDIS_MESSAGING_HOST=redis
PREFECT_REDIS_MESSAGING_DB=0
# UI points to your public API URL
PREFECT_UI_API_URL=<https://your.prefect.example.com/api>
# No Docket on the API server
# (do not set PREFECT_SERVER_DOCKET_URL here)
References
- Messaging/ordering/lease storage modules live in the Redis integration:
- prefect-redis integration (source)
- Docket setting (services only): ServerDocketSettings
- UI/API server settings: Server UI settings, API settings
- Self-hosted/multi-server overview: Self-hosted guide
If you can share your compose/k8s manifests, I can mark exactly where to add these and suggest Redis DB separation for messaging vs. Docket.Chalama Reddy
03/02/2026, 12:32 PMMarvin
03/02/2026, 12:32 PMMarvin
03/02/2026, 12:33 PM# Install the Redis integration
pip install prefect-redis
# or: pip install "prefect[redis]"
Common Redis connection settings (used by both)
# Connection details used by messaging/ordering/lease storage
PREFECT_REDIS_MESSAGING_HOST=redis-host
PREFECT_REDIS_MESSAGING_PORT=6379
PREFECT_REDIS_MESSAGING_DB=0
# If auth/TLS:
PREFECT_REDIS_MESSAGING_USERNAME=prefect_user
PREFECT_REDIS_MESSAGING_PASSWORD=****
PREFECT_REDIS_MESSAGING_SSL=false
API server (no Docket here)
# Required DB
PREFECT_API_DATABASE_CONNECTION_URL=<postgresql+asyncpg://user:pass@postgres:5432/prefect>
# Redis-backed events (real-time), ordering, and concurrency leases
PREFECT_SERVER_EVENTS_MESSAGING_BROKER=prefect_redis.messaging
PREFECT_SERVER_EVENTS_MESSAGING_CACHE=prefect_redis.messaging
PREFECT_SERVER_EVENTS_CAUSAL_ORDERING=prefect_redis.ordering
PREFECT_SERVER_CONCURRENCY_LEASE_STORAGE=prefect_redis.lease_storage
# Bind/UI (as needed)
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_API_PORT=4200
PREFECT_UI_API_URL=<https://your.public.prefect/api>
# Start API only
prefect server start --host 0.0.0.0 --port 4200 --no-services
Background services (add Docket)
# Same DB and Redis-backed components as API
PREFECT_API_DATABASE_CONNECTION_URL=<postgresql+asyncpg://user:pass@postgres:5432/prefect>
PREFECT_SERVER_EVENTS_MESSAGING_BROKER=prefect_redis.messaging
PREFECT_SERVER_EVENTS_MESSAGING_CACHE=prefect_redis.messaging
PREFECT_SERVER_EVENTS_CAUSAL_ORDERING=prefect_redis.ordering
PREFECT_SERVER_CONCURRENCY_LEASE_STORAGE=prefect_redis.lease_storage
PREFECT_REDIS_MESSAGING_HOST=redis-host
PREFECT_REDIS_MESSAGING_DB=0
# Docket (services-only; coordinates scheduler/automations)
# Use a different Redis DB/index to avoid key collisions with messaging
PREFECT_SERVER_DOCKET_URL=<redis://redis-host:6379/1>
# or rediss://... and include username:password@ if required
# Start services
prefect server services start
Best practices
- Use separate Redis DB indexes: DB 0 for messaging/order/leases, DB 1 for Docket.
- Apply the same messaging/order/lease storage settings on both API and services so events/concurrency are consistent.
- Do not set PREFECT_SERVER_DOCKET_URL on the API server.
References
- ServerDocketSettings (PREFECT_SERVER_DOCKET_URL)
- prefect-redis integration (messaging/order/lease storage)
- Self-hosted guide (split API/services)
If you share your Compose/K8s manifests, I can mark exactly where to add these and suggest DB separation per component.Chalama Reddy
03/02/2026, 5:06 PMMarvin
03/02/2026, 5:06 PMMarvin
03/02/2026, 5:09 PM/api/ui-settings) expose things like api_url, csrf_enabled, auth, and feature flags. There isn’t a Docker URL required there.
- If you’re seeing “docker” fields in the UI, they’re likely tied to deployment/worker configuration (e.g., Docker worker or image build settings), not the Server’s API settings.
When a Docker URL is needed:
- Only when using a Docker worker to execute flows in containers. In that case, you configure the worker to connect to the Docker daemon (e.g., via a DockerHost block’s base_url):
from prefect_docker import DockerHost
docker_host = DockerHost(
base_url="unix:///var/run/docker.sock" # or "<tcp://127.0.0.1:2375>"
)
Could you share a screenshot or the exact field names you’re seeing in “Server UI settings”? If you can also confirm your Prefect version, I can be more specific. If you hit your server at /api/ui-settings, the JSON there will show exactly what the server is providing to the UI.