Add three-scenario disaster recovery
This commit is contained in:
+15
-2
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Restore Athena's non-reproducible Docker state from the latest /data backup.
|
||||
# Restore Athena's configuration, deployed source and non-reproducible Docker
|
||||
# state from a local quick-recovery archive.
|
||||
set -Eeuo pipefail
|
||||
umask 077
|
||||
|
||||
@@ -69,6 +70,16 @@ done
|
||||
install -d -m 0700 /etc/mike-ai
|
||||
rsync -a --delete "$backup_root/etc-mike-ai/" /etc/mike-ai/
|
||||
|
||||
# New archives contain all deployed projects. Accept the old stack-only layout
|
||||
# as well so every already existing backup stays usable.
|
||||
if [[ -d $backup_root/opt-mike-ai ]]; then
|
||||
install -d -m 0755 /opt/mike-ai
|
||||
rsync -a "$backup_root/opt-mike-ai/" /opt/mike-ai/
|
||||
elif [[ -d $backup_root/stack ]]; then
|
||||
install -d -m 0755 /opt/mike-ai/stack
|
||||
rsync -a "$backup_root/stack/" /opt/mike-ai/stack/
|
||||
fi
|
||||
|
||||
restore_volume() {
|
||||
local volume=$1 source=$2 mountpoint
|
||||
[[ -d $source ]] || return 0
|
||||
@@ -82,7 +93,9 @@ restore_volume mike-ai_router-state "$backup_root/volumes/router-state"
|
||||
restore_volume mike-ai_router-images "$backup_root/volumes/router-images"
|
||||
restore_volume portainer_data "$backup_root/volumes/portainer-data"
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
deploy_root=/opt/mike-ai/stack
|
||||
[[ -x $deploy_root/manage.sh ]] || deploy_root=$ROOT_DIR
|
||||
cd "$deploy_root"
|
||||
./manage.sh deploy core
|
||||
|
||||
printf 'ATHENA_RESTORE_OK %s\n' "$ARCHIVE"
|
||||
|
||||
Reference in New Issue
Block a user