Skip to main content

08 — Data, storage and secrets

Data, secrets and keys

PostgreSQL​

Two physical roles of Postgres, same major version:

ClusterHostsWhy separate
Core (core-infra)Zitadel DB, control-plane schema, Infisical DB, Pulumi state, pg-bossLow, predictable load; strict HA/PITR; isolated from tenant spikes
Tenant data pool (tenant-data-pool)meet_<slug> databases, N shardsBursty; hard DB boundary per tenant; blast radius = one shard

Core conventions (kept from AGENTS.md)​

One database (platform), one schema and role per product: NN_init_<product>.sh idempotent scripts, search_path per role, default privileges. Existing scripts: 01_init_platform, 02_init_meet (meet — will move to the tenant pool), 03_init_keycloak (deprecated), 04_init_zitadel (dedicated database per Zitadel's DSN).

Planned additions: 05_init_control_plane.sh (schema control_plane), 06_init_infisical.sh, 07_init_pulumi_state.sh (Pulumi's Postgres backend uses its own table/DB). The same copy-adapt-run-manually procedure applies; Postgres only runs init scripts on an empty data directory.

Tenant pool conventions​

  • CREATE DATABASE meet_<slug> OWNER meet_<slug>_app; revoke PUBLIC connect, grant only the app role. Extensions pre-created by superuser as in 02_init_meet.sh (e.g. pg_trgm, needed by migration core.0002).
  • PgBouncer, transaction pooling; go-meet max_open_conns=3, max_idle_conns=1.
  • go-meet migrations (sql/migrations, currently through 000013) run per tenant by the provisioner and on rollout, bounded concurrency, with schema_version tracked in the registry.
  • TLS required (sslmode=require); credentials from Infisical.

Object storage (RustFS)​

  • Bucket per tenant, key prefixes recordings/, transcripts/, later files/, chat-media/. Never a shared bucket with tenant prefixes: a path bug must not cross tenants.
  • Scoped access key per tenant limited by policy to that bucket. Used by go-meet for presign and by Egress per request. The RustFS root credential exists only in the provisioner's secret scope.
  • Lifecycle rules at provisioning: expire recordings/ after the tenant's retention (default 30 days, configurable 7–90), abort incomplete multipart uploads after 2 days.
  • Presigned URLs only (15 minutes); no public buckets; direct browser ↔ RustFS transfers so the API tier never proxies media.
  • Encryption at rest: RustFS supports SSE-S3 (AES256), SSE-C and SSE-KMS. Per its docs, SSE-S3/SSE-KMS require a working KMS configuration and a provisioned key; setting a bucket default alone does not make writes succeed. The documented KMS backends are local, Vault KV2 and Vault Transit. Infisical is not a documented RustFS KMS backend, contrary to the discussion. Plan: start with SSE-S3 using the local KMS key held in /platform/rustfs; evaluate OpenBao/Vault Transit for per-tenant keys (Q-07). Downloads are transparently decrypted by RustFS on authorized reads.

Redis​

InstanceUsed byNotes
Core Redis (shared)LiveKit node/room routing, CP cacheAuth + TLS; LiveKit's TLS settings injected by sed placeholders as in livekit-server.yaml
Tenant Redisgo-meet sessions, lobby, room-creation callbacks, throttlingOne container per tenant, requirepass, TTL-bound data; required in production (in-memory store is mock/test only)

Secrets (Infisical, shared — D2)​

Layout​

/platform/zitadel masterkey, login-client PAT (bootstrap)
/platform/livekit API key/secret (broker only)
/platform/pulumi secrets-provider key
/platform/coolify API token (worker only)
/platform/rustfs root creds, SSE key
/platform/backup backup key escrow
/tenants/<slug>/meet OIDC client, service-account key, DB URL,
S3 scoped key, webhook signing secret, session keys
/tenants/<slug>/chat Tuwunel config, appservice tokens

Access model​

IdentityReadsWrites
CP workerall of /platform/* it needs, /tenants/* (provisioning)/tenants/*
CP broker/platform/livekit only—
Tenant stack <slug>-stack/tenants/<slug>/*—
Humansbreak-glass only, auditedvia change process

Distribution​

Coolify holds only the stack's Infisical machine-identity credentials (and non-secret config). The container entrypoint runs infisical run --path /tenants/<slug>/meet -- go-meet, so real secrets never persist in Coolify's database. Rotation = write new version → restart stack → revoke old.

Infisical depends on Postgres and Redis; running it on the shared core instances is intended. Keep its ENCRYPTION_KEY/auth secret in the host secret store with an offline escrow copy: losing it means losing every secret.

Application-level encryption already in go-meet​

  • OIDC refresh tokens stored in Redis sessions are Fernet-encrypted with OIDC_STORE_REFRESH_TOKEN_KEY (changing the key invalidates those sessions by design).
  • Session cookie: HttpOnly, Secure, SameSite=Lax.

Backups​

DataMethodWhereRetention
Tenant DBpg_dump -Fc per DB, nightly + before migrationsSeparate bucket/host, encrypted (age, per-tenant key)14–30 days
Core DBPITR (WAL archiving)Separate target7–14 days + weekly full
TuwunelVolume snapshot / supported backup, quiescedSeparate target, encrypted14 days
RustFSNot replicated by default (recordings are lifecycle-bound)——
InfisicalDB backup + ENCRYPTION_KEY escrowSeparate target30 days

Restore drills: quarterly, per backup class, with timing recorded. Tenant erasure destroys that tenant's backup key (crypto-erase), so backups outside retention need no scrubbing.

Retention defaults (configurable per tenant)​

ArtifactDefault
Recordings (audio/video)30 days
Transcripts / summaries12 months (or until tenant deletes)
Chat messagesuntil tenant policy / deletion
Meeting metadata24 months
Audit log (ids only)24 months