Files
moraworld/coolify-compose.yml
T
Lizandro GuarnizoandClaude Sonnet 4.6 db19f3e1ca fix(security): rate limiting, forbidNonWhitelisted, Prisma migrations en startup y CI para GHCR
- ThrottlerGuard global: 20 req/min por IP en todos los endpoints
- forbidNonWhitelisted: true en ValidationPipe
- Dockerfile API: prisma migrate deploy antes de arrancar el proceso
- coolify-compose: depends_on api (service_healthy) en web
- GitHub Actions: build y push de imágenes api/web a GHCR en cada push a main

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 17:06:35 -05:00

100 lines
2.6 KiB
YAML

# Coolify Deployment — docker-compose for production (managed DB/Redis by Coolify)
services:
api:
image: ghcr.io/lizandrogd/moraworld-imports/api:latest
build:
context: .
dockerfile: apps/api/Dockerfile
args:
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
container_name: moraworld-api
restart: unless-stopped
ports:
- "3001:3001"
environment:
- NODE_ENV=production
- PORT=3001
- DATABASE_URL=${DATABASE_URL}
- REDIS_URL=${REDIS_URL}
- JWT_SECRET=${JWT_SECRET}
- JWT_REFRESH_SECRET=${JWT_REFRESH_SECRET}
- AUDIT_HMAC_SECRET=${AUDIT_HMAC_SECRET}
- CORS_ORIGINS=${CORS_ORIGINS}
- S3_ENDPOINT=${S3_ENDPOINT}
- S3_ACCESS_KEY=${S3_ACCESS_KEY}
- S3_SECRET_KEY=${S3_SECRET_KEY}
- S3_BUCKET=${S3_BUCKET}
- S3_REGION=${S3_REGION}
- S3_PUBLIC_URL=${S3_PUBLIC_URL}
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3001/api/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
networks:
- moraworld-network
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
web:
image: ghcr.io/lizandrogd/moraworld-imports/web:latest
depends_on:
api:
condition: service_healthy
build:
context: .
dockerfile: apps/web/Dockerfile
args:
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
container_name: moraworld-web
restart: unless-stopped
ports:
- "3002:3000"
environment:
- NODE_ENV=production
- PORT=3000
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
- NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/status"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
networks:
- moraworld-network
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
# Worker opcional: jobs asíncronos (ej. polling couriers, cron SENAE)
# worker:
# image: ghcr.io/lizandrogd/moraworld-imports/api:latest
# command: ["node", "dist/worker.js"]
# environment: *api_env
# networks: [moraworld-network]
# deploy:
# resources:
# limits:
# cpus: '0.5'
# memory: 512M
networks:
moraworld-network:
driver: bridge
name: moraworld-network