FLEET_STORAGE_* variables. PostgreSQL keeps only their object keys. See the configuration reference.
Prerequisites
- An existing PostgreSQL database reachable from the Fleet host. Fleet creates its tables, but not the database.
- Fleet RLM installed with
uv sync --dev - Daytona and model credentials configured as in the quickstart
Point Fleet at PostgreSQL
SetFLEET_DATABASE_URL in .env to a regular PostgreSQL DSN that includes the role’s credentials. Without it, Fleet uses postgresql://postgres:postgres@localhost:5432/fleet. With Neon, use the direct endpoint over TLS, not the pooler endpoint:
.env
fleet schema by default. Set FLEET_DATABASE_SCHEMA or storage.database_schema to use another one. The schema name must be a lowercase PostgreSQL identifier.
Schema migrations
Fleet applies its schema when the API server starts. It takes a transaction-scoped advisory lock, reads theschema_migrations ledger, and applies each pending numbered migration once. You don’t run a separate migration command. The current schema version is 2.
When Fleet finds the old fleet_lite_schema_migrations ledger, it renames it to schema_migrations first. Migration 2 then changes an existing version 1 schema in place:
- It renames the
fleet_lite_*tables tosessions,sandbox_resources,turns,notes(wasfleet_lite_memories),replay_blobs,replay_snapshots,review_labels,leases,global_settings, andjobs(wasfleet_lite_optimization_runs). - It adds the chat persistence tables
messages,files,message_files, andworkspace_files, and fillsmessagesfrom the stored Turns.
FLEET_DATABASE_MIGRATION_URL. It must point at the same host, port, and database as FLEET_DATABASE_URL. Fleet closes the migration connection once startup migrations finish.
If the database already has a newer schema than your Fleet version, startup fails with Database schema version <n> is newer than this Fleet version <m>. Upgrade Fleet instead of downgrading the database.
To test a release without touching a shared database, point it at a separate schema with FLEET_DATABASE_SCHEMA (or storage.database_schema). Fleet creates the schema if it doesn’t exist and applies every migration inside it. Drop the schema when you’re done.
Don’t reopen Sessions from an old schema by ID against the same Daytona Volume. Fleet marks a Session it creates as having an empty workspace from the database alone, without listing the Volume. A Direct Turn that skips the sandbox would then miss the files already on the Volume.
Connection handling
Fleet uses one connection pool for all queries.- Fleet recycles pooled connections after 40 minutes and closes surplus connections idle for more than 10 minutes.
- Fleet checks each connection when it takes it from the pool, so it never hands out a connection the server closed while idle.
- A query that fails with a connection error is retried once. Writes are safe to retry: storing a Turn is conditional on its Turn ID, so a retry can’t store it twice.
sandbox_resources. A new owner reconciles those records with Daytona before it accepts writable work.
Replay storage
Fleet stores the file contents of selected replay snapshots inreplay_blobs, keyed by SHA-256. Files that don’t change between Turns are stored once. When Fleet opens the database at startup, it deletes replay snapshots older than 30 days that have no review label, then removes blobs that no snapshot references. Each startup removes at most 500 snapshots and 500 blobs. Labelled snapshots stay. Expiry runs only at startup, so an unlabelled snapshot can outlive 30 days while Fleet is stopped.
Run the API server
127.0.0.1:8000 by default ([server]). An invalid --port fails with fleet: error: invalid configuration instead of falling back to the default.
fleet serve needs a reachable MLflow server. With the default local backend, start one with fleet cli or run your own on port 5001. See Observability.
Health check
GET /health returns 200 with status: "ok", the Fleet version, and an mlflow object describing the initialized MLflow destination. mlflow.ready is true once Fleet has initialized its runtime experiment.
Upgrade
- Stop Fleet.
- Pull the new release and run
uv sync --dev. - Back up the database and review the schema migrations the new release applies.
- When you upgrade from Fleet RLM 0.12.0 or earlier to 0.13.0, select a new schema or database and a new Daytona Volume first.
- Start Fleet. It applies any new schema migrations at startup.