homek8s/apps/base/forgejo/deployment.yaml
Lance Walters 01db28dec5 apps(forgejo): serve a declarative robots.txt that keeps non-portfolio paths out of the index
Self-registration was open until 2026-11-20 and Google indexed spam
profiles under forgejo.siriusdevops.com (/leonabrewton8, /charlinebrando,
.../-/packages). The accounts are deleted and 404 now, but Forgejo's
built-in robots.txt only blocks /explore/*?* and /user/, so /explore/repos
and /search stay crawlable.

Forgejo serves GITEA_CUSTOM=/data/gitea/public/robots.txt at /robots.txt,
so mount a ConfigMap there (the supported custom-public override) and
disallow /explore/*, /user/*, /search*, /api/*, /*/-/packages while
allowing /sirius/* for the portfolio repos.
2026-11-23 22:50:52 -05:00

87 lines
2.6 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: forgejo
namespace: forgejo
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: forgejo
template:
metadata:
labels:
app: forgejo
spec:
nodeSelector:
kubernetes.io/hostname: siriussec
containers:
- name: forgejo
image: codeberg.org/forgejo/forgejo:16
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
name: http
env:
- name: FORGEJO__database__DB_TYPE
value: postgres
- name: FORGEJO__database__HOST
value: pg-rw:5432
- name: FORGEJO__database__NAME
value: forgejo
- name: FORGEJO__database__USER
valueFrom:
secretKeyRef:
name: forgejo-pg-app
key: username
- name: FORGEJO__database__PASSWD
valueFrom:
secretKeyRef:
name: forgejo-pg-app
key: password
- name: FORGEJO__server__ROOT_URL
value: https://forgejo.siriusdevops.com/
- name: FORGEJO__server__DOMAIN
value: forgejo.siriusdevops.com
- name: FORGEJO__server__SSH_DOMAIN
value: forgejo.siriusdevops.com
- name: FORGEJO__server__SSH_PORT
value: "222"
- name: FORGEJO__server__PROTOCOL
value: http
- name: FORGEJO__security__INSTALL_LOCK
value: "true"
- name: FORGEJO__packages__ENABLED
value: "true"
# Bot signup lockdown: admin-only account creation (web + API).
- name: FORGEJO__service__DISABLE_REGISTRATION
value: "true"
volumeMounts:
- name: data
mountPath: /data
# Custom site-root assets (robots.txt). GITEA_CUSTOM=/data/gitea,
# so Forgejo serves /data/gitea/public/robots.txt at /robots.txt.
- name: custom-public
mountPath: /data/gitea/public
readOnly: true
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 20
periodSeconds: 10
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
memory: 2Gi
volumes:
- name: data
persistentVolumeClaim:
claimName: forgejo-data
- name: custom-public
configMap:
name: forgejo-custom-public