107 lines
3.1 KiB
YAML
107 lines
3.1 KiB
YAML
services:
|
|
traefik:
|
|
image: traefik:v3.1
|
|
command:
|
|
- --providers.docker=true
|
|
- --providers.docker.exposedbydefault=false
|
|
- --entrypoints.web.address=:80
|
|
- --api.dashboard=true
|
|
- --api.insecure=true
|
|
ports:
|
|
- "80:80"
|
|
- "8080:8080"
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
|
|
postgres:
|
|
image: postgres:15
|
|
environment:
|
|
POSTGRES_DB: eventsphere
|
|
POSTGRES_USER: eventsphere
|
|
POSTGRES_PASSWORD: eventsphere
|
|
ports: ["5432:5432"]
|
|
volumes: ["pgdata:/var/lib/postgresql/data"]
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U eventsphere -d eventsphere"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports: ["6379:6379"]
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: apps/api/Dockerfile
|
|
environment:
|
|
PORT: 4000
|
|
DATABASE_URL: ${DATABASE_URL:-postgresql://eventsphere:eventsphere@postgres:5432/eventsphere}
|
|
JWT_SECRET: ${JWT_SECRET:-dev_secret_change_me}
|
|
JWT_ACCESS_TTL: ${JWT_ACCESS_TTL:-15m}
|
|
JWT_REFRESH_TTL: ${JWT_REFRESH_TTL:-30d}
|
|
REDIS_URL: ${REDIS_URL:-redis://redis:6379}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
labels:
|
|
- traefik.enable=true
|
|
- traefik.http.routers.api.rule=PathPrefix(`/api`)
|
|
- traefik.http.routers.api.entrypoints=web
|
|
- traefik.http.routers.api.priority=100
|
|
- traefik.http.services.api.loadbalancer.server.port=4000
|
|
healthcheck:
|
|
test: ["CMD", "node", "-e", "require('http').get('http://localhost:4000/api/v1/health',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 20
|
|
|
|
worker:
|
|
build:
|
|
context: .
|
|
dockerfile: apps/worker/Dockerfile
|
|
environment:
|
|
DATABASE_URL: ${DATABASE_URL:-postgresql://eventsphere:eventsphere@postgres:5432/eventsphere}
|
|
JWT_SECRET: ${JWT_SECRET:-dev_secret_change_me}
|
|
JWT_ACCESS_TTL: ${JWT_ACCESS_TTL:-15m}
|
|
JWT_REFRESH_TTL: ${JWT_REFRESH_TTL:-30d}
|
|
REDIS_URL: ${REDIS_URL:-redis://redis:6379}
|
|
PROCESS_QUEUES: "1"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: apps/web/Dockerfile
|
|
args:
|
|
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost/api/v1}
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
labels:
|
|
- traefik.enable=true
|
|
- traefik.http.routers.web.rule=PathPrefix(`/`)
|
|
- traefik.http.routers.web.entrypoints=web
|
|
- traefik.http.routers.web.priority=1
|
|
- traefik.http.services.web.loadbalancer.server.port=3000
|
|
healthcheck:
|
|
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 20
|
|
|
|
volumes:
|
|
pgdata:
|