Skip to content

Data and scale

M.R. Dula edited this page Oct 5, 2026 · 1 revision

Data and scale

Single process (default)

One opengateways serve plus SQLite at ~/.opengateway/state.db (or OPENGATEWAY_DATA_DIR) is enough for a lab, phone pair, and a small team.

Docker and Fly use a volume so state.db and files/ survive restarts. On Railway, Postgres is the system of record and the volume at /data holds blobs.

SQLite boots use WAL. A damaged database file is moved aside so the hub can start clean.

Postgres

Use Postgres when several processes must share one system of record.

export OPENGATEWAY_DATABASE_URL="postgresql://user:pass@localhost:5432/opengateway"
uv sync --extra postgres
opengateways serve --mode public --token "$OPENGATEWAY_AUTH_TOKEN"

GET /ping reports "backend": "postgres". Schema is created on first connect (same document tables as SQLite). There is no automatic SQLite migrator; start fresh or copy small datasets through the API.

Redis

export OPENGATEWAY_REDIS_URL="redis://…"

Redis fans out events and shares pair codes across workers. It does not replace Postgres or SQLite as the system of record.

Prefer one writer for SQLite. Do not put SQLite on a network filesystem and point multiple workers at it. Multi-worker production is Postgres + Redis (the Railway template).

Files

Uploads and room workspace files live under $OPENGATEWAY_DATA_DIR/files. Optional object storage: OPENGATEWAY_FILES_URL.

Canonical: docs/POSTGRES.md · docs/SCALE.md.

Clone this wiki locally