← All decisions jacob@stephens.page
Decision Record

External managed database over a containerized one

ADR 0002 · Accepted ยท in production · ~234 words

Context

The containerized per-tenant app instances (see ADR 0001) need a database. The tempting default is to drop a database service into the same compose file - one docker compose up brings up the whole world. But the database holds the only state that actually matters, and the containers around it are meant to be disposable and frequently rebuilt.

Decision

Keep the database on a dedicated, separately-managed host (a managed instance with its own backup, monitoring, and upgrade lifecycle) and point the containers at it over the network with per-tenant users, locked down per ADR 0009. The containers stay stateless and cattle; the data tier is a pet, on purpose.

Consequences

When I'd revisit

For a genuinely ephemeral environment (CI, a preview that's torn down hourly), a containerized DB seeded from a snapshot is the right call - there, losing the data is the feature.

One of a set of architecture decision records. Source markdown lives in the infrastructure-patterns repo, which is the canonical copy.