diff --git a/bot/app/web/web_server.py b/bot/app/web/web_server.py index ca5365f..0c10052 100644 --- a/bot/app/web/web_server.py +++ b/bot/app/web/web_server.py @@ -58,6 +58,11 @@ async def build_and_start_web_app( app = web.Application() _inject_shared_instances(app, dp, bot, settings, async_session_factory) + async def _healthcheck(request: web.Request) -> web.Response: + return web.json_response({"status": "ok"}) + + app.router.add_get("/healthz", _healthcheck) + setup_application(app, dp, bot=bot) telegram_uses_webhook_mode = bool(settings.WEBHOOK_BASE_URL) diff --git a/docker-compose.yml b/docker-compose.yml index 55cc2f2..4539c56 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,12 @@ services: ports: - 127.0.0.1:8080:8080 - 127.0.0.1:${WEBAPP_SERVER_PORT:-8081}:${WEBAPP_SERVER_PORT:-8081} + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/healthz >/dev/null || exit 1"] + interval: 30s + timeout: 5s + retries: 5 + start_period: 30s remnawave-tg-shop-db: image: postgres:17