Docker Setup
Docker Compose orchestrates all local development services for Renewa One.
Compose Files
| File | Purpose |
|---|---|
renewa-one/docker-compose.yml | Base config: PostgreSQL 18-alpine, Redis 8-alpine |
renewa-one/docker-compose.local.yml | Dev override: backend hot-reload via backend/Dockerfile.dev, env vars (incl. AUTO_MOCK default true) |
renewa-one/docker-compose.test.yml | Test runner configuration |
Postgres 18 mounts the postgres_data volume at /var/lib/postgresql (not .../data) because PG 18 images manage major-version-specific subdirectories themselves.
Production Build
renewa-one/Dockerfile uses a multi-stage build with Bun:
- deps — install dependencies
- build — compile frontend + backend
- runtime — minimal production image (nginx + backend via supervisord)
Per-service Dockerfiles also exist: backend/Dockerfile, backend/Dockerfile.dev (local hot-reload), frontend/Dockerfile.
nginx Configuration
| Config | Purpose |
|---|---|
renewa-one/nginx.conf | SPA routing, /api/* proxy to backend:3000, /health endpoint, 100MB upload limit |
renewa-one/nginx-main.conf | Top-level nginx daemon config copied to /etc/nginx/nginx.conf in the production image (runs as nobody) |
renewa-one/nginx.dev.conf | Development-specific overrides |
nginx serves static frontend files and proxies API requests to the backend on port 3000. Fly.io connects to port 80 (nginx).
Named Volumes
| Volume | Content |
|---|---|
postgres_data | Database Architecture persistent storage |
redis_data | Redis cache and Background Jobs queue data |
Port Allocation
| Service | Default Port |
|---|---|
| nginx | 80 |
| Backend | 3000 |
| Frontend (Vite) | 5173 |
| PostgreSQL | 5432 |
Each worktree gets an isolated Docker stack via make setup, which calls renewa-one/scripts/allocate-dev-ports.sh. nginx ports are constrained to 18 deterministic slots (10000-10017) so every slot can be registered as a HubSpot OAuth redirect URI; each worktree also gets a unique COMPOSE_PROJECT_NAME. make port-status shows the slot map across worktrees. See Scripts for details.
Background Workers
renewa-one/supervisord.conf manages Background Jobs workers alongside the main application process in the production container.
Environment Precedence
.env.local (per-worktree ports, auto-generated) > .env.hubspot (shared HubSpot credentials) > .env > docker-compose.local.yml defaults.
Run [[Makefile Commands|make setup]] to generate env files; make env-pull pulls secrets from Infisical. Set JWT_SECRET in .env on first run:
openssl rand -base64 32Key Files
renewa-one/docker-compose.ymlrenewa-one/docker-compose.local.ymlrenewa-one/docker-compose.test.ymlrenewa-one/Dockerfilerenewa-one/backend/Dockerfile.devrenewa-one/nginx.confrenewa-one/nginx-main.confrenewa-one/nginx.dev.confrenewa-one/supervisord.confrenewa-one/scripts/allocate-dev-ports.sh
See Also
- Makefile Commands — primary interface to Docker operations
- Architecture Overview — system topology
- Background Jobs — worker process management
- Database Architecture — PostgreSQL configuration