From 614875f295b70bbe6e75e014012308ec319398ba Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Mon, 5 Oct 2026 18:44:51 +0700 Subject: [PATCH] fix(gitea-mirror): run the health check every 5 minutes to stay under GitHub's anonymous rate limit --- gitea-mirror/README.md | 11 ++++++++++- gitea-mirror/compose.yml | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gitea-mirror/README.md b/gitea-mirror/README.md index 8ab4ac4..d23ea7a 100644 --- a/gitea-mirror/README.md +++ b/gitea-mirror/README.md @@ -10,7 +10,8 @@ repositories into a Gitea instance. | `gitea-mirror` | `ghcr.io/raylabshq/gitea-mirror:latest` | 4321 | `GITEA_MIRROR_URL` | In Coolify, give `gitea-mirror` a domain on port 4321 matching -`GITEA_MIRROR_URL`. The image ships its own health check. +`GITEA_MIRROR_URL`. The image ships its own health check; the compose file +keeps its command and only slows how often it runs. ## Variables @@ -41,6 +42,14 @@ install. which never syncs. `HTTP_IDLE_TIMEOUT` is set at least as long as Gitea's clone timeout so the request outlives the clone. Bun caps it at 239 minutes, so a larger value stops helping there. +- **Health check every 5 minutes.** Each call to `/api/health` also asks + GitHub's API, without a token, for the latest gitea-mirror release, and a + failed answer is not cached. At the image's 30-second interval that is 120 + calls an hour against GitHub's limit of 60 unauthenticated calls per IP, so + the check fails and logs a 403 every time. Five minutes makes it 12. During + the first 30 seconds it still checks every 5 seconds, so a deploy turns + healthy as quickly as before. Mirroring itself uses the GitHub token and is + unaffected either way. - **`gitea-mirror:latest`** with `pull_policy: always`: upstream publishes no major tag, so every redeploy takes the newest release. diff --git a/gitea-mirror/compose.yml b/gitea-mirror/compose.yml index 9d29e8b..fbcafa8 100644 --- a/gitea-mirror/compose.yml +++ b/gitea-mirror/compose.yml @@ -12,6 +12,10 @@ services: BUN_CONFIG_HTTP_IDLE_TIMEOUT: ${HTTP_IDLE_TIMEOUT:-3600} volumes: - gitea-mirror-data:/app/data + healthcheck: + interval: 5m + start_period: 30s + start_interval: 5s volumes: gitea-mirror-data: