Browse Source

Adding remote backup job and cronjob manifests

bodicsek 1 year ago
parent
commit
d130623eeb
4 changed files with 69 additions and 8 deletions
  1. 19 3
      README.org
  2. 6 0
      backup.remote.cronjob.yaml
  3. 44 0
      backup.remote.job.yaml
  4. 0 5
      backup.remote.pod.yaml

+ 19 - 3
README.org

@@ -28,9 +28,25 @@ It creates a =restic-cli= pod on ~raspberrypi4~.
 Select the snapshot id by running =restic --repo /data/repo snapshots --insecure-no-password=.
 Run =restic --repo /data/repo restore <snapshot_id> /data/glusterfs --insecure-no-password= to fully restore from a snapshot.
 
-* Remote backup - WIP
+* Remote backup
 
-=kubectl apply -f backup.remote.pod.yaml=
+[[https://rclone.org/commands/rclone_sync/][Rclone sync]] is used to copy the local restic repo to a remote destination.
+Remote destination is currently an Oracle Object Storage called ~backup~ in ~davidnabraczkyhajos~ tenancy.
+The API key secret and the rclone/oci config maps are created in =backup.remote.cronjob.yaml=. Apply this before anything else, it will create a cron job that runs every Sunday at 8:00 am.
+
+** One time backup
+
+Apply =backup.remote.job.yaml=.
+
+** Scheduled backup
+
+Apply =backup.remote.cronjob.yaml=.
+
+** Restore
+
+Apply =backup.remote.pod.yaml=.
 It creates an =rclone-cli= pod on ~raspberrypi4~.
 =kubectl exec -it rclone-cli -- /bin/sh= gives you a shell in the pod's container.
-Run =rclone -vvv --progress --stats-one-line --max-stats-groups 10 --log-format date,time,UTC,longfile --fast-list --buffer-size 256Mi --oos-no-check-bucket --oos-upload-cutoff 10Mi --multi-thread-cutoff 16Mi --multi-thread-streams 3000 --transfers 3000 --checkers 64 --retries 2 --oos-chunk-size 10Mi --oos-upload-concurrency 10000 --oos-attempt-resume-upload --oos-leave-parts-on-error sync /data/repo oos:backup -vv= 
+Run =rclone sync --progress --verbose --verbose --cache-workes 4 --transfers 4 --retries 32 oos:backup /data/repo/restore=.
+Use ~--dry-run~ first.
+

File diff suppressed because it is too large
+ 6 - 0
backup.remote.cronjob.yaml


+ 44 - 0
backup.remote.job.yaml

@@ -0,0 +1,44 @@
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: backup-remote
+spec:
+  template:
+    spec:
+      containers:
+      - args: ["sync", "--verbose", "--verbose", "--cache-workers", "4", "--transfers", "4", "--retries", "32", "--oos-attempt-resume-upload", "--oos-leave-parts-on-error", "/data/repo", "oos:backup"]
+        image: rclone/rclone:1.68
+        imagePullPolicy: IfNotPresent
+        name: rclone-cli
+        volumeMounts:
+          - name: restic-repo-vol
+            mountPath: /data/repo
+          - name: rclone-conf-vol
+            mountPath: /config/rclone
+          - name: oci-conf-vol
+            mountPath: /config/oci
+          - name: oci-api-key-vol
+            mountPath: /config/oci-keys
+      volumes:
+      - name: restic-repo-vol
+        hostPath:
+          path: /data/backup
+          type: Directory
+      - name: rclone-conf-vol
+        configMap:
+          name: rclone-config-oos
+          items:
+          - key: rclone.conf
+            path: rclone.conf
+      - name: oci-conf-vol
+        configMap:
+          name: rclone-config-oos
+          items:
+          - key: oci.conf
+            path: config
+      - name: oci-api-key-vol
+        secret:
+          secretName: rclone-remote-backup-api-key
+      restartPolicy: Never
+      nodeSelector:
+        kubernetes.io/hostname: raspberrypi4

File diff suppressed because it is too large
+ 0 - 5
backup.remote.pod.yaml


Some files were not shown because too many files changed in this diff