Added backup doc and fixed init.sh

This commit is contained in:
Clemens Geibel 2022-09-16 11:57:24 +02:00
parent 965d2b4639
commit 4a00286b20
2 changed files with 38 additions and 0 deletions

37
doc/BackupAndRestore.md Normal file
View file

@ -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`

View file

@ -10,5 +10,6 @@ function main() {
} }
source /usr/local/lib/functions.sh source /usr/local/lib/functions.sh
source /usr/local/lib/pg-functions.sh
source /usr/local/lib/file-functions.sh source /usr/local/lib/file-functions.sh
main main