Barazo Docker Compose templates for self-hosting barazo.forum

fix(deploy): prune unused Docker images after deploy and add log rotation (#59)

After each staging deploy, run `docker image prune -f` to remove dangling
images left behind by the previous pull. Without this, every deploy
accumulates ~800MB of unreferenced layers, eventually filling the VPS disk
(as happened with 146 images consuming 29GB on a 38GB disk).

Add json-file log rotation (10MB x 3 files) to all services via a shared
x-logging anchor. Docker's default json-file driver has no size limit,
so container logs can grow unbounded on long-running instances.

authored by

Guido X Jansen and committed by
GitHub
742e6547 38a2c9d9

+15
+3
.github/workflows/deploy-staging.yml
··· 221 221 echo "Starting containers..." 222 222 docker compose ${{ env.COMPOSE_FILES }} up -d 223 223 224 + echo "Pruning unused images..." 225 + docker image prune -f 226 + 224 227 echo "Deploy complete at $(date -u '+%Y-%m-%dT%H:%M:%SZ')" 225 228 226 229 # ----------------------------------------------------------------------
+12
docker-compose.yml
··· 10 10 # 11 11 # Startup order: postgres -> valkey -> tap -> barazo-api -> barazo-web -> caddy 12 12 13 + x-logging: &default-logging 14 + driver: json-file 15 + options: 16 + max-size: "10m" 17 + max-file: "3" 18 + 13 19 services: 14 20 # --------------------------------------------------------------------------- 15 21 # PostgreSQL 16 with pgvector (full-text + optional semantic search) ··· 17 23 postgres: 18 24 image: pgvector/pgvector:pg16 19 25 restart: unless-stopped 26 + logging: *default-logging 20 27 environment: 21 28 POSTGRES_USER: ${POSTGRES_USER} 22 29 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} ··· 40 47 valkey: 41 48 image: valkey/valkey:9-alpine 42 49 restart: unless-stopped 50 + logging: *default-logging 43 51 command: > 44 52 valkey-server 45 53 --requirepass ${VALKEY_PASSWORD} ··· 68 76 image: ghcr.io/bluesky-social/indigo/tap:latest 69 77 platform: linux/amd64 70 78 restart: unless-stopped 79 + logging: *default-logging 71 80 environment: 72 81 TAP_RELAY_URL: ${RELAY_URL:-https://bsky.network} 73 82 TAP_SIGNAL_COLLECTION: forum.barazo.topic.post ··· 88 97 barazo-api: 89 98 image: ghcr.io/barazo-forum/barazo-api:${BARAZO_API_VERSION:-latest} 90 99 restart: unless-stopped 100 + logging: *default-logging 91 101 environment: 92 102 NODE_ENV: production 93 103 DATABASE_URL: ${DATABASE_URL} ··· 137 147 barazo-web: 138 148 image: ghcr.io/barazo-forum/barazo-web:${BARAZO_WEB_VERSION:-latest} 139 149 restart: unless-stopped 150 + logging: *default-logging 140 151 environment: 141 152 NODE_ENV: production 142 153 API_INTERNAL_URL: http://barazo-api:3000 ··· 162 173 caddy: 163 174 image: caddy:2-alpine 164 175 restart: unless-stopped 176 + logging: *default-logging 165 177 environment: 166 178 COMMUNITY_DOMAIN: ${COMMUNITY_DOMAIN} 167 179 ports: