fix backups #62

Open
danijel.simeunovic wants to merge 3 commits from hotfix/gitea-backup into main
Member
No description provided.
danijel.simeunovic added 1 commit 2026-10-13 22:44:19 +00:00
fix backups
scan.yaml / test (pull_request) Successful in 7s
90b8e6f2a4
Owner

📝 README Sync

Checking whether the code changes in PR #62 require documentation updates.

  • Documentation scope: README.md, README.*.md, doc/**/*.md, docs/**/*.md
  • Lifecycle: offer-as-pr
## 📝 README Sync Checking whether the code changes in **PR #62** require documentation updates. - Documentation scope: `README.md`, `README.*.md`, `doc/**/*.md`, `docs/**/*.md` - Lifecycle: `offer-as-pr`
ai_bot reviewed 2026-10-13 22:44:33 +00:00
ai_bot left a comment
Owner

📝 README Sync

No documentation changes were needed for PR #62.

I made no documentation changes. The Markdown files I could see in full are still accurate after this PR. - Gitea backup CronJob: the README only says "Gitea daily backup to S3-compatible storage", which is still true now that uploads use rclone/rclone:1.75.2 instead of minio/mc. The pinned gitea/gitea:1.27.0 dump image doesn't contradict anything in the docs I could see either. One gap: docs/OPERATIONS-RUNBOOK.md came through cut off, so I couldn't read its Disaster Recovery or backup sections. If they show mc alias / mc cp / mc rm --older-than commands or the old gitea/gitea:28.0.0 image, they're now out of date. I didn't rewrite that file from partial content, because overwriting it would have deleted the parts I couldn't see. - Slack notification annotations on ai-git-bot: these match what docs/DEVELOPER-GUIDE.md already says every app should have. - Renovate rule: stopping automatic updates of the gitea/gitea dump image affects no in-scope documentation. - Deleted apps/charts/claude-impl.md: this is outside the documentation scope I'm allowed to edit, and no in-scope doc links to it. DONE: No changes needed, because the visible docs still match the code; the cut-off backup sections of docs/OPERATIONS-RUNBOOK.md may still mention mc and need a manual check.

## 📝 README Sync No documentation changes were needed for **PR #62**. > I made no documentation changes. The Markdown files I could see in full are still accurate after this PR. - **Gitea backup CronJob:** the README only says "Gitea daily backup to S3-compatible storage", which is still true now that uploads use `rclone/rclone:1.75.2` instead of `minio/mc`. The pinned `gitea/gitea:1.27.0` dump image doesn't contradict anything in the docs I could see either. One gap: `docs/OPERATIONS-RUNBOOK.md` came through cut off, so I couldn't read its Disaster Recovery or backup sections. If they show `mc alias` / `mc cp` / `mc rm --older-than` commands or the old `gitea/gitea:28.0.0` image, they're now out of date. I didn't rewrite that file from partial content, because overwriting it would have deleted the parts I couldn't see. - **Slack notification annotations on `ai-git-bot`:** these match what `docs/DEVELOPER-GUIDE.md` already says every app should have. - **Renovate rule:** stopping automatic updates of the `gitea/gitea` dump image affects no in-scope documentation. - **Deleted `apps/charts/claude-impl.md`:** this is outside the documentation scope I'm allowed to edit, and no in-scope doc links to it. DONE: No changes needed, because the visible docs still match the code; the cut-off backup sections of `docs/OPERATIONS-RUNBOOK.md` may still mention `mc` and need a manual check.
ai_bot reviewed 2026-10-13 22:45:08 +00:00
ai_bot left a comment
Owner

🤖 AI Code Review

Review: "fix backups"

1. Blocking issues

