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

39 lines
921 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
rm -rf /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/*
2022-10-07 09:37:31 +00:00
cp -r /var/backups/restore/gitea /var/backups/
cp -r /var/backups/restore/git/repositories /var/backups/git/
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