c4k-forgejo/doc/BackupAndRestore.md

42 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2022-09-16 09:57:24 +00:00
# Backup Architecture details
![](backup.svg)
* we use restic to produce small & encrypted backups
* backup is scheduled at `schedule: "10 23 * * *"`
2023-04-21 06:56:06 +00:00
* Forgejo stores files in `/data/gitea` and `/data/git/repositories`, these files are backed up.
2022-09-16 09:57:24 +00:00
* The postgres db is also backed up
## Manual init the restic repository for the first time
1. apply backup-and-restore pod:
`kubectl -n forgejo scale deployment backup-restore --replicas=1`
2022-09-16 09:57:24 +00:00
2. exec into pod and execute restore pod (press tab to get your exact pod name)
`kubectl -n forgejo exec -it backup-restore-... -- /usr/local/bin/init.bb`
2022-09-16 09:57:24 +00:00
3. remove backup-and-restore pod:
`kubectl -n forgejo scale deployment backup-restore --replicas=0`
2022-09-16 09:57:24 +00:00
## Manual backup the restic repository for the first time
1. apply backup-and-restore pod:
`kubectl -n forgejo scale deployment backup-restore --replicas=1`
2022-10-21 09:01:50 +00:00
2. exec into pod and execute backup pod (press tab to get your exact pod name)
`kubectl -n forgejo exec -it backup-restore-... -- /usr/local/bin/backup.bb`
2022-09-16 09:57:24 +00:00
3. remove backup-and-restore pod:
`kubectl -n forgejo scale deployment backup-restore --replicas=0`
2022-09-16 09:57:24 +00:00
## Manual restore
1. apply backup-and-restore pod:
`kubectl -n forgejo scale deployment backup-restore --replicas=1`
2023-04-21 06:56:06 +00:00
2. Scale down forgejo deployment:
`kubectl -n forgejo scale deployment forgejo --replicas=0`
2022-09-16 13:23:25 +00:00
3. exec into pod and execute restore pod (press tab to get your exact pod name)
`kubectl -n forgejo exec -it backup-restore-... -- /usr/local/bin/restore.bb`
2023-04-21 06:56:06 +00:00
4. Start forgejo again:
`kubectl -n forgejo scale deployment forgejo --replicas=1`
2022-09-16 13:23:25 +00:00
5. remove backup-and-restore pod:
`kubectl -n forgejo scale deployment backup-restore --replicas=0`