From 4a00286b20eb54ceafc2406a7c0c055eea05c17f Mon Sep 17 00:00:00 2001 From: Clemens Geibel Date: Fri, 16 Sep 2022 11:57:24 +0200 Subject: [PATCH] Added backup doc and fixed init.sh --- doc/BackupAndRestore.md | 37 +++++++++++++++++++ .../docker-backup/image/resources/init.sh | 1 + 2 files changed, 38 insertions(+) create mode 100644 doc/BackupAndRestore.md diff --git a/doc/BackupAndRestore.md b/doc/BackupAndRestore.md new file mode 100644 index 0000000..68222bb --- /dev/null +++ b/doc/BackupAndRestore.md @@ -0,0 +1,37 @@ +# Backup Architecture details + +![](backup.svg) + +* we use restic to produce small & encrypted backups +* backup is scheduled at `schedule: "10 23 * * *"` +* Gitea stores files in `/data/gitea` and `/data/git/repositories`, these files are backed up. +* The postgres db is also backed up + +## Manual init the restic repository for the first time + +1. apply backup-and-restore pod: + `kubectl scale deployment backup-restore --replicas=1` +2. exec into pod and execute restore pod (press tab to get your exact pod name) + `kubectl exec -it backup-restore-... -- /usr/local/bin/init.sh` +3. remove backup-and-restore pod: + `kubectl scale deployment backup-restore --replicas=0` + + +## Manual backup the restic repository for the first time + +1. apply backup-and-restore pod: + `kubectl scale deployment backup-restore --replicas=1` +2. exec into pod and execute restore pod (press tab to get your exact pod name) + `kubectl exec -it backup-restore-... -- /usr/local/bin/backup.sh` +3. remove backup-and-restore pod: + `kubectl scale deployment backup-restore --replicas=0` + + +## Manual restore + +1. apply backup-and-restore pod: + `kubectl scale deployment backup-restore --replicas=1` +2. exec into pod and execute restore pod (press tab to get your exact pod name) + `kubectl exec -it backup-restore-... -- /usr/local/bin/restore.sh` +1. remove backup-and-restore pod: + `kubectl scale deployment backup-restore --replicas=0` diff --git a/infrastructure/docker-backup/image/resources/init.sh b/infrastructure/docker-backup/image/resources/init.sh index 322b35d..5767e69 100755 --- a/infrastructure/docker-backup/image/resources/init.sh +++ b/infrastructure/docker-backup/image/resources/init.sh @@ -10,5 +10,6 @@ function main() { } source /usr/local/lib/functions.sh +source /usr/local/lib/pg-functions.sh source /usr/local/lib/file-functions.sh main