| name | masoi-devops |
| description | Manage Ma Sói Docker configuration, deployment, infrastructure, environment variables, Nginx reverse proxy, health checks, and CI/CD. Use when modifying docker-compose files, Dockerfiles, nginx.conf, .env files, or preparing for VPS/cloud deployment. |
Ma Sói DevOps
Workflow
- Read Docker configs:
docker-compose.yml (production), docker-compose.dev.yml (dev).
- Read Dockerfiles:
server/Dockerfile, client/Dockerfile.
- Read Nginx config:
client/nginx.conf.
- Read environment:
.env (root), server/.env, client/.env.
- Check changes against
references/deploy-checklist.md.
- After edits, verify:
docker compose config (validate compose syntax)
docker compose -f docker-compose.dev.yml up -d (dev infra)
docker compose up --build -d (full stack build)
Infrastructure Rules
- Dev mode uses
docker-compose.dev.yml for PostgreSQL + Redis only; server and client run natively with hot reload.
- Production uses
docker-compose.yml for full stack: postgres + redis + server + client/nginx.
- Client Dockerfile uses multi-stage build:
npm run build → Nginx serve static.
- Server Dockerfile installs production deps only.
- PostgreSQL schema auto-creates from
server/db/init.sql on first run via Docker volume.
Environment Management
- Root
.env sets POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB.
- Server reads
DATABASE_URL, REDIS_URL, PORT from env or uses defaults.
- Client reads
VITE_SERVER_URL for Socket.IO connection (defaults to window.location.hostname).
- Never commit
.env files with production credentials.
Health & Monitoring
/health endpoint exists but only returns { ok: true } — does not verify backend connectivity.
server/check-services.js tests PostgreSQL and Redis connections at startup.
- Consider adding readiness and liveness probes for container orchestration.
Nginx Configuration
- Client nginx serves SPA with
try_files $uri $uri/ /index.html.
- API proxy passes
/api/ and /socket.io/ to server container.
- WebSocket upgrade headers must be set for Socket.IO.
References
Load references/deploy-checklist.md when deploying or modifying infrastructure.