More fixed for backup image

This commit is contained in:
Clemens Geibel 2022-09-16 15:23:25 +02:00
parent f8b4137c60
commit 372f5c7a40
6 changed files with 21 additions and 12 deletions

View file

@ -31,7 +31,11 @@
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)
2. Scale down gitea deployment:
`kubectl scale deployment gitea --replicas=0`
3. 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:
4. Start gitea again:
`kubectl scale deployment gitea --replicas=1`
5. remove backup-and-restore pod:
`kubectl scale deployment backup-restore --replicas=0`

View file

@ -1,6 +1,7 @@
#!/bin/bash
function main() {
create-pg-pass
while true; do
sleep 1m
@ -8,4 +9,5 @@ function main() {
}
source /usr/local/lib/functions.sh
source /usr/local/lib/pg-functions.sh
main

View file

@ -1,9 +1,11 @@
#!/bin/bash
function main() {
create-pg-pass
/usr/local/bin/backup.sh
}
source /usr/local/lib/functions.sh
source /usr/local/lib/pg-functions.sh
main

View file

@ -4,7 +4,7 @@ function main() {
file_env AWS_ACCESS_KEY_ID
file_env AWS_SECRET_ACCESS_KEY
init-role-repo
#init-role-repo
init-database-repo
init-file-repo
}

View file

@ -7,6 +7,7 @@ function main() {
file_env AWS_SECRET_ACCESS_KEY
restic -r ${RESTIC_REPOSITORY}/files snapshots
restic -r ${RESTIC_REPOSITORY}/pg-database snapshots
}
source /usr/local/lib/functions.sh

View file

@ -15,16 +15,16 @@ function main() {
rm -rf /var/backups/restore
restore-directory '/var/backups/restore'
rm -rf /data/gitea/*
rm -rf /data/git/repositories/*
cp /var/backups/restore/gitea/* /data/gitea/
cp /var/backups/restore/git/repositories/* /data/git/repositories/
rm -rf /var/backups/gitea/*
rm -rf /var/backups/git/repositories/*
cp -r /var/backups/restore/gitea/* /var/backups/gitea/
cp -r /var/backups/restore/git/repositories/* /var/backups/git/repositories/
# adjust file permissions
chown -R git:git /data
# adjust file permissions for the git user
chown -R 1000:1000 /var/backups
# Regenerate Git Hooks
/usr/local/bin/gitea -c '/data/gitea/conf/app.ini' admin regenerate hooks
# TODO: Regenerate Git Hooks
#/usr/local/bin/gitea -c '/data/gitea/conf/app.ini' admin regenerate hooks
# Restore db
drop-create-db