Skip to content

feat(devops): Phase 10 — Docker, compose, metrics, CI workflows - #29

Merged
Alaashamel merged 5 commits into
mainfrom
feat/devops
Aug 19, 2026
Merged

Alaashamel merged 5 commits into
mainfrom
feat/devops

Conversation

@Alaashamel

Copy link
Copy Markdown
Owner

Summary

  • Ships Phase 10 DevOps: production Dockerfiles, a full Docker Compose stack, Prometheus metrics, nginx reverse proxy, and CI security/build workflows.

What changed

Prometheus metrics (api)

A dependency-free metrics registry (counters, histograms, gauges) exposed at GET /metrics with Prometheus text exposition format 0.0.4. Middleware records http_requests_total by (method, route, status) and http_request_duration_seconds with cumulative buckets; process gauges (rss, heap, uptime) refresh on every scrape.

Dockerfiles (web / api / ai)

  • api — multi-stage node:20-alpine build: installs workspaces, prunes dev deps, runs as node user.
  • web — two-stage: node:20-alpine runs the Vite build (VITE_API_URL=/api/v1), nginx:alpine serves the static dist.
  • ai — single-stage python:3.13-slim: pip-installs the package, runs as a non-root user.
  • .dockerignore keeps source, node_modules, dist, pycache, .git and .env out of the build context.

Full stack compose

docker-compose.yml now defines five services: postgres (pgvector, existing), api, web, ai and nginx — all wired with health checks, secret env vars and a reverse proxy at :8080 that routes /api/, /socket.io/ (websocket upgrade) and /metrics to their containers.

Nginx reverse proxy

infrastructure/nginx/ — nginx.conf + Dockerfile. Proxies /api/ to api:4000, /metrics to api:4000, /socket.io/ with upgrade headers, and / to web:80.

CI workflows

  • security.yml — npm audit --audit-level=high + pip-audit on push/PR and weekly.
  • docker.yml — builds all four images on push/PR to validate Dockerfiles before merge.

CVE fix

Pin wheel>=0.46.2 in the AI service dev extras to resolve CVE-2026-24049 in the build environment.

Tests

220 API tests (216 + 4 new metrics tests), 84 web tests, 15 database tests, 145 AI pytest tests (1 skipped locally — requires Docker). Root lint, build, validate, ruff all clean.

Add a dependency-free metrics registry (counters, histograms, gauges)
exposed at GET /metrics with Prometheus text exposition format 0.0.4.
Middleware records http_requests_total by method/route/status and
http_request_duration_seconds with cumulative buckets; process gauges
(rss, heap, uptime) are refreshed on every scrape.
Add production-ready Dockerfiles for the API (multi-stage node:20-alpine
with workspace pruning), web (vite build served by nginx:alpine) and AI
service (python:3.13-slim). Replace the postgres-only docker-compose.yml
with a full five-service stack (postgres, api, web, ai, nginx) with
health checks, signed job token wiring and a reverse proxy that routes
/api/, /metrics and /socket.io/ to their respective containers.
Add security.yml (weekly + PR): npm audit --audit-level=high and
pip-audit on the AI service. Add docker.yml: builds all four images
(api, web, ai, nginx) on push/PR to validate Dockerfiles.
Add wheel>=0.46.2 to the AI service dev extras so fresh CI environments
pick up the patched build dependency.
@Alaashamel
Alaashamel merged commit 836987e into main Aug 19, 2026
3 checks passed
@Alaashamel
Alaashamel deleted the feat/devops branch August 19, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant