Deployments
BigBrotr ships with two deployment configurations that demonstrate different use cases. Both use the same codebase and all six services.
Deployment Structure
Section titled “Deployment Structure”deployments/├── Dockerfile # Shared parametric Dockerfile├── bigbrotr/ # Full deployment│ ├── docker-compose.yaml│ ├── .env.example│ ├── config/│ │ ├── brotr.yaml│ │ └── services/*.yaml│ ├── postgres/│ │ └── init/*.sql # 10 SQL files, 25 stored functions│ ├── pgbouncer/│ │ └── pgbouncer.ini│ └── monitoring/│ ├── prometheus/│ └── grafana/└── lilbrotr/ # Lightweight deployment ├── docker-compose.yaml ├── .env.example ├── config/ ├── postgres/ ├── pgbouncer/ └── monitoring/BigBrotr
Section titled “BigBrotr”The full deployment for comprehensive Nostr network observation.
- All six services with full configuration
- All 11 materialized views
- PostgreSQL with PgBouncer (transaction mode)
- Prometheus metrics collection with 6 alert rules
- Grafana dashboards with service overview
- Docker Compose with resource limits and health checks
- Two Docker networks:
data(services + database) andmonitoring
Docker Compose Services
Section titled “Docker Compose Services”| Service | Image | Purpose |
|---|---|---|
postgres | PostgreSQL 16 | Database with schema initialization |
pgbouncer | PgBouncer | Connection pooling (transaction mode) |
prometheus | Prometheus | Metrics collection and alerting |
grafana | Grafana | Monitoring dashboards |
PgBouncer Configuration
Section titled “PgBouncer Configuration”Two connection pools:
| Pool | Users | Pool Size | Purpose |
|---|---|---|---|
bigbrotr | writer | 10 | All six services |
bigbrotr_readonly | reader | 8 | API, DVM, monitoring |
LilBrotr
Section titled “LilBrotr”A lightweight deployment with the same architecture, demonstrating BigBrotr’s customizability.
- Same six services and all 11 materialized views
- Smaller batch sizes and longer sleep intervals
- Lower resource limits
- Same monitoring stack
The key difference is configuration tuning, not code changes. LilBrotr processes less data per cycle but uses the same codebase.
Parametric Dockerfile
Section titled “Parametric Dockerfile”Both deployments share a single Dockerfile:
ARG DEPLOYMENT# ... builds for the specified deploymentBuild with:
docker build --build-arg DEPLOYMENT=bigbrotr -t bigbrotr .docker build --build-arg DEPLOYMENT=lilbrotr -t lilbrotr .Environment Variables
Section titled “Environment Variables”Both deployments use .env files for secrets and runtime configuration:
| Variable | Description |
|---|---|
POSTGRES_USER | PostgreSQL superuser |
POSTGRES_PASSWORD | Superuser password |
POSTGRES_DB | Database name |
WRITER_USER | Writer services user |
WRITER_PASSWORD | Writer password |
READER_USER | Read-only user |
READER_PASSWORD | Reader password |
NOSTR_PRIVATE_KEY | Monitor event publishing key (optional) |
Creating Your Own Deployment
Section titled “Creating Your Own Deployment”To create a custom deployment:
- Copy an existing deployment directory.
- Modify
config/brotr.yamlfor your database settings. - Adjust
config/services/*.yamlfor your batch sizes and intervals. - Update
.env.examplewith your database name and credentials. - Modify
pgbouncer/pgbouncer.iniwith your pool names. - Build with
--build-arg DEPLOYMENT=yourdeployment.
Next Steps
Section titled “Next Steps”- Quick Start — get a deployment running.
- Core Configuration — detailed config parameters.