Files
WeechatPayBot/docker-compose.yml

118 lines
2.4 KiB
YAML

services:
tgbot:
build:
context: .
dockerfile: bot/Dockerfile
init: true
restart: unless-stopped
env_file:
- ./bot/.env
environment:
PYTHONUNBUFFERED: "1"
REDIS_URL: redis://redisdb:6379/0
POSTGRES_HOST: postgredb
POSTGRES_PORT: "5432"
LOG_LEVEL: INFO
depends_on:
redisdb:
condition: service_healthy
postgredb:
condition: service_healthy
command: ["python", "aiogram_run.py"]
stop_grace_period: 30s
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
webapp:
build:
context: .
dockerfile: bot/Dockerfile
init: true
restart: unless-stopped
env_file:
- ./bot/.env
environment:
PYTHONUNBUFFERED: "1"
POSTGRES_HOST: postgredb
POSTGRES_PORT: "5432"
LOG_LEVEL: INFO
depends_on:
postgredb:
condition: service_healthy
ports:
- "127.0.0.1:8000:8000"
command:
[
"uvicorn",
"webhooks:app",
"--host",
"0.0.0.0",
"--port",
"8000",
"--proxy-headers",
"--forwarded-allow-ips=*",
"--no-access-log"
]
stop_grace_period: 30s
healthcheck:
test:
[
"CMD",
"python",
"-c",
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=5)"
]
interval: 15s
timeout: 5s
retries: 5
start_period: 15s
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
redisdb:
image: redis:6-alpine
init: true
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--save", "60", "1000"]
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
postgredb:
image: postgres:16-alpine
init: true
restart: unless-stopped
env_file:
- ./bot/.env
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 5
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
volumes:
postgres_data:
redis_data: