Barazo Docker Compose templates for self-hosting barazo.forum

feat(global): add global aggregator Docker Compose override (#5)

Override file that layers on docker-compose.yml to configure global
aggregator mode: COMMUNITY_MODE=global, PostgreSQL tuning for larger
datasets, and higher resource limits on all services. README updated
with production deployment guide, headless API instructions, and
global aggregator section.

authored by

Guido X Jansen and committed by
GitHub
822ce89d 7fe67899

+122 -3
+78 -3
README.md
··· 25 25 | Profile | Use Case | File | Status | 26 26 |---------|----------|------|--------| 27 27 | **Development** | Local dev (infrastructure only) | `docker-compose.dev.yml` | Available | 28 - | **Single Forum** | One community, production | `docker-compose.yml` | Planned | 29 - | **Global Aggregator** | Cross-community aggregator | `docker-compose.global.yml` | Planned | 28 + | **Single Forum** | One community, production | `docker-compose.yml` | Available | 29 + | **Global Aggregator** | Cross-community aggregator | `docker-compose.global.yml` | Available | 30 30 31 31 --- 32 32 ··· 171 171 172 172 ## Production Deployment 173 173 174 - Production Docker Compose with Caddy SSL, two-network segmentation, and health checks will be added in a future release. 174 + Deploy a single Barazo community with automatic SSL via Caddy. 175 + 176 + ### Quick Start (Production) 177 + 178 + ```bash 179 + git clone https://github.com/barazo-forum/barazo-deploy.git 180 + cd barazo-deploy 181 + 182 + # Configure 183 + cp .env.example .env 184 + nano .env # Set domain, passwords, community DID, etc. 185 + 186 + # Start 187 + docker compose up -d 188 + 189 + # Verify 190 + docker compose ps # All services should be "healthy" 191 + docker compose logs -f # Watch startup logs 192 + ``` 193 + 194 + Your forum will be available at `https://your-domain.com` once Caddy obtains the SSL certificate (automatic via Let's Encrypt). 195 + 196 + ### Production Services 197 + 198 + | Service | Image | Network | Purpose | 199 + |---------|-------|---------|---------| 200 + | **caddy** | `caddy:2-alpine` | frontend | Reverse proxy, automatic SSL (only exposed service: ports 80, 443) | 201 + | **barazo-api** | `ghcr.io/barazo-forum/barazo-api` | frontend + backend | AppView backend (Fastify, REST API, firehose indexing) | 202 + | **barazo-web** | `ghcr.io/barazo-forum/barazo-web` | frontend | Next.js frontend | 203 + | **postgres** | `pgvector/pgvector:pg16` | backend | PostgreSQL 16 with pgvector | 204 + | **valkey** | `valkey/valkey:8-alpine` | backend | Redis-compatible cache | 205 + | **tap** | `ghcr.io/bluesky-social/indigo/tap` | backend | AT Protocol firehose consumer | 206 + 207 + Two-network segmentation: PostgreSQL and Valkey are on the `backend` network only, unreachable from Caddy or the frontend. 208 + 209 + ### Headless API (No Frontend) 210 + 211 + To run without the frontend container (e.g., custom frontend or API-only access): 212 + 213 + ```bash 214 + docker compose up -d postgres valkey tap caddy barazo-api 215 + ``` 216 + 217 + Update the Caddyfile to remove or adjust the frontend route as needed. 218 + 219 + --- 220 + 221 + ## Global Aggregator 222 + 223 + The global aggregator indexes **all** Barazo communities across the AT Protocol network. It uses the same codebase as a single community but with different configuration and higher resource allocation. 224 + 225 + ### Differences from Single Community 226 + 227 + | Aspect | Single Community | Global Aggregator | 228 + |--------|-----------------|-------------------| 229 + | `COMMUNITY_MODE` | `single` | `global` | 230 + | Indexes | One community's records | All `forum.barazo.*` records network-wide | 231 + | Features | Standard forum | Cross-community search, reputation aggregation | 232 + | PostgreSQL | 1 GB RAM | 4 GB RAM (more data) | 233 + | API | 1 GB RAM | 2 GB RAM (more indexing) | 234 + | Minimum server | 2 vCPU / 4 GB RAM | 4 vCPU / 8 GB RAM | 235 + 236 + ### Quick Start (Global Aggregator) 237 + 238 + ```bash 239 + cp .env.example .env 240 + nano .env # Set COMMUNITY_MODE=global, domain, passwords 241 + 242 + # Start with the global override 243 + docker compose -f docker-compose.yml -f docker-compose.global.yml up -d 244 + ``` 245 + 246 + The global override file (`docker-compose.global.yml`) layers on top of the production compose to: 247 + - Set `COMMUNITY_MODE=global` on the API 248 + - Apply PostgreSQL performance tuning (`shared_buffers`, `effective_cache_size`, `work_mem`) 249 + - Set higher memory and CPU limits on all services 175 250 176 251 ### Minimum Requirements 177 252
+44
docker-compose.global.yml
··· 1 + # Barazo Global Aggregator -- Docker Compose Override 2 + # 3 + # Extends docker-compose.yml for global aggregator mode. 4 + # The aggregator indexes ALL Barazo communities across the network. 5 + # 6 + # Usage: 7 + # cp .env.example .env 8 + # # Edit .env: set COMMUNITY_MODE=global, increase resource allocation 9 + # docker compose -f docker-compose.yml -f docker-compose.global.yml up -d 10 + # 11 + # Minimum requirements: 4 vCPU, 8 GB RAM, 100 GB SSD 12 + # See README.md "Global Aggregator" section for details. 13 + 14 + services: 15 + # Override API to global mode 16 + barazo-api: 17 + environment: 18 + COMMUNITY_MODE: global 19 + # Higher resource limits for indexing all communities 20 + mem_limit: 2g 21 + cpus: 2.0 22 + 23 + # Larger database for cross-community data 24 + postgres: 25 + mem_limit: 4g 26 + cpus: 2.0 27 + # Tune PostgreSQL for higher load 28 + command: > 29 + postgres 30 + -c shared_buffers=1GB 31 + -c effective_cache_size=3GB 32 + -c work_mem=16MB 33 + -c maintenance_work_mem=256MB 34 + -c max_connections=200 35 + 36 + # Larger cache for cross-community queries 37 + valkey: 38 + mem_limit: 1g 39 + cpus: 0.5 40 + 41 + # Tap handles full network firehose (higher resource usage) 42 + tap: 43 + mem_limit: 1g 44 + cpus: 1.0