A community based topic aggregation platform built on atproto
1# Coves Production Stack 2# 3# Architecture: 4# - coves.social: AppView domain (API, frontend, .well-known/did.json) 5# - coves.me: PDS domain (must be separate from AppView) 6# 7# Hardware: AMD Epyc 7351p (16c/32t), 256GB RAM, 2x500GB NVMe RAID 8# 9# Usage: 10# docker-compose -f docker-compose.prod.yml up -d 11# 12# Prerequisites: 13# 1. DNS configured for both domains 14# 2. SSL certificates (Caddy handles this automatically) 15# 3. .env.prod file with secrets 16# 4. .well-known/did.json deployed to coves.social 17 18services: 19 # PostgreSQL Database for AppView 20 postgres: 21 image: postgres:15 22 container_name: coves-prod-postgres 23 restart: unless-stopped 24 environment: 25 POSTGRES_DB: ${POSTGRES_DB} 26 POSTGRES_USER: ${POSTGRES_USER} 27 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} 28 volumes: 29 - postgres-data:/var/lib/postgresql/data 30 # Mount backup directory for pg_dump 31 - ./backups:/backups 32 networks: 33 - coves-internal 34 healthcheck: 35 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] 36 interval: 10s 37 timeout: 5s 38 retries: 5 39 # Generous limits for 256GB server 40 deploy: 41 resources: 42 limits: 43 memory: 32G 44 reservations: 45 memory: 4G 46 47 # Coves AppView (Go Server) 48 appview: 49 build: 50 context: . 51 dockerfile: Dockerfile 52 image: coves/appview:${VERSION:-latest} 53 container_name: coves-prod-appview 54 restart: unless-stopped 55 ports: 56 - "127.0.0.1:8080:8080" # Only expose to localhost (Caddy proxies) 57 environment: 58 # Database 59 DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable 60 61 # Instance identity 62 INSTANCE_DID: did:web:coves.social 63 INSTANCE_DOMAIN: coves.social 64 65 # PDS connection (separate domain!) 66 PDS_URL: https://coves.me 67 68 # Jetstream (Bluesky production firehose) 69 JETSTREAM_URL: wss://jetstream2.us-east.bsky.network/subscribe 70 71 # Custom lexicon consumers (use production Jetstream with collection filters) 72 COMMUNITY_JETSTREAM_URL: wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=social.coves.community.profile&wantedCollections=social.coves.community.subscription 73 POST_JETSTREAM_URL: wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=social.coves.community.post 74 AGGREGATOR_JETSTREAM_URL: wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=social.coves.aggregator.service&wantedCollections=social.coves.aggregator.authorization 75 VOTE_JETSTREAM_URL: wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=social.coves.feed.vote 76 COMMENT_JETSTREAM_URL: wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=social.coves.community.comment 77 78 # Security - MUST be false in production 79 AUTH_SKIP_VERIFY: "false" 80 SKIP_DID_WEB_VERIFICATION: "false" 81 82 # OAuth (for community account provisioning) 83 OAUTH_CLIENT_ID: ${OAUTH_CLIENT_ID} 84 OAUTH_REDIRECT_URI: ${OAUTH_REDIRECT_URI} 85 OAUTH_PRIVATE_JWK: ${OAUTH_PRIVATE_JWK} 86 87 # Application settings 88 PORT: 8080 89 ENV: production 90 LOG_LEVEL: info 91 92 # Encryption key for community credentials 93 ENCRYPTION_KEY: ${ENCRYPTION_KEY} 94 95 # Cursor encryption for pagination 96 CURSOR_SECRET: ${CURSOR_SECRET} 97 networks: 98 - coves-internal 99 depends_on: 100 postgres: 101 condition: service_healthy 102 healthcheck: 103 test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/xrpc/_health"] 104 interval: 30s 105 timeout: 5s 106 retries: 3 107 start_period: 10s 108 # Go is memory-efficient, but give it room for connection pools 109 deploy: 110 resources: 111 limits: 112 memory: 8G 113 reservations: 114 memory: 512M 115 116 # Bluesky PDS (Personal Data Server) 117 # Handles community accounts and their repositories 118 pds: 119 image: ghcr.io/bluesky-social/pds:latest 120 container_name: coves-prod-pds 121 restart: unless-stopped 122 ports: 123 - "127.0.0.1:3000:3000" # Only expose to localhost (Caddy proxies) 124 environment: 125 # PDS identity 126 PDS_HOSTNAME: coves.me 127 PDS_PORT: 3000 128 PDS_DATA_DIRECTORY: /pds 129 PDS_BLOBSTORE_DISK_LOCATION: /pds/blocks 130 131 # PLC Directory (production) 132 PDS_DID_PLC_URL: https://plc.directory 133 134 # Handle domains 135 # Community handles use @community.coves.social (AppView domain) 136 # Note: Root domain (coves.social) handle works via .well-known resolution 137 PDS_SERVICE_HANDLE_DOMAINS: .coves.social 138 139 # Security (set real values in .env.prod) 140 PDS_JWT_SECRET: ${PDS_JWT_SECRET} 141 PDS_ADMIN_PASSWORD: ${PDS_ADMIN_PASSWORD} 142 PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX: ${PDS_ROTATION_KEY} 143 144 # Email (optional, for account recovery) 145 # NOTE: Must set BOTH or NEITHER - PDS fails with partial config 146 # PDS_EMAIL_SMTP_URL: ${PDS_EMAIL_SMTP_URL} 147 # PDS_EMAIL_FROM_ADDRESS: ${PDS_EMAIL_FROM_ADDRESS} 148 149 # Production mode 150 PDS_DEV_MODE: "false" 151 PDS_INVITE_REQUIRED: "false" # Set to true if you want invite-only 152 153 # Logging 154 NODE_ENV: production 155 LOG_ENABLED: "true" 156 LOG_LEVEL: info 157 158 # AppView proxy (for app.bsky.* methods like getProfile, notifications, etc.) 159 PDS_BSKY_APP_VIEW_URL: https://api.bsky.app 160 PDS_BSKY_APP_VIEW_DID: did:web:api.bsky.app 161 162 # Report service (for reporting content) 163 PDS_REPORT_SERVICE_URL: https://mod.bsky.app 164 PDS_REPORT_SERVICE_DID: did:plc:ar7c4by46qjdydhdevvrndac 165 166 # Relay crawlers (for federation with Bluesky network) 167 PDS_CRAWLERS: https://bsky.network 168 volumes: 169 - pds-data:/pds 170 networks: 171 - coves-internal 172 healthcheck: 173 test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/xrpc/_health"] 174 interval: 30s 175 timeout: 5s 176 retries: 5 177 # PDS (Node.js) needs memory for blob handling 178 deploy: 179 resources: 180 limits: 181 memory: 16G 182 reservations: 183 memory: 1G 184 185 # Caddy Reverse Proxy 186 # Handles HTTPS automatically via Let's Encrypt 187 # Uses Cloudflare plugin for wildcard SSL certificates (*.coves.social) 188 caddy: 189 # Pre-built Caddy with Cloudflare DNS plugin 190 # Updates automatically with docker-compose pull 191 # Alternative: build your own with Dockerfile.caddy 192 image: ghcr.io/slothcroissant/caddy-cloudflaredns:latest 193 container_name: coves-prod-caddy 194 restart: unless-stopped 195 ports: 196 - "80:80" 197 - "443:443" 198 environment: 199 # Required for wildcard SSL via DNS challenge 200 # Create at: Cloudflare Dashboard → My Profile → API Tokens → Create Token 201 # Permissions: Zone:DNS:Edit for coves.social zone 202 CLOUDFLARE_API_TOKEN: ${CLOUDFLARE_API_TOKEN} 203 volumes: 204 - ./Caddyfile:/etc/caddy/Caddyfile:ro 205 - caddy-data:/data 206 - caddy-config:/config 207 # Static files (.well-known, client-metadata.json, oauth callback) 208 - ./static:/srv:ro 209 networks: 210 - coves-internal 211 depends_on: 212 - appview 213 - pds 214 215networks: 216 coves-internal: 217 driver: bridge 218 name: coves-prod-network 219 220volumes: 221 postgres-data: 222 name: coves-prod-postgres-data 223 pds-data: 224 name: coves-prod-pds-data 225 caddy-data: 226 name: coves-prod-caddy-data 227 caddy-config: 228 name: coves-prod-caddy-config