Prefect Server and UI

Prefect's Server, Database and UI

The server is one Python process that serves the REST API, the UI and the event system and runs the background services: the scheduler that turns schedules into runs, services that mark late runs and offline workers, and the trigger engine behind automations. It stores everything in a database: SQLite 4,756 in ~/.prefect by default, PostgreSQL 1,289 for anything shared. Running several servers additionally needs Redis 2,763 as the event broker and prefect server services start as a separate process. BookNest's stack is three containers:

docker-compose.yaml (excerpt): Prefect's server and its databaseYAML
  server:
    image: prefecthq/prefect:3.8.7-python3.13
    container_name: l2-prefect-server
    command: prefect server start --host 0.0.0.0 --port 4200
    environment:
      PREFECT_SERVER_DATABASE_CONNECTION_URL: postgresql+asyncpg://prefect:prefect@db/prefect
      PREFECT_UI_API_URL: http://localhost:32420/api       # what the browser calls
      PREFECT_SERVER_ANALYTICS_ENABLED: "false"
    ports: ["32420:4200"]

After four runs the database had created its 36 tables and held what the UI shows; the three containers together used about 410 MiB:

Output of 40
flow_run|5
task_run|22
log|83
events|125
deployment|1
l2-prefect-server 2.89% 193.6MiB / 31.28GiB
l2-prefect-worker 0.00% 100.8MiB / 31.28GiB
l2-prefect-db 1.32% 114.4MiB / 31.28GiB

Prefect 74,615 's state model shows in task_run.run_count: the load task that exhausted its retries has a run count of 3, the one that recovered 2. Every state change is also an event (prefect.flow-run.Running, and so on), which feeds the UI's event feed and the automations of Scheduling Compared. The UI defaults to a dark theme; the screenshots here switch it to light. A flow moves between this server and the hosted Prefect Cloud by changing PREFECT_API_URL.