Docker Deployment
Gatewyse provides a Docker Compose configuration that runs all services: the gateway server, background worker, admin dashboard, MongoDB, and Redis.
Quick Start
# Copy and configure environmentcp .env.example .env# Edit .env with production values (see Configuration guide)
# Start all servicesdocker compose -f docker/docker-compose.yml up -dServices
The docker/docker-compose.yml defines five services:
| Service | Image / Dockerfile | Port | Description |
|---|---|---|---|
mongodb-primary | mongo:7 | 27017 | MongoDB with automatic replica set initialization |
redis | redis:7-alpine | 6379 | Redis with AOF persistence, 256MB memory limit |
server | docker/Dockerfile.server | 3000 | Express API gateway |
worker | docker/Dockerfile.worker | — | BullMQ background job processor |
admin | docker/Dockerfile.admin | 3001 | Nuxt 4 admin dashboard |
All services are connected via a dedicated aigw-net bridge network.
Health Checks
Both infrastructure services include health checks:
- MongoDB — runs
rs.status()every 10 seconds, auto-initializes the replica set if needed (30-second start period) - Redis — runs
redis-cli pingevery 10 seconds
The server and worker services use depends_on with condition: service_healthy to wait for infrastructure readiness.
Volumes
Two named volumes persist data across container restarts:
| Volume | Mount Point | Purpose |
|---|---|---|
mongo-primary-data | /data/db | MongoDB data files |
redis-data | /data | Redis AOF persistence |
Production Configuration
Environment Variables
For production, set these in your .env file or pass them directly:
NODE_ENV=productionJWT_SECRET=<random-64-char-string>JWT_REFRESH_SECRET=<random-64-char-string>ENCRYPTION_KEY=<random-64-hex-chars>REDIS_PASSWORD=<strong-password>SUPER_ADMIN_PASSWORD=<complex-password>See the Environment Variables reference for all options.
Resource Limits
Add resource constraints to your docker-compose.override.yml:
services: server: deploy: resources: limits: cpus: '2.0' memory: 1G reservations: cpus: '0.5' memory: 512M
worker: deploy: resources: limits: cpus: '1.0' memory: 512M
mongodb-primary: deploy: resources: limits: memory: 2G
redis: deploy: resources: limits: memory: 256MRedis Configuration
The default Redis configuration uses:
redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy noevictionFor production, set a Redis password by adding to the Redis service:
redis: command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy noeviction --requirepass ${REDIS_PASSWORD}MongoDB Security
For production, add authentication to MongoDB:
mongodb-primary: command: mongod --replSet rs0 --bind_ip_all --auth --keyFile /data/keyfileScaling Workers
The background worker handles 11 BullMQ queues (audio processing, audit log backup, cache management, embedding generation, health checks, usage aggregation, and more). To scale workers horizontally:
docker compose -f docker/docker-compose.yml up -d --scale worker=3Each worker instance processes jobs from all queues. BullMQ handles job distribution and locking via Redis.
Useful Commands
# View logsdocker compose -f docker/docker-compose.yml logs -f server
# Restart a single servicedocker compose -f docker/docker-compose.yml restart server
# Stop all servicesdocker compose -f docker/docker-compose.yml down
# Stop and remove volumes (deletes all data)docker compose -f docker/docker-compose.yml down -v
# Rebuild after code changesdocker compose -f docker/docker-compose.yml up -d --build