From d79e68fc0e8873303a6af3386bae3e0ff5a16898 Mon Sep 17 00:00:00 2001 From: ahtlon Date: Fri, 16 Oct 2026 21:21:54 +0200 Subject: [PATCH] [gitea_translater] add /health and monitor on overwatch --- machines/albert/hydra.nix | 1 + machines/overwatch/configuration.nix | 1 + scripts/gitea_hydra_server.py | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/machines/albert/hydra.nix b/machines/albert/hydra.nix index d484b93..e71cb9b 100644 --- a/machines/albert/hydra.nix +++ b/machines/albert/hydra.nix @@ -20,6 +20,7 @@ services.malobeo.gitea-translator = { enable = true; + host = "0.0.0.0"; }; services.hydra = { diff --git a/machines/overwatch/configuration.nix b/machines/overwatch/configuration.nix index dfe722a..03a6cc4 100644 --- a/machines/overwatch/configuration.nix +++ b/machines/overwatch/configuration.nix @@ -145,6 +145,7 @@ in "https://keys.malobeo.org" "https://tasklist.malobeo.org" "https://zines.malobeo.org" + "http://${hosts.malobeo.hosts.albert.network.address}:27364/health" ]; }]; diff --git a/scripts/gitea_hydra_server.py b/scripts/gitea_hydra_server.py index eafa8d0..ca52180 100644 --- a/scripts/gitea_hydra_server.py +++ b/scripts/gitea_hydra_server.py @@ -26,7 +26,7 @@ def _parse_response(baseurl, owner, repo): return pulls class PullsHandler(BaseHTTPRequestHandler): - _VALID_PATHS={"/", "/gitea-pulls-sorted.json"} + _VALID_PATHS={"/", "/gitea-pulls-sorted.json", "/health"} # Class variables to store configuration baseurl = None @@ -34,6 +34,15 @@ class PullsHandler(BaseHTTPRequestHandler): repo = None def do_GET(self): + if self.path == "/health": + body=json.dumps({"status": "ok"}).encode("utf-8") + self.send_response(200) + self.send_header("Content-Type", "application/json; charset=utf-8") + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + return + if self.path not in self._VALID_PATHS: self.send_error(404, "Not Found") return -- 2.54.0