From e43b417e6f1ca3b5290785cfa569fb14fd7e3af0 Mon Sep 17 00:00:00 2001 From: austnv Date: Sun, 14 Jun 2026 16:07:28 +0300 Subject: [PATCH] add healthcheck endpoint & dockerignore --- .dockerignore | 5 +++++ docker-compose.yml | 6 ++++++ main.py | 4 ++++ 3 files changed, 15 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a894811 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.venv +__pycache__ +*.pyc +.git +.env \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b1b0fa2..9b2f771 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,12 @@ services: networks: - remnawave-network restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/health', timeout=3).read()"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s networks: remnawave-network: diff --git a/main.py b/main.py index 86f808d..73fea0e 100644 --- a/main.py +++ b/main.py @@ -14,4 +14,8 @@ app = FastAPI( version=get_version_from_pyproject() ) +@app.get("/api/health") +async def health_check(): + return {"status": "healthy", "service": "uvpn-backend"} + app.include_router(ip.router) \ No newline at end of file