- Added all seven issued service trees without omissions. - Preserved the supplied runtime configuration, binaries, and assets.
95 lines
2.3 KiB
YAML
Executable File
95 lines
2.3 KiB
YAML
Executable File
name: dark-tariff
|
|
|
|
services:
|
|
db:
|
|
image: postgres:16.16-bookworm
|
|
command: ["postgres", "-c", "max_connections=64", "-c", "statement_timeout=5s", "-c", "lock_timeout=2s", "-c", "idle_in_transaction_session_timeout=5s"]
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-billing}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-billing}
|
|
POSTGRES_DB: ${POSTGRES_DB:-billing}
|
|
volumes:
|
|
- data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-billing} -d ${POSTGRES_DB:-billing}"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 10s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "1.0"
|
|
memory: 512M
|
|
pids: 256
|
|
stop_grace_period: 30s
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
restart: unless-stopped
|
|
|
|
cleaner:
|
|
build: ./cleaner
|
|
environment:
|
|
PGHOST: db
|
|
PGPORT: "5432"
|
|
PGUSER: ${POSTGRES_USER:-billing}
|
|
PGPASSWORD: ${POSTGRES_PASSWORD:-billing}
|
|
PGDATABASE: ${POSTGRES_DB:-billing}
|
|
PGOPTIONS: "-c statement_timeout=30s -c lock_timeout=5s"
|
|
depends_on:
|
|
service:
|
|
condition: service_healthy
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "0.25"
|
|
memory: 128M
|
|
pids: 64
|
|
init: true
|
|
stop_grace_period: 10s
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
restart: unless-stopped
|
|
|
|
service:
|
|
build: .
|
|
environment:
|
|
DATABASE_URL: postgresql://${POSTGRES_USER:-billing}:${POSTGRES_PASSWORD:-billing}@db:5432/${POSTGRES_DB:-billing}
|
|
PYTHONDONTWRITEBYTECODE: "1"
|
|
PYTHONUNBUFFERED: "1"
|
|
ports:
|
|
- "0.0.0.0:8080:8080"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/api/health', timeout=2).close()"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
start_period: 10s
|
|
retries: 3
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "1.0"
|
|
memory: 512M
|
|
pids: 256
|
|
init: true
|
|
stop_grace_period: 10s
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
data:
|
|
driver: local
|