c4k-forgejo/infrastructure/backup/image/resources/restore.sh

38 lines
969 B
Bash
Raw Normal View History

2022-08-19 09:59:04 +00:00
#!/bin/bash
set -Eeo pipefail
function main() {
file_env AWS_ACCESS_KEY_ID
file_env AWS_SECRET_ACCESS_KEY
file_env POSTGRES_DB
file_env POSTGRES_PASSWORD
file_env POSTGRES_USER
# Restore latest snapshot into /var/backups/restore
restore-directory '/var/backups/restore'
2022-09-16 13:23:25 +00:00
rm -rf /var/backups/gitea/*
rm -rf /var/backups/git/repositories/*
2023-10-24 12:36:54 +00:00
cp -r /var/backups/restore/gitea /var/backups/ #ToDo: mv instead of cp or rm -rf after
cp -r /var/backups/restore/git/repositories /var/backups/git/ #ToDo: mv instead of cp or rm -rf after
2022-08-19 09:59:04 +00:00
2022-09-16 13:23:25 +00:00
# adjust file permissions for the git user
chown -R 1000:1000 /var/backups
2022-08-19 09:59:04 +00:00
2022-09-16 14:44:14 +00:00
# TODO: Regenerate Git Hooks? Do we need this?
2022-09-16 13:23:25 +00:00
#/usr/local/bin/gitea -c '/data/gitea/conf/app.ini' admin regenerate hooks
2022-08-19 09:59:04 +00:00
# Restore db
drop-create-db
restore-db
}
source /usr/local/lib/functions.sh
source /usr/local/lib/pg-functions.sh
source /usr/local/lib/file-functions.sh
main