Nothing on this platform backed up Forgejo or the CloudNativePG databases; docs/cluster-overview.md had claimed both must be backed up for months. New CronJob forgejo/cluster-backup (37 2 * * * UTC, Forbid) streams to [email protected]:/root/cluster-backup over the WireGuard mesh: * forgejo-data PVC mirrored with rsync --link-dest (snapshot per night, hardlinked, readonly PVC mount, transient upload spools excluded, rsync exit 24 tolerated because Forgejo is live while it runs); * pg_dump -Fc from inside each CNPG primary (local socket, no DB password in git) for forgejo/pg and sirius-growth/portal, sha256-verified on both sides before the .part file is renamed. Nothing is staged on siriussec (83% full, DiskPressure hazard); the job has an ephemeral-storage cap of 1Gi to make that structural. Job lives in ns forgejo because a PVC cannot be mounted cross-namespace; the portal dump uses exec-only RBAC declared in apps/base/sirius-growth/backup-exec-rbac.yaml. Only secret is forgejo/cluster-backup-ssh (out of band, not in git): from=-restricted ed25519 key on the Linode, host key pinned. docs/cluster-overview.md: §8.1 coverage + honest gaps, §8.2 restore runbook, live PVC/disk numbers corrected.
41 lines
1.1 KiB
YAML
41 lines
1.1 KiB
YAML
---
|
|
# Lets the nightly `forgejo/cluster-backup` CronJob take a `pg_dump` of this
|
|
# namespace's CloudNativePG cluster through the exec API (namespace `forgejo`
|
|
# cannot mount a Secret from here, and the dump runs as the in-pod `postgres`
|
|
# superuser over the local socket, so no database password exists in git).
|
|
#
|
|
# Least privilege: that ServiceAccount may look up the Cluster object and run
|
|
# one command inside this namespace's pods — nothing else.
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: Role
|
|
metadata:
|
|
name: cluster-backup
|
|
namespace: sirius-growth
|
|
labels:
|
|
app: cluster-backup
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["pods"]
|
|
verbs: ["get", "list"]
|
|
- apiGroups: [""]
|
|
resources: ["pods/exec"]
|
|
verbs: ["create"]
|
|
- apiGroups: ["postgresql.cnpg.io"]
|
|
resources: ["clusters"]
|
|
verbs: ["get"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: cluster-backup
|
|
namespace: sirius-growth
|
|
labels:
|
|
app: cluster-backup
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: Role
|
|
name: cluster-backup
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: cluster-backup
|
|
namespace: forgejo
|