forked from mtusi2026/mtusi2026lab2
перенос основы проекта из 1 лабы
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
"""healthcheck докера"""
|
||||
|
||||
import json
|
||||
import os
|
||||
from urllib.request import urlopen
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
port = os.environ.get("APP_PORT", "8080")
|
||||
try:
|
||||
with urlopen(f"http://127.0.0.1:{port}/health/ready", timeout=2) as response:
|
||||
ready = response.status == 200 and json.load(response) == {"status": "ok"}
|
||||
raise SystemExit(0 if ready else 1)
|
||||
except (OSError, ValueError):
|
||||
raise SystemExit(1)
|
||||
Reference in New Issue
Block a user