Compare commits

...

4 commits

Author SHA1 Message Date
6af5ce71cd feat(forgejo): updated secret ref for a bucket name 2025-08-01 10:31:04 +02:00
55d9a06dc7 feat(forgejo): backup s3 directly to pvc 2025-08-01 10:31:04 +02:00
Richard Robert Reitz
491be80842 fix(s3backup): doing a local backup first and then push it to remote, which is still on the same OBS store 2025-08-01 10:31:04 +02:00
Daniel Sy
e7d14a89cd feat(manifest): 🎉 WIP Add CronJob and Secret for S3 backups
Adds a new CronJob for scheduled S3 backups using rclone, along with a corresponding Secret for AWS credentials. This introduces automated backup functionality for the Forgejo server, enhancing data protection and recovery capabilities.
2025-08-01 10:31:04 +02:00
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: forgejo-s3-backup
namespace: gitea
spec:
schedule: "0 1 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: rclone
image: rclone/rclone:1.70
imagePullPolicy: IfNotPresent
env:
- name: SOURCE_BUCKET
valueFrom:
secretKeyRef:
name: forgejo-cloud-credentials
key: bucket-name
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: forgejo-cloud-credentials
key: access-key
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: forgejo-cloud-credentials
key: secret-key
volumeMounts:
- name: rclone-config
mountPath: /config/rclone
readOnly: true
- name: backup-dir
mountPath: /backup
readOnly: false
command:
- /bin/sh
- -c
- |
rclone sync source:/${SOURCE_BUCKET}/packages /backup -v --ignore-checksum
restartPolicy: OnFailure
volumes:
- name: rclone-config
secret:
secretName: forgejo-s3-backup
- name: backup-dir
persistentVolumeClaim:
claimName: s3-backup
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: s3-backup
namespace: gitea
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
---
apiVersion: v1
kind: Secret
metadata:
name: forgejo-s3-backup
namespace: gitea
type: Opaque
stringData:
rclone.conf: |
[source]
type = s3
provider = HuaweiOBS
env_auth = true
endpoint = obs.eu-de.otc.t-systems.com
region = eu-de
acl = private

View file

@ -1,3 +1,4 @@
# This is only used for deploying older versions of infra-catalogue where the bucket name is not an output of the terragrunt modules
{{{- define "BUCKET_NAME" -}}}
{{{- if (getenv "FORGEJO_BUCKET_NAME") -}}}
{{{ getenv "FORGEJO_BUCKET_NAME" }}}