69 lines
1.5 KiB
YAML
69 lines
1.5 KiB
YAML
|
|
version: '3.8'
|
||
|
|
|
||
|
|
services:
|
||
|
|
pit-router:
|
||
|
|
build: .
|
||
|
|
ports:
|
||
|
|
- "9000:9000"
|
||
|
|
environment:
|
||
|
|
- FLASK_ENV=production
|
||
|
|
- SECRET_KEY=${SECRET_KEY}
|
||
|
|
- JWT_SECRET_KEY=${JWT_SECRET_KEY}
|
||
|
|
- DATABASE_URL=postgresql://postgres:${DB_PASSWORD}@postgres:5432/pit_router
|
||
|
|
- REDIS_URL=redis://redis:6379/0
|
||
|
|
volumes:
|
||
|
|
- pit-data:/app/data
|
||
|
|
- pit-logs:/app/logs
|
||
|
|
depends_on:
|
||
|
|
postgres:
|
||
|
|
condition: service_healthy
|
||
|
|
redis:
|
||
|
|
condition: service_healthy
|
||
|
|
restart: unless-stopped
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:9000/health')"]
|
||
|
|
interval: 30s
|
||
|
|
timeout: 10s
|
||
|
|
retries: 3
|
||
|
|
start_period: 40s
|
||
|
|
deploy:
|
||
|
|
resources:
|
||
|
|
limits:
|
||
|
|
cpus: '2.0'
|
||
|
|
memory: 2G
|
||
|
|
reservations:
|
||
|
|
cpus: '0.5'
|
||
|
|
memory: 512M
|
||
|
|
|
||
|
|
postgres:
|
||
|
|
image: postgres:15-alpine
|
||
|
|
environment:
|
||
|
|
- POSTGRES_USER=postgres
|
||
|
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||
|
|
- POSTGRES_DB=pit_router
|
||
|
|
volumes:
|
||
|
|
- postgres-data:/var/lib/postgresql/data
|
||
|
|
restart: unless-stopped
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d pit_router"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
|
||
|
|
redis:
|
||
|
|
image: redis:7-alpine
|
||
|
|
volumes:
|
||
|
|
- redis-data:/data
|
||
|
|
restart: unless-stopped
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "redis-cli", "ping"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
pit-data:
|
||
|
|
pit-logs:
|
||
|
|
postgres-data:
|
||
|
|
redis-data:
|