| version: '3.8' | |
| services: | |
| sql-api: | |
| build: . | |
| ports: | |
| - "8001:8000" | |
| volumes: | |
| - /home/datht/mats/data/spider:/app/data/spider:ro # Mount pruned spider databases | |
| - /home/datht/mats/data/bird:/app/data/bird:ro # Mount pruned bird databases | |
| - /home/datht/mats/db_execution/logs:/app/logs # Mount logs directory | |
| command: ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "8"] | |
| environment: | |
| - MAX_CONCURRENT=100 | |
| - DEFAULT_TIMEOUT_MS=60000 | |
| - MAX_ROWS=10000 | |
| - LOG_LEVEL=INFO | |
| deploy: | |
| resources: | |
| limits: | |
| # 80% of system memory (100G of 125G) to prevent host OOM | |
| memory: 100G | |
| cpus: '24' | |
| reservations: | |
| memory: 2G | |
| cpus: '1.0' | |
| restart: unless-stopped | |
| healthcheck: | |
| # Use python (always available) instead of curl to avoid "not found" errors | |
| test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health', timeout=5)"] | |
| interval: 30s | |
| timeout: 10s | |
| retries: 3 | |
| start_period: 40s | |