PostgreSQL configuration
A fresh deployment can validate PostgreSQL, persist the choice and initialize the system schema. PostgreSQL is available once the connection validates and the schema initializes.
Dashboard flow
- Start a fresh Trestle instance on loopback.
- Choose PostgreSQL in First-run setup.
- Enter a TLS-protected connection URL and select Test and use database.
- Trestle verifies the server without returning the URL.
- Restart when prompted; Trestle initializes the PostgreSQL schema and returns to administrator setup.
Interrupted setup is resumable: the provider choice persists before restart, administrator creation stays available until one administrator commits, and setup never reopens afterward.
Headless flow
export TRESTLE_DATABASE_PROVIDER=postgres
export TRESTLE_DATABASE_URL='postgres://trestle:secret@db.internal/trestle?sslmode=verify-full'
./trestleExplicit startup configuration takes precedence and makes browser database controls read-only.
Pool and connection controls
| Setting | Default | Boundary |
|---|---|---|
| Maximum open | 10 | 1-500 |
| Maximum idle | 2 | 0 to maximum open |
| Connect timeout | 10s | Whole seconds, more than zero, at most 1m |
| Connection lifetime | 30m | 0 to 24h |
The connect timeout is injected as the driver's connect_timeout into every PostgreSQL connection configuration, including the first-run connection test, so a silently unreachable server cannot stall startup or setup indefinitely. It must be a whole number of seconds because the driver cannot represent sub-second precision; Trestle rejects such values rather than rounding them.
TLS and secrets
Remote connections cannot use sslmode=disable. Stored setup state is atomically replaced at mode 0600; URLs are not returned by APIs or included in diagnostics. Prefer an operator secret manager for production.