---
description: Run all services via Docker Compose (for home network / clean environment)
---

## Docker Compose — All Services

Use this on a home network or CI where there is no corporate proxy.

### Prerequisites

- Docker Desktop running
- `.env` at repo root (Cosmos DB, JWT, Stripe, Azure credentials)
- `user-dashboard-web/.env.local` (Cosmos DB, JWT)
- Admin + Tracker dashboards now live in `../learning_ai_common_plat/dashboards/` and use shared `.env`

### Start

```bash
docker compose up -d       # builds images + starts all 10 containers
docker compose ps          # check status
docker compose logs -f     # tail all logs
```

### Services

| Service | Container | Port | Image / Dockerfile |
|---------|-----------|------|--------------------|
| Loki | `loki` | 3100 | `grafana/loki:3.3.2` |
| Grafana | `grafana` | 3000 | `grafana/grafana:11.4.0` |
| Traefik Gateway | `gateway` | 80, 8080 | `traefik:v3.3` |
| Backend API | `backend` | 8000 | `backend/Dockerfile` |
| Admin Dashboard | `admin-dashboard` | 3001 | `../learning_ai_common_plat/dashboards/admin-web/` |
| User Dashboard | `user-dashboard` | 3002 | `user-dashboard-web/Dockerfile` |
| Tracker Dashboard | `tracker-dashboard` | 3003 | `../learning_ai_common_plat/dashboards/tracker-web/` |
| Platform Service | `platform-service` | 4003 | `../learning_ai_common_plat/services/platform-service/Dockerfile` |
| Extraction Service | `extraction-service` | 4005 | `../learning_ai_common_plat/services/extraction-service/Dockerfile` |

### Traefik Routing (port 80)

| PathPrefix | Routes to |
|------------|-----------|
| `/api` (catch-all), `/health` | Backend API |
| `/api/auth`, `/api/audit`, `/api/notifications`, `/api/flags`, `/api/ratelimit`, `/api/subscriptions`, `/api/invitations`, `/api/stripe`, `/public` | Platform Service (consolidated) |
| `/api/extract`, `/api/tasks` | Extraction Service |

### Stop

```bash
docker compose down
```

### Rebuild (after code changes)

```bash
docker compose build       # rebuild all images
docker compose up -d       # restart with new images
```

### Observability

- **Grafana**: http://localhost:3000 (admin / lysnrai)
- **Loki**: log aggregation — all services ship logs via Loki Docker driver
- **Traefik dashboard**: http://localhost:8080

### Notes

- Backend uses `python:3.13-slim`, dashboards use `node:20-alpine`, microservices use `node:22-alpine`
- All dashboards require `output: "standalone"` in `next.config.ts` (already set)
- All dashboards have `GET /api/health` for Docker healthchecks
- Env vars are injected via `env_file` in `docker-compose.yml`
- Do NOT use on corporate proxy networks (SSL interception breaks pip/npm installs inside Docker)
