82 lines
1.7 KiB
YAML
82 lines
1.7 KiB
YAML
services:
|
|
db:
|
|
image: postgres:16
|
|
restart: unless-stopped
|
|
env_file:
|
|
- ${ENV_FILE:-.env}
|
|
environment:
|
|
POSTGRES_DB: ${DB_NAME:-app}
|
|
POSTGRES_USER: ${DB_USER:-app}
|
|
POSTGRES_PASSWORD: ${DB_PASS}
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 5s
|
|
|
|
migrate:
|
|
build: .
|
|
command: ["python", "-m", "core.migrations", "upgrade"]
|
|
environment:
|
|
DB_HOST: db
|
|
env_file:
|
|
- ${ENV_FILE:-.env}
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
restart: "no"
|
|
|
|
app:
|
|
build: .
|
|
restart: unless-stopped
|
|
init: true
|
|
ports:
|
|
- "8080:5000"
|
|
environment:
|
|
DB_HOST: db
|
|
env_file:
|
|
- ${ENV_FILE:-.env}
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/health/ready', timeout=3).read()"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 10s
|
|
|
|
scheduler:
|
|
build: .
|
|
command: ["python", "-m", "scheduler.daemon"]
|
|
environment:
|
|
DB_HOST: db
|
|
restart: unless-stopped
|
|
init: true
|
|
env_file:
|
|
- ${ENV_FILE:-.env}
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
|
|
bot:
|
|
build: .
|
|
command: ["python", "-m", "bot.bot"]
|
|
environment:
|
|
API_URL: http://app:5000
|
|
restart: unless-stopped
|
|
init: true
|
|
env_file:
|
|
- ${ENV_FILE:-.env}
|
|
depends_on:
|
|
app:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
pgdata:
|