A community based topic aggregation platform built on atproto

feat(infra): add local PLC directory for E2E testing

Add Docker Compose profile for running a local PLC directory server,
enabling E2E tests without polluting production plc.directory.

Changes:
- Add postgres-plc service (port 5436) for PLC directory database
- Add plc-directory service (port 3002) running did-method-plc
- Add 'plc' profile for optional PLC directory startup
- Update Makefile with PLC directory targets

Usage:
docker-compose --profile plc up postgres-plc plc-directory
PLC_DIRECTORY_URL=http://localhost:3002 go test ./tests/integration/...

Benefits:
- Isolated dev environment for DID registration testing
- No pollution of production PLC directory
- Faster E2E tests (no external network calls)
- Enables testing of full community provisioning flow locally

This supports V2.0 architecture where communities get PDS-managed DIDs
that should be registered with a PLC directory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

+92 -4
+6 -4
Makefile
··· 26 26 27 27 ##@ Local Development (All-in-One) 28 28 29 - dev-up: ## Start PDS + PostgreSQL + Jetstream for local development 29 + dev-up: ## Start PDS + PostgreSQL + Jetstream + PLC Directory for local development 30 30 @echo "$(GREEN)Starting Coves development stack...$(RESET)" 31 - @docker-compose -f docker-compose.dev.yml --env-file .env.dev --profile jetstream up -d postgres pds jetstream 31 + @docker-compose -f docker-compose.dev.yml --env-file .env.dev --profile jetstream --profile plc up -d postgres postgres-plc plc-directory pds jetstream 32 32 @echo "" 33 33 @echo "$(GREEN)✓ Development stack started!$(RESET)" 34 34 @echo "" 35 35 @echo "Services available at:" 36 - @echo " - PostgreSQL: localhost:5433" 36 + @echo " - PostgreSQL: localhost:5435" 37 37 @echo " - PDS (XRPC): http://localhost:3001" 38 38 @echo " - PDS Firehose: ws://localhost:3001/xrpc/com.atproto.sync.subscribeRepos" 39 39 @echo " - Jetstream: ws://localhost:6008/subscribe $(CYAN)(Read-Forward)$(RESET)" 40 40 @echo " - Jetstream Metrics: http://localhost:6009/metrics" 41 + @echo " - PLC Directory: http://localhost:3002 $(CYAN)(Local DID registry)$(RESET)" 41 42 @echo "" 42 43 @echo "$(CYAN)Next steps:$(RESET)" 43 44 @echo " 1. Run: make run (starts AppView)" 44 45 @echo " 2. AppView will auto-index users from Jetstream" 45 46 @echo "" 47 + @echo "$(CYAN)Note:$(RESET) Using local PLC directory - DIDs registered locally (won't pollute plc.directory)" 46 48 @echo "Run 'make dev-logs' to view logs" 47 49 48 50 dev-down: ## Stop all development services ··· 112 114 @echo "$(CYAN)========================================$(RESET)" 113 115 @echo "" 114 116 @echo "$(CYAN)Prerequisites:$(RESET)" 115 - @echo " 1. Run 'make dev-up' (if not already running)" 117 + @echo " 1. Run 'make dev-up' (starts PDS + Jetstream)" 116 118 @echo " 2. Run 'make run' in another terminal (AppView must be running)" 117 119 @echo "" 118 120 @echo "$(GREEN)Running E2E tests...$(RESET)"
+86
docker-compose.dev.yml
··· 162 162 profiles: 163 163 - jetstream 164 164 165 + # PostgreSQL Database for PLC Directory (Port 5436) 166 + # Separate database for local PLC directory to avoid conflicts 167 + postgres-plc: 168 + image: postgres:15 169 + container_name: coves-dev-postgres-plc 170 + ports: 171 + - "5436:5432" 172 + environment: 173 + POSTGRES_DB: plc_dev 174 + POSTGRES_USER: plc_user 175 + POSTGRES_PASSWORD: plc_password 176 + volumes: 177 + - postgres-plc-data:/var/lib/postgresql/data 178 + networks: 179 + - coves-dev 180 + healthcheck: 181 + test: ["CMD-SHELL", "pg_isready -U plc_user -d plc_dev"] 182 + interval: 5s 183 + timeout: 5s 184 + retries: 5 185 + profiles: 186 + - plc 187 + 188 + # Local PLC Directory - For E2E testing without polluting production plc.directory 189 + # This allows dev mode DID registration for testing community provisioning 190 + # 191 + # Usage: 192 + # docker-compose --profile plc up postgres-plc plc-directory 193 + # Or with all services: docker-compose --profile jetstream --profile plc up 194 + # 195 + # Configuration in your tests: 196 + # PLC_DIRECTORY_URL=http://localhost:3002 197 + # IS_DEV_ENV=false # Use production mode but point to local PLC 198 + plc-directory: 199 + image: node:18-alpine 200 + container_name: coves-dev-plc 201 + ports: 202 + - "3002:3000" # PLC directory API 203 + working_dir: /app 204 + command: > 205 + sh -c " 206 + if [ ! -d '/app/.git' ]; then 207 + echo 'First run: Installing PLC directory...' && 208 + apk add --no-cache git python3 make g++ yarn && 209 + git clone https://github.com/did-method-plc/did-method-plc.git . && 210 + yarn install --frozen-lockfile && 211 + yarn build && 212 + echo 'PLC directory installed successfully!' 213 + fi && 214 + cd packages/server && 215 + yarn start 216 + " 217 + environment: 218 + # Point to dedicated PLC PostgreSQL database 219 + DATABASE_URL: postgresql://plc_user:plc_password@postgres-plc:5432/plc_dev?sslmode=disable 220 + 221 + # Development settings 222 + DEBUG_MODE: "1" 223 + LOG_ENABLED: "true" 224 + LOG_LEVEL: debug 225 + LOG_DESTINATION: "1" 226 + NODE_ENV: development 227 + 228 + # API configuration 229 + PORT: 3000 230 + volumes: 231 + # Persist the PLC repo so we don't rebuild every time 232 + - plc-app-data:/app 233 + networks: 234 + - coves-dev 235 + depends_on: 236 + postgres-plc: 237 + condition: service_healthy 238 + healthcheck: 239 + test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/"] 240 + interval: 10s 241 + timeout: 5s 242 + retries: 10 243 + start_period: 120s 244 + profiles: 245 + - plc 246 + 165 247 # Indigo Relay (BigSky) - OPTIONAL for local dev 166 248 # WARNING: BigSky is designed to crawl the entire atProto network! 167 249 # For local dev, consider using direct PDS firehose instead (see AppView config below) ··· 254 336 name: coves-dev-postgres-data 255 337 postgres-test-data: 256 338 name: coves-test-postgres-data 339 + postgres-plc-data: 340 + name: coves-dev-postgres-plc-data 257 341 pds-data: 258 342 name: coves-dev-pds-data 259 343 jetstream-data: 260 344 name: coves-dev-jetstream-data 345 + plc-app-data: 346 + name: coves-dev-plc-app-data