# configuration | variable | default | description | |---|---|---| | `RELAY_PORT` | `3000` | firehose + API port | | `RELAY_METRICS_PORT` | `3001` | prometheus metrics port | | `RELAY_UPSTREAM` | `bsky.network` | bootstrap relay for initial host list (set to `""` or `"none"` to disable) | | `RELAY_DATA_DIR` | `data/events` | event log storage | | `RELAY_RETENTION_HOURS` | `72` | replay window on disk. size the replay window from measured disk growth; a short window reduces storage requirements | | `RELAY_MAX_EVENTS_GB` | `100` | byte cap on the event dir (GiB), enforced every GC tick. overflow backstop; the effective replay window can be shorter when this cap is reached | | `COLLECTION_INDEX_DIR` | `data/collection-index` | collection index path | | `DATABASE_URL` | — | PostgreSQL connection string | | `RELAY_ADMIN_PASSWORD` | — | bearer token for admin endpoints | | `RELAY_INGEST_STALL_ENABLED` | `1` | `/_healthz` returns 503 on a process-wide ingest stall; `0` disables. runtime-settable via `/admin/ingest-stall` | | `RELAY_INGEST_STALL_THRESHOLD_FPS` | `50` | ingest rate below which the process counts as stalled | | `RELAY_INGEST_STALL_WINDOW_SEC` | `900` | how long ingest must stay below the threshold before `/_healthz` flips | | `RELAY_INGEST_STALL_STARTUP_GRACE_SEC` | `900` | no stall verdict this long after start (cold-start spawn + backfill) | | `RELAY_WS_PING_ENABLED` | `1` | keepalive-ping upstream connections to detect half-open TCP; `0` disables. runtime-settable via `/admin/ws-ping` | | `RELAY_WS_PING_INTERVAL_SEC` | `30` | ping a connection after this much silence | | `RELAY_WS_PING_MAX_FAILURES` | `4` | reconnect after this many consecutive unanswered pings | | `RESOLVER_THREADS` | `4` | background DID resolution threads | | `FRAME_WORKERS` | `16` | frame processing pool worker count | | `FRAME_QUEUE_CAPACITY` | `4096` | max queued frames before backpressure | | `VALIDATOR_CACHE_SIZE` | `250000` | max cached signing keys before eviction | see [docs/operations/deployment.md](deployment.md) for production deployment and [docs/operations/backfill.md](backfill.md) for collection index backfill. The collection index in this source uses zkv. The relay refuses to open a RocksDB directory: use a distinct path and rebuild the index. PostgreSQL and event-log storage remain separate. `ZKV_TABLE_ENCODING=legacy` is the default; `grouped` is opt-in. See `src/main.zig` for profile and replay switches. Configuration defaults are source defaults, not a statement of the currently deployed production configuration. `RELAY_INDEX_PROFILE=default` uses the default owner policy. `bounded` enables the tested bounded maintenance and page-worker policy; the live paired results used this explicit setting. Neither profile selects grouped encoding automatically.