1. Pruning now deletes everything in the bucket older than 7 days (important)

  • Where: cluster-resources/gitea-backup-cronjob.yaml, rclone delete --min-age 7d "s3:${S3_BUCKET}/" || true
  • Problem: rclone delete is recursive by default. It removes every object older than 7 days under the bucket root, not just Gitea dumps.
  • Why it matters:
    • If the bucket is shared with anything else (for example the forte-drop-postgresql pg-backup-cronjob, or manually kept archives), those objects are silently destroyed.
    • The old mc rm --older-than call had no --recursive. It likely failed and was swallowed by || true, so this is effectively the first time pruning will actually delete anything. That makes it a real behaviour change.
  • Fix: scope the delete to Gitea dumps only:
    rclone delete --min-age 7d --include "gitea-dump-*.zip" --max-depth 1 "s3:${S3_BUCKET}/"
    
    Before merging, do a one-off --dry-run against the real bucket.

2. Pinned image tags must be confirmed to exist and match the server (important)

  • Where: image: gitea/gitea:1.27.0 and image: rclone/rclone:1.75.2
  • Why it matters: the whole point of this PR is to recover from ImagePullBackOff. A non-existent tag reproduces the same failure.
  • What to verify:
    • Both tags actually exist on Docker Hub. I can't confirm either from the diff.
    • The comment's mapping "chart gitea 12.7.0 -> appVersion 1.27.0" is correct. Check the chart's real appVersion and any image.tag / image.rootless override in infra/values/*/gitea-values.yaml.
    • The dump image should match the exact deployed image, including the rootful vs. rootless variant. The /data/gitea/conf/app.ini path assumes the rootful layout.

2. Non-blocking suggestions

3. Possible bucket check failure (minor)

  • Where: the copyto step.
  • Problem: by default rclone checks or creates the bucket before writing. With least-privilege keys (no ListBuckets / CreateBucket) on MinIO or another S3 backend, the upload can fail.
  • Fix: add the env var RCLONE_S3_NO_CHECK_BUCKET=true. Consider RCLONE_CONFIG_S3_REGION too if the endpoint requires one.

4. Credentials are re-exported in the script (minor)

  • Where: export RCLONE_CONFIG_S3_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" and the related exports.
  • Observation: this works, but you could avoid the shell step by setting RCLONE_CONFIG_S3_ENV_AUTH=true, which lets rclone read AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY directly. Only the endpoint would then need exporting.

5. Silent version drift risk (minor)

  • Where: the new renovate.json rule that disables gitea/gitea updates for the cronjob.
  • Problem: it prevents wrong bumps, but nothing reminds anyone to bump the dump image when the Gitea chart moves. The two will silently drift, and the backup breaks the other way: an older binary against a migrated schema.
  • Fix options:
    • Add a CI or kustomize check comparing the two versions.
    • Instead of disabling the rule, use a Renovate groupName that links the chart and the image so they move together.

6. Unrelated notification change bundled in (minor)

  • Where: apps/overlays/upc-dev/ai-git-bot/ai-git-bot.yaml, the new notifications.argoproj.io/subscribe.*.slack: "" annotations.
  • Problems:
    • This is unrelated to "fix backups".
    • With an empty recipient value, delivery depends on how the Slack service is configured. Verify it matches other apps.
    • on-sync-succeeded combined with selfHeal: true can be noisy.
  • Fix: consider moving this into its own PR.

7. Deleted apps/charts/claude-impl.md (no change needed)
Removing this AI session transcript is a good cleanup. It shouldn't live in the repo.

3. Tests

  • After deploy, trigger a manual run: kubectl -n gitea create job --from=cronjob/gitea-backup gitea-backup-manual.
  • Confirm that:
    • the dump completes without schema errors;
    • the object lands in the bucket;
    • the prune step only touches gitea-dump-*.zip. Run it with --dry-run first.
  • Do a test restore from the produced zip, using scripts/gitea-restore.sh, to prove the backup is usable.

4. Overall assessment

The direction is right: replacing the now-private minio/mc image and pinning the dump image to the server version is the correct fix. However, the new rclone delete is unscoped and can wipe unrelated data in the bucket, and both image tags need verification. Request changes on item 1. Confirm item 2 before merging.


Automated review by AI Git Bot

## 🤖 AI Code Review # Review: "fix backups" ## 1. Blocking issues **1. Pruning now deletes everything in the bucket older than 7 days (important)** - **Where:** `cluster-resources/gitea-backup-cronjob.yaml`, `rclone delete --min-age 7d "s3:${S3_BUCKET}/" || true` - **Problem:** `rclone delete` is recursive by default. It removes every object older than 7 days under the bucket root, not just Gitea dumps. - **Why it matters:** - If the bucket is shared with anything else (for example the `forte-drop-postgresql` `pg-backup-cronjob`, or manually kept archives), those objects are silently destroyed. - The old `mc rm --older-than` call had no `--recursive`. It likely failed and was swallowed by `|| true`, so this is effectively the first time pruning will actually delete anything. That makes it a real behaviour change. - **Fix:** scope the delete to Gitea dumps only: ```sh rclone delete --min-age 7d --include "gitea-dump-*.zip" --max-depth 1 "s3:${S3_BUCKET}/" ``` Before merging, do a one-off `--dry-run` against the real bucket. **2. Pinned image tags must be confirmed to exist and match the server (important)** - **Where:** `image: gitea/gitea:1.27.0` and `image: rclone/rclone:1.75.2` - **Why it matters:** the whole point of this PR is to recover from `ImagePullBackOff`. A non-existent tag reproduces the same failure. - **What to verify:** - Both tags actually exist on Docker Hub. I can't confirm either from the diff. - The comment's mapping "chart gitea 12.7.0 -> appVersion 1.27.0" is correct. Check the chart's real `appVersion` and any `image.tag` / `image.rootless` override in `infra/values/*/gitea-values.yaml`. - The dump image should match the exact deployed image, including the rootful vs. rootless variant. The `/data/gitea/conf/app.ini` path assumes the rootful layout. ## 2. Non-blocking suggestions **3. Possible bucket check failure (minor)** - **Where:** the `copyto` step. - **Problem:** by default rclone checks or creates the bucket before writing. With least-privilege keys (no `ListBuckets` / `CreateBucket`) on MinIO or another S3 backend, the upload can fail. - **Fix:** add the env var `RCLONE_S3_NO_CHECK_BUCKET=true`. Consider `RCLONE_CONFIG_S3_REGION` too if the endpoint requires one. **4. Credentials are re-exported in the script (minor)** - **Where:** `export RCLONE_CONFIG_S3_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}"` and the related exports. - **Observation:** this works, but you could avoid the shell step by setting `RCLONE_CONFIG_S3_ENV_AUTH=true`, which lets rclone read `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` directly. Only the endpoint would then need exporting. **5. Silent version drift risk (minor)** - **Where:** the new `renovate.json` rule that disables `gitea/gitea` updates for the cronjob. - **Problem:** it prevents wrong bumps, but nothing reminds anyone to bump the dump image when the Gitea chart moves. The two will silently drift, and the backup breaks the other way: an older binary against a migrated schema. - **Fix options:** - Add a CI or kustomize check comparing the two versions. - Instead of disabling the rule, use a Renovate `groupName` that links the chart and the image so they move together. **6. Unrelated notification change bundled in (minor)** - **Where:** `apps/overlays/upc-dev/ai-git-bot/ai-git-bot.yaml`, the new `notifications.argoproj.io/subscribe.*.slack: ""` annotations. - **Problems:** - This is unrelated to "fix backups". - With an empty recipient value, delivery depends on how the Slack service is configured. Verify it matches other apps. - `on-sync-succeeded` combined with `selfHeal: true` can be noisy. - **Fix:** consider moving this into its own PR. **7. Deleted `apps/charts/claude-impl.md` (no change needed)** Removing this AI session transcript is a good cleanup. It shouldn't live in the repo. ## 3. Tests - After deploy, trigger a manual run: `kubectl -n gitea create job --from=cronjob/gitea-backup gitea-backup-manual`. - Confirm that: - the dump completes without schema errors; - the object lands in the bucket; - the prune step only touches `gitea-dump-*.zip`. Run it with `--dry-run` first. - Do a test restore from the produced zip, using `scripts/gitea-restore.sh`, to prove the backup is usable. ## 4. Overall assessment The direction is right: replacing the now-private `minio/mc` image and pinning the dump image to the server version is the correct fix. However, the new `rclone delete` is unscoped and can wipe unrelated data in the bucket, and both image tags need verification. **Request changes** on item 1. Confirm item 2 before merging. --- *Automated review by AI Git Bot*
gitea_admin approved these changes 2026-10-13 22:48:02 +00:00
Dismissed
danijel.simeunovic added 1 commit 2026-10-13 22:52:17 +00:00
Delete .gitea/workflows/ai-review.yaml
scan.yaml / test (pull_request) Successful in 5s
875a8babaa
danijel.simeunovic dismissed gitea_admin's review 2026-10-13 22:52:17 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

