Feat/dockerize

HA
1mo ago
+1709-26

Summary by cubic

Adds Docker Compose stacks for local development and production deployment, plus a Puppeteer load test that scales viewers to measure SFU capacity. Backend and frontend Dockerfiles are now multi-stage, and the broadcaster, viewer, and dashboard routes are public so the load test can reach them without auth.

Docker

  • Local and prod compose files run backend, frontend, MongoDB, a 6-node Redis cluster, and nginx ingress on network_mode: host (Linux only); TURN/relay services stay in infra/.
  • Dev targets hot reload; prod runs compiled TS and serves the static SPA through nginx, which proxies /backend and /socket.io.
  • The prod build copies rateLimit.lua into dist, and compose force-overrides Mongo/Redis endpoints so containerized infra is always used.
  • deploy/redis/init-cluster.sh initializes the cluster idempotently; deploy/env.docker.template and README.docker.md document required env vars.

Load test

  • load-test/sfu-capacity.js starts a real broadcaster, adds viewers in batches, and writes join and first-frame latency percentiles to CSV.
  • Frontend exposes __csRoomId, __csLiveAt, __csJoinedAt, __csFirstFrameAt, and __csSocket timing globals and connects the socket in Broadcaster.
  • Making those routes public removes auth from production; re-add ProtectedRoute if route security is still required.
  • Socket disconnect logs now include reason and details.