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

View File

@@ -3,6 +3,8 @@ import cors from '@fastify/cors';
import helmet from '@fastify/helmet';
import pino from 'pino';
import { config } from './config/index.js';
import { pool } from './data/db.js';
import { registerAuth, registerAuthRoutes } from './auth/middleware.js';
import { registerRunbookRoutes } from './api/runbooks.js';
import { registerApprovalRoutes } from './api/approvals.js';
import { registerSlackRoutes } from './slackbot/handler.js';
@@ -14,10 +16,11 @@ const app = Fastify({ logger: true });
await app.register(cors, { origin: config.CORS_ORIGIN });
await app.register(helmet);
// Health check
registerAuth(app, config.JWT_SECRET, pool);
app.get('/health', async () => ({ status: 'ok', service: 'dd0c-run' }));
// API routes
registerAuthRoutes(app, config.JWT_SECRET, pool);
registerRunbookRoutes(app);
registerApprovalRoutes(app);
registerSlackRoutes(app);