gitea_admin approved these changes 2026-10-13 22:52:43 +00:00
Author
Member

@ai_bot review if there are blockers for merging this PR

@ai_bot review if there are blockers for merging this PR
Owner

🤖 Follow-up

I don't see any hard blockers. The backup fix looks correct. Before merging, I'd check the two version numbers it relies on and deal with the changes that have nothing to do with backups.

The backup fix (cluster-resources/gitea-backup-cronjob.yaml)

  • Upload container: switching from minio/mc:latest to the pinned rclone/rclone:1.75.2 is reasonable.
    • Setting command: replaces rclone's default entrypoint, and the image includes sh, so sh -c will work.
    • The connection settings are passed through environment variables. With HOME=/tmp, nothing needs to be written to a config file, which suits a container running as user 1000.
    • rclone copyto does the same job as mc cp.
    • delete --min-age 7d removes only files older than 7 days, the same as mc rm --older-than 7d.
    • The new set -e means a failed upload now fails the Job. Before, the prune step still ran and the Job could be marked as succeeded. That's an improvement.
  • Dump container: fixing the dump image to the server's version (instead of the broken 28.0.0 tag) is the right fix, and the new rule in renovate.json correctly keeps Renovate from bumping it on its own.

Check before merging (not blockers)

  1. Is 1.27.0 really the version the chart runs? The comment says chart 12.7.0 ships Gitea 1.27.0. I couldn't confirm this from the repo, and nothing in infra/values/*/gitea-values.yaml overrides the image. If the versions differ, the dump fails exactly as before. Running helm show chart gitea --repo https://dl.gitea.com/charts --version 12.7.0 will show the real version.
  2. Do the rclone/rclone:1.75.2 and gitea/gitea:1.27.0 tags actually exist? A wrong tag means ImagePullBackOff again. Running the job once by hand (kubectl create job --from=cronjob/gitea-backup …) after syncing is the quickest way to confirm the whole fix.
  3. Storage provider settings: PROVIDER=Other with no region or force_path_style set works with MinIO-style storage. Some S3-compatible providers need RCLONE_CONFIG_S3_REGION set. Check this against what S3_ENDPOINT points to.
  4. Prune scope (existing behaviour): the prune step deletes everything older than 7 days across the whole bucket, not just gitea-dump-* files. If the bucket is shared, consider adding --include "gitea-dump-*.zip".

