- infra (k8s, kind, helm, docker) backbone is implemented - security: implementation + unit tests are done
131 lines
3.0 KiB
YAML
131 lines
3.0 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: incidentops-postgres
|
|
environment:
|
|
POSTGRES_USER: incidentops
|
|
POSTGRES_PASSWORD: incidentops
|
|
POSTGRES_DB: incidentops
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U incidentops"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# For Celery broker
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: incidentops-redis
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# api services
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: api
|
|
container_name: incidentops-api
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
DATABASE_URL: postgresql://incidentops:incidentops@postgres:5432/incidentops
|
|
REDIS_URL: redis://redis:6379/0
|
|
JWT_SECRET_KEY: dev-secret-key-change-in-production
|
|
JWT_ALGORITHM: HS256
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: 30
|
|
REFRESH_TOKEN_EXPIRE_DAYS: 30
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/v1/healthz"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# Worker service (Celery)
|
|
worker:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: worker
|
|
container_name: incidentops-worker
|
|
environment:
|
|
DATABASE_URL: postgresql://incidentops:incidentops@postgres:5432/incidentops
|
|
REDIS_URL: redis://redis:6379/0
|
|
CELERY_BROKER_URL: redis://redis:6379/0
|
|
CELERY_RESULT_BACKEND: redis://redis:6379/1
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
# Web frontend (Next.js)
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.web
|
|
container_name: incidentops-web
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
NEXT_PUBLIC_API_URL: http://localhost:8000
|
|
depends_on:
|
|
- api
|
|
|
|
# Database migrations (run once)
|
|
migrate:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: api
|
|
container_name: incidentops-migrate
|
|
command: python migrations/migrate.py apply
|
|
environment:
|
|
DATABASE_URL: postgresql://incidentops:incidentops@postgres:5432/incidentops
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
profiles:
|
|
- migrate
|
|
|
|
# Flower for Celery monitoring (dev only)
|
|
flower:
|
|
image: mher/flower:2.0
|
|
container_name: incidentops-flower
|
|
ports:
|
|
- "5555:5555"
|
|
environment:
|
|
CELERY_BROKER_URL: redis://redis:6379/0
|
|
FLOWER_BASIC_AUTH: admin:admin
|
|
depends_on:
|
|
- redis
|
|
profiles:
|
|
- monitoring
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
|
|
networks:
|
|
default:
|
|
name: incidentops-network
|