๐ณ Docker Deployment โ
๐ญ Production Docker Compose โ
For production, create a docker-compose.prod.yml or modify the default:
yaml
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: kitchenasty
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: kitchenasty
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U kitchenasty"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
server:
build:
context: .
dockerfile: packages/server/Dockerfile
environment:
PORT: 3000
NODE_ENV: production
DATABASE_URL: postgresql://kitchenasty:${DB_PASSWORD}@postgres:5432/kitchenasty
JWT_SECRET: ${JWT_SECRET}
CORS_ORIGINS: https://admin.yourdomain.com,https://order.yourdomain.com
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY}
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET}
depends_on:
postgres:
condition: service_healthy
volumes:
- uploads:/app/uploads
restart: unless-stopped
admin:
build:
context: .
dockerfile: packages/admin/Dockerfile
ports:
- "5173:80"
depends_on:
- server
restart: unless-stopped
storefront:
build:
context: .
dockerfile: packages/storefront/Dockerfile
ports:
- "5174:80"
depends_on:
- server
restart: unless-stopped
volumes:
pgdata:
uploads:โ Environment Checklist โ
Before deploying to production, ensure:
- [ ] ๐
JWT_SECRETis a strong, unique random string (32+ chars) - [ ] ๐
DB_PASSWORDis a strong password - [ ] ๐
CORS_ORIGINSlists only your actual domains - [ ] โ๏ธ
NODE_ENVis set toproduction - [ ] ๐ณ Stripe keys are live keys (not test keys)
- [ ] ๐ Webhook secret matches your Stripe dashboard
๐พ Volumes โ
| Volume | Purpose |
|---|---|
pgdata | PostgreSQL data โ persists database across restarts |
uploads | Uploaded images โ persists menu item images |
WARNING
Losing the pgdata volume means losing all data. Back up regularly.
๐ Reverse Proxy & SSL โ
In production, place an nginx reverse proxy or Cloudflare in front to handle:
- ๐ TLS termination (HTTPS)
- ๐ Domain routing (admin.yourdomain.com โ admin container, etc.)
- โก Static asset caching
Example nginx config:
nginx
server {
listen 443 ssl;
server_name order.yourdomain.com;
ssl_certificate /etc/ssl/certs/yourdomain.pem;
ssl_certificate_key /etc/ssl/private/yourdomain.key;
location / {
proxy_pass http://localhost:5174;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}๐ฅ Health Checks โ
The API server exposes a health endpoint:
GET /api/healthUse this for container orchestration health checks and uptime monitoring.