Changes not related to backups

The PR is titled "fix backups" and has no description, but it also:

  • Deletes .gitea/workflows/ai-review.yaml. This removes the AI PR-review CI. If that's on purpose (perhaps the new ai-git-bot replaces it), say so. Some leftovers become stale:
    • docs/REFERENCE.md (lines ~1316–1373) still documents the workflow.
    • .gitmodules and the shared-prompts submodule now look unused.
  • Deletes apps/charts/claude-impl.md. This was a pasted chat transcript, so removing it is good.
  • Adds Slack notification annotations to ai-git-bot. These match the other apps (forte-drop, musicman, etc.), so they're fine.

I'd recommend splitting these out, or at least listing them in the PR description so the CI removal doesn't go unnoticed. It's a process concern, not a technical one.

Verdict: OK to merge once you've confirmed items 1–2, ideally with one manual job run. Fix the stale docs and submodule now or in a follow-up.


Read-only agentic review follow-up by AI Git Bot

## 🤖 Follow-up I don't see any hard blockers. The backup fix looks correct. Before merging, I'd check the two version numbers it relies on and deal with the changes that have nothing to do with backups. ## The backup fix (`cluster-resources/gitea-backup-cronjob.yaml`) - **Upload container:** switching from `minio/mc:latest` to the pinned `rclone/rclone:1.75.2` is reasonable. - Setting `command:` replaces rclone's default entrypoint, and the image includes `sh`, so `sh -c` will work. - The connection settings are passed through environment variables. With `HOME=/tmp`, nothing needs to be written to a config file, which suits a container running as user 1000. - `rclone copyto` does the same job as `mc cp`. - `delete --min-age 7d` removes only files older than 7 days, the same as `mc rm --older-than 7d`. - The new `set -e` means a failed upload now fails the Job. Before, the prune step still ran and the Job could be marked as succeeded. That's an improvement. - **Dump container:** fixing the dump image to the server's version (instead of the broken `28.0.0` tag) is the right fix, and the new rule in `renovate.json` correctly keeps Renovate from bumping it on its own. ## Check before merging (not blockers) 1. **Is `1.27.0` really the version the chart runs?** The comment says chart `12.7.0` ships Gitea `1.27.0`. I couldn't confirm this from the repo, and nothing in `infra/values/*/gitea-values.yaml` overrides the image. If the versions differ, the dump fails exactly as before. Running `helm show chart gitea --repo https://dl.gitea.com/charts --version 12.7.0` will show the real version. 2. **Do the `rclone/rclone:1.75.2` and `gitea/gitea:1.27.0` tags actually exist?** A wrong tag means `ImagePullBackOff` again. Running the job once by hand (`kubectl create job --from=cronjob/gitea-backup …`) after syncing is the quickest way to confirm the whole fix. 3. **Storage provider settings:** `PROVIDER=Other` with no region or `force_path_style` set works with MinIO-style storage. Some S3-compatible providers need `RCLONE_CONFIG_S3_REGION` set. Check this against what `S3_ENDPOINT` points to. 4. **Prune scope (existing behaviour):** the prune step deletes everything older than 7 days across the whole bucket, not just `gitea-dump-*` files. If the bucket is shared, consider adding `--include "gitea-dump-*.zip"`. ## Changes not related to backups The PR is titled "fix backups" and has no description, but it also: - **Deletes `.gitea/workflows/ai-review.yaml`.** This removes the AI PR-review CI. If that's on purpose (perhaps the new ai-git-bot replaces it), say so. Some leftovers become stale: - `docs/REFERENCE.md` (lines ~1316–1373) still documents the workflow. - `.gitmodules` and the `shared-prompts` submodule now look unused. - **Deletes `apps/charts/claude-impl.md`.** This was a pasted chat transcript, so removing it is good. - **Adds Slack notification annotations to `ai-git-bot`.** These match the other apps (`forte-drop`, `musicman`, etc.), so they're fine. I'd recommend splitting these out, or at least listing them in the PR description so the CI removal doesn't go unnoticed. It's a process concern, not a technical one. **Verdict:** OK to merge once you've confirmed items 1–2, ideally with one manual job run. Fix the stale docs and submodule now or in a follow-up. --- *Read-only agentic review follow-up by AI Git Bot*
danijel.simeunovic added 1 commit 2026-11-17 14:29:43 +00:00
All checks were successful
scan.yaml / test (pull_request) Successful in 7s
Checking for merge conflicts…
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin hotfix/gitea-backup:hotfix/gitea-backup
git checkout hotfix/gitea-backup
Sign in to join this conversation.