Serve a robots.txt that keeps crawlers off expensive pages #5

Open
claude wants to merge 1 commits from robots-txt into main
Member

The role now manages Gitea's robots.txt. It had none before (/robots.txt returned 404).

Why: on 2026-11-18, crawlers drove Gitea to about 10,000 requests in 10 minutes, almost all of them blame, commit, history and raw pages on DevOps/truecharts and Gaming/ashlar. ClaudeBot sent about 5,000 of them; Reflectionbot and a lot of generic Chrome user agents sent most of the rest. That saturated alpha-worker-3 (1 vCPU), where Discourse's database kept getting restarted, so Discourse was down. The companion fix is in DevOps/ansible-role-eom.

What changes:

  • files/robots.txt:
    • Crawlers can still read repository front pages, files, issues and releases.
    • It asks them to skip blame, per-commit pages, history, raw and media, archives, compare, search, feeds, /api/ and /user/.
    • It sets Crawl-delay: 10.
    • It blocks the DevOps/truecharts mirror entirely.
  • tasks/gitea.yaml:
    • A gitea-robots ConfigMap, mounted through the chart's extraVolumes and extraContainerVolumeMounts at /data/gitea/public/robots.txt. Gitea serves $GITEA_CUSTOM/public/robots.txt.
    • A kubectl rollout restart when the file changes, because a subPath mount doesn't follow ConfigMap edits.
  • defaults/main.yml: gitea_robots_txt lets you point at your own file.

Live state: the same file is already being served. With Eric's approval it was copied onto Gitea's data volume. When the role runs, the mount covers that copy, and Gitea restarts once (a few seconds of downtime).

Checked: I confirmed against chart 12.7.0's templates that extraContainerVolumeMounts reaches the main container. I didn't run a full helm template, because helm isn't installed on tower-plus or r350.

🤖 Generated with Claude Code

The role now manages Gitea's `robots.txt`. It had none before (`/robots.txt` returned 404). **Why:** on 2026-11-18, crawlers drove Gitea to about 10,000 requests in 10 minutes, almost all of them blame, commit, history and raw pages on `DevOps/truecharts` and `Gaming/ashlar`. ClaudeBot sent about 5,000 of them; Reflectionbot and a lot of generic Chrome user agents sent most of the rest. That saturated `alpha-worker-3` (1 vCPU), where Discourse's database kept getting restarted, so Discourse was down. The companion fix is in DevOps/ansible-role-eom. **What changes:** - **`files/robots.txt`:** - Crawlers can still read repository front pages, files, issues and releases. - It asks them to skip blame, per-commit pages, history, raw and media, archives, compare, search, feeds, `/api/` and `/user/`. - It sets `Crawl-delay: 10`. - It blocks the `DevOps/truecharts` mirror entirely. - **`tasks/gitea.yaml`:** - A `gitea-robots` ConfigMap, mounted through the chart's `extraVolumes` and `extraContainerVolumeMounts` at `/data/gitea/public/robots.txt`. Gitea serves `$GITEA_CUSTOM/public/robots.txt`. - A `kubectl rollout restart` when the file changes, because a subPath mount doesn't follow ConfigMap edits. - **`defaults/main.yml`:** `gitea_robots_txt` lets you point at your own file. **Live state:** the same file is already being served. With Eric's approval it was copied onto Gitea's data volume. When the role runs, the mount covers that copy, and Gitea restarts once (a few seconds of downtime). **Checked:** I confirmed against chart 12.7.0's templates that `extraContainerVolumeMounts` reaches the main container. I didn't run a full `helm template`, because helm isn't installed on tower-plus or r350. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude added 1 commit 2026-11-19 02:14:17 +00:00
Crawlers (ClaudeBot about 5,000 requests in 10 minutes, plus others) walked blame, commit and history pages and overloaded alpha-worker-3, where Discourse's database kept restarting on 2026-11-18. The role now manages robots.txt as a ConfigMap mounted at /data/gitea/public/robots.txt (gitea_robots_txt), and restarts Gitea when it changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All checks were successful
Demo / hello (push) Successful in 40s
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin robots-txt:robots-txt
git checkout robots-txt
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DevOps/ansible-role-gitea#5