Wire auth middleware into all products, add docker-compose and init-db script

- Auth middleware (JWT + API key + RBAC) copied into P3/P4/P5/P6
- All server entry points now register auth hooks + auth routes
- Webhook and Slack endpoints skip JWT auth (use HMAC/signature)
- docker-compose.yml: shared Postgres + Redis + Meilisearch, all 4 Node products as services
- init-db.sh: creates per-product databases and runs migrations
- P1 (Rust) and P2 (Go agent) run standalone, not in compose
This commit is contained in:
2026-03-01 03:10:35 +00:00
parent 762e2db9df
commit f2e0a32cc7
10 changed files with 677 additions and 2 deletions

123
products/docker-compose.yml Normal file
View File

@@ -0,0 +1,123 @@
# dd0c Local Development Stack
#
# Usage: docker compose up -d
# All services share one Postgres and one Redis instance.
# Caddy handles TLS and routing for *.dd0c.localhost
services:
# --- Shared Infrastructure ---
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: dd0c
POSTGRES_PASSWORD: dd0c-dev
ports:
- "5432:5432"
volumes:
- pg_data:/var/lib/postgresql/data
- ./products/01-llm-cost-router/migrations:/docker-entrypoint-initdb.d/01-route:ro
- ./products/02-iac-drift-detection/saas/migrations:/docker-entrypoint-initdb.d/02-drift:ro
- ./products/03-alert-intelligence/migrations:/docker-entrypoint-initdb.d/03-alert:ro
- ./products/04-lightweight-idp/migrations:/docker-entrypoint-initdb.d/04-portal:ro
- ./products/05-aws-cost-anomaly/migrations:/docker-entrypoint-initdb.d/05-cost:ro
- ./products/06-runbook-automation/saas/migrations:/docker-entrypoint-initdb.d/06-run:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U dd0c"]
interval: 5s
timeout: 3s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
meilisearch:
image: getmeili/meilisearch:v1.8
environment:
MEILI_ENV: development
ports:
- "7700:7700"
volumes:
- meili_data:/meili_data
# --- dd0c Products ---
# P3: Alert Intelligence
alert:
build:
context: ./products/03-alert-intelligence
dockerfile: Dockerfile
ports:
- "3003:3000"
environment:
PORT: "3000"
DATABASE_URL: postgresql://dd0c:dd0c-dev@postgres:5432/dd0c_alert
REDIS_URL: redis://redis:6379
JWT_SECRET: dev-secret-change-me-in-production!!
LOG_LEVEL: info
depends_on:
postgres: { condition: service_healthy }
redis: { condition: service_healthy }
# P4: Lightweight IDP / Service Catalog
portal:
build:
context: ./products/04-lightweight-idp
dockerfile: Dockerfile
ports:
- "3004:3000"
environment:
PORT: "3000"
DATABASE_URL: postgresql://dd0c:dd0c-dev@postgres:5432/dd0c_portal
REDIS_URL: redis://redis:6379
MEILI_URL: http://meilisearch:7700
JWT_SECRET: dev-secret-change-me-in-production!!
LOG_LEVEL: info
depends_on:
postgres: { condition: service_healthy }
redis: { condition: service_healthy }
meilisearch: { condition: service_started }
# P5: AWS Cost Anomaly Detection
cost:
build:
context: ./products/05-aws-cost-anomaly
dockerfile: Dockerfile
ports:
- "3005:3000"
environment:
PORT: "3000"
DATABASE_URL: postgresql://dd0c:dd0c-dev@postgres:5432/dd0c_cost
REDIS_URL: redis://redis:6379
JWT_SECRET: dev-secret-change-me-in-production!!
ANOMALY_THRESHOLD: "50"
LOG_LEVEL: info
depends_on:
postgres: { condition: service_healthy }
redis: { condition: service_healthy }
# P6: Runbook Automation (SaaS)
run:
build:
context: ./products/06-runbook-automation/saas
dockerfile: Dockerfile
ports:
- "3006:3000"
environment:
PORT: "3000"
DATABASE_URL: postgresql://dd0c:dd0c-dev@postgres:5432/dd0c_run
REDIS_URL: redis://redis:6379
JWT_SECRET: dev-secret-change-me-in-production!!
LOG_LEVEL: info
depends_on:
postgres: { condition: service_healthy }
redis: { condition: service_healthy }
volumes:
pg_data:
meili_data: