Skip to content

Database

Broch requires PostgreSQL. You can run it embedded alongside Broch or use an external managed database.

PostgreSQL runs as a sidecar container alongside Broch. No separate database infrastructure to manage.

Available on: Docker Compose, Azure (sidecar), DigitalOcean
Not available on: AWS (always uses RDS)

When to use: Development, evaluation, small teams, or deployments where you control the host and accept the limitations below.

  • No encryption at rest. Data is stored unencrypted on the host volume. If your compliance posture requires encryption at rest (SOC 2, HIPAA, GDPR), use an external managed database instead. See the Security and Compliance page for details.
  • No high availability. Single instance — if the host goes down, Broch is unavailable.
  • Single-instance scaling only. Horizontal scaling (multiple Broch replicas) requires a shared external database. If you ever need more than one replica, you will need to migrate to an external database.
  • Backup is your responsibility. See the backup section in each platform’s installation guide.

You provision and manage a PostgreSQL database (or use a managed service), and point Broch at it via a connection string.

When to use: Production deployments, compliance requirements, multi-replica setups, or any case where the embedded limitations are unacceptable.

PlatformRecommended option
AzureAzure Database for PostgreSQL Flexible Server
AWSAmazon RDS for PostgreSQL
DigitalOceanDigitalOcean Managed Databases
Any Linux hostAny PostgreSQL 14+ instance

Set the connection string via environment variable:

ConnectionStrings__DefaultConnection=Host=your-db-host;Database=broch;Username=broch;Password=yourpassword

For the Docker Compose deployment, use the docker-compose.external-db.yml override to remove the embedded PostgreSQL service:

Terminal window
docker compose -f docker-compose.yml -f docker-compose.external-db.yml up -d

To run multiple Broch replicas (for capacity or availability), all replicas must share a single external PostgreSQL database. Each replica maintains its own in-memory tunnel state — tunnels are not shared across replicas. Load balancers should use sticky sessions or a consistent-hash routing strategy so that requests to a given tunnel URL always reach the replica that holds that tunnel’s connection.