Add backup/restore functionality
continuous-integration/drone/push Build is passing Details

This commit is contained in:
3wc 2021-02-24 16:55:36 +02:00
parent 4812fc9829
commit 49b14595d4
1 changed files with 38 additions and 0 deletions

38
abra.sh
View File

@ -5,3 +5,41 @@ export COMPOSER_LOCAL_CONF_VERSION=v1
export PHP_INI_VERSION=v1
export SAML_ENTRYPOINT_CONF_VERSION=v1
abra_backup_app() {
_abra_backup_dir "app:/var/www/html/images"
}
abra_backup_db() {
_abra_backup_mysql "db" "mediawiki"
}
abra_backup() {
abra_backup_app && abra_backup_db
}
abra_restore_app() {
# shellcheck disable=SC2034
{
abra__src_="-"
abra__dst_="app:/var/www/html/"
}
zcat "$@" | sub_app_cp
success "Restored 'app'"
}
abra_restore_db() {
# 3wc: unlike abra_backup_db, we can assume abra__service_ will be 'db' if we
# got this far..
# shellcheck disable=SC2034
abra___no_tty="true"
DB_ROOT_PASSWORD="$(sub_app_run cat /run/secrets/db_root_password)"
zcat "$@" | sub_app_run mysql -u root -p"$DB_ROOT_PASSWORD" wordpress
success "Restored 'db'"
}