64 lines
1.5 KiB
YAML
64 lines
1.5 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_DB: payments
|
|
POSTGRES_USER: payments
|
|
POSTGRES_PASSWORD: payments
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U payments -d payments"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
|
|
rabbitmq:
|
|
image: rabbitmq:3.13-management-alpine
|
|
ports:
|
|
- "15672:15672"
|
|
healthcheck:
|
|
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
volumes:
|
|
- rabbitmq_data:/var/lib/rabbitmq
|
|
|
|
migrate:
|
|
build: .
|
|
command: ["alembic", "upgrade", "head"]
|
|
environment: &service_environment
|
|
API_KEY: ${API_KEY:-local-secret}
|
|
DATABASE_URL: postgresql+asyncpg://payments:payments@postgres:5432/payments
|
|
RABBITMQ_URL: amqp://guest:guest@rabbitmq:5672/
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
|
|
api:
|
|
build: .
|
|
command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
environment: *service_environment
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
rabbitmq:
|
|
condition: service_healthy
|
|
|
|
consumer:
|
|
build: .
|
|
command: ["faststream", "run", "app.consumer:app"]
|
|
environment: *service_environment
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
rabbitmq:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
postgres_data:
|
|
rabbitmq_data:
|