12 lines
375 B
Python
12 lines
375 B
Python
"""Проверка для Docker HEALTHCHECK: код 0, если /health/ready отвечает 200."""
|
|
import os
|
|
import sys
|
|
import urllib.request
|
|
|
|
port = os.getenv("APP_PORT", "8080")
|
|
try:
|
|
with urllib.request.urlopen(f"http://127.0.0.1:{port}/health/ready", timeout=4) as response:
|
|
sys.exit(0 if response.status == 200 else 1)
|
|
except Exception:
|
|
sys.exit(1)
|