Files
microdao-daarion/docker-compose.matrix-bridge-node1.yml
Apple 1d8482f4c1 feat(matrix-bridge-dagi): scaffold service with health, metrics and config (PR-M1.0)
New service: services/matrix-bridge-dagi/
- app/config.py: BridgeConfig dataclass, load_config() with full env validation
  (MATRIX_HOMESERVER_URL, MATRIX_ACCESS_TOKEN, MATRIX_USER_ID, SOFIIA_ROOM_ID,
   DAGI_GATEWAY_URL, SOFIIA_CONSOLE_URL, SOFIIA_INTERNAL_TOKEN, rate limits)
- app/main.py: FastAPI app with lifespan, GET /health, GET /metrics (prometheus)
  health returns: ok, node_id, homeserver, bridge_user, sofiia_room_id,
  allowed_agents, gateway, uptime_s; graceful error state when config missing
- requirements.txt: fastapi, uvicorn, httpx, prometheus-client, pyyaml
- Dockerfile: python:3.11-slim, port 7030, BUILD_SHA/BUILD_TIME args

docker-compose.matrix-bridge-node1.yml:
- standalone override file (node1 network, port 127.0.0.1:7030)
- all env vars wired: MATRIX_*, SOFIIA_ROOM_ID, DAGI_GATEWAY_URL,
  SOFIIA_CONSOLE_URL, SOFIIA_INTERNAL_TOKEN, rate limit policy
- healthcheck, restart: unless-stopped

DoD: config validates, health/metrics respond, imports clean
Made-with: Cursor
2026-03-03 07:28:24 -08:00

66 lines
2.5 KiB
YAML

# Matrix Bridge DAGI — Phase M1
# Include into the main NODA1 stack or run standalone:
# docker compose -f docker-compose.node1.yml -f docker-compose.matrix-bridge-node1.yml up -d matrix-bridge-dagi
version: "3.9"
services:
matrix-bridge-dagi:
build:
context: ./services/matrix-bridge-dagi
args:
BUILD_SHA: "${BUILD_SHA:-dev}"
BUILD_TIME: "${BUILD_TIME:-local}"
container_name: matrix-bridge-dagi-node1
ports:
- "127.0.0.1:7030:7030" # internal only — not exposed publicly
environment:
- PORT=7030
- ENV=prod
- NODE_ID=NODA1
- BUILD_SHA=${BUILD_SHA:-dev}
- BUILD_TIME=${BUILD_TIME:-local}
# ── Matrix homeserver ────────────────────────────────────────────────
# Required: set in .env on NODA1 before first launch
- MATRIX_HOMESERVER_URL=${MATRIX_HOMESERVER_URL:-}
- MATRIX_ACCESS_TOKEN=${MATRIX_ACCESS_TOKEN:-}
- MATRIX_USER_ID=${MATRIX_USER_ID:-}
# ── Room → Agent mapping (M1: single room for Sofiia) ────────────────
# Create the room manually, then paste the room_id here
- SOFIIA_ROOM_ID=${SOFIIA_ROOM_ID:-}
# ── DAGI backend ─────────────────────────────────────────────────────
- DAGI_GATEWAY_URL=http://dagi-gateway-node1:9300
- DEFAULT_NODE_ID=NODA1
# ── Sofiia Console (audit write) ─────────────────────────────────────
- SOFIIA_CONSOLE_URL=http://dagi-sofiia-console-node1:8002
- SOFIIA_INTERNAL_TOKEN=${SOFIIA_INTERNAL_TOKEN:-}
# ── Policy ───────────────────────────────────────────────────────────
- BRIDGE_ALLOWED_AGENTS=sofiia
- RATE_LIMIT_ROOM_RPM=20
- RATE_LIMIT_SENDER_RPM=10
healthcheck:
test:
- "CMD"
- "python3"
- "-c"
- "import urllib.request; urllib.request.urlopen('http://localhost:7030/health', timeout=5)"
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
networks:
- dagi-network
restart: unless-stopped
networks:
dagi-network:
external: true