1
0
Fork 0

k/forgejo: add robots to ban facebook/meta

This commit is contained in:
Ryan Heywood 2024-09-07 00:43:52 -04:00
parent f243bb2d4b
commit 4bba28e670
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
3 changed files with 58 additions and 0 deletions

View File

@ -19,6 +19,13 @@ spec:
name: forgejo
port:
number: 80
- path: /robots.txt
pathType: Exact
backend:
service:
name: robots
port:
number: 80
tls:
- hosts:
- git.distrust.co

View File

@ -5,6 +5,7 @@ resources:
- namespace.yaml
- resources.yaml
- ingress.yaml
- robots.yaml
- snapshots
patches:
- path: forgejo-env-vars.patch.yaml

View File

@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: robots
spec:
replicas: 1
selector:
matchLabels:
app: robots
template:
metadata:
labels:
app: robots
spec:
containers:
- name: robots
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: robots-txt
mountPath: /usr/share/nginx/html
volumes:
- name: robots-txt
configMap:
name: robots-txt
---
apiVersion: v1
kind: ConfigMap
metadata:
name: robots-txt
data:
# Facebook/Meta have a web crawler that absolutely _spams_ Forgejo when
# large repositories exist. It's nonstop requests.
robots.txt: |-
User-agent: facebookexternalhit
User-agent: meta-externalagent
Disallow: /
---
apiVersion: v1
kind: Service
metadata:
name: robots
spec:
ports:
- name: http
port: 80
targetPort: 80
selector:
app: robots