feat: foundation — Docker Compose, OTEL, shared types (P0-002, P0-005, P0-006)

Docker Compose (P0-005):
- PG 17 + pgvector, Valkey 8, OTEL Collector, Jaeger
- OTEL Collector config with trace/metric/log pipelines
- .env.example with all connection strings

OTEL Foundation (P0-006):
- @opentelemetry/sdk-node with auto-instrumentations
- tracing.ts loaded before NestJS bootstrap
- OTLP HTTP exporter → collector → Jaeger
- Disabled fs/dns instrumentations (noisy)

Shared Types (P0-002):
- ChatMessageDto with class-validator (IsUUID, IsNotEmpty, MaxLength)
- ChatResponseDto for REST responses
- Socket.IO typed event maps (ServerToClientEvents, ClientToServerEvents)
- AgentSessionHandle opaque type
- All event payload interfaces shared across gateway/cli/discord

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 20:55:04 -05:00
parent f6f05cf23a
commit a52537985e
14 changed files with 2055 additions and 26 deletions

51
docker-compose.yml Normal file
View File

@@ -0,0 +1,51 @@
services:
postgres:
image: pgvector/pgvector:pg17
ports:
- '5432:5432'
environment:
POSTGRES_USER: mosaic
POSTGRES_PASSWORD: mosaic
POSTGRES_DB: mosaic
volumes:
- pg_data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U mosaic']
interval: 5s
timeout: 3s
retries: 5
valkey:
image: valkey/valkey:8-alpine
ports:
- '6379:6379'
volumes:
- valkey_data:/data
healthcheck:
test: ['CMD', 'valkey-cli', 'ping']
interval: 5s
timeout: 3s
retries: 5
otel-collector:
image: otel/opentelemetry-collector-contrib:0.100.0
ports:
- '4317:4317' # OTLP gRPC
- '4318:4318' # OTLP HTTP
volumes:
- ./infra/otel-collector.yml:/etc/otelcol-contrib/config.yaml:ro
depends_on:
jaeger:
condition: service_started
jaeger:
image: jaegertracing/jaeger:2
ports:
- '16686:16686' # Jaeger UI
- '4319:4317' # Jaeger OTLP gRPC (internal, collector forwards here)
environment:
COLLECTOR_OTLP_ENABLED: 'true'
volumes:
pg_data:
valkey_data: