From 19f09254e87200cb7f4a275aeb6352ef0a87497c Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Sun, 19 Nov 2023 13:59:40 -0500 Subject: [PATCH] Add restore logic back in. --- www/go.sh | 9 +++++++++ www/restore_path.sh | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/www/go.sh b/www/go.sh index 23a7dbc..7da3623 100755 --- a/www/go.sh +++ b/www/go.sh @@ -88,6 +88,15 @@ if [ "$RUN_CERT_RENEWAL" = true ] && [ "$RESTORE_CERTS" = false ] && [ "$STACKS_ #./generate_certs.sh fi + +if [ "$RESTORE_WWW" = true ]; then + APP_LIST="letsencrypt ghost gitea nostr" + for APP in $APP_LIST; do + export APP="$APP" + ./restore_path.sh + done +fi + # nginx gets deployed first since it "owns" the docker networks of downstream services. ./stub/nginx_yml.sh diff --git a/www/restore_path.sh b/www/restore_path.sh index c0b5210..73925f5 100755 --- a/www/restore_path.sh +++ b/www/restore_path.sh @@ -3,6 +3,13 @@ set -eu cd "$(dirname "$0")" +# these variable are used by both backup/restore scripts. +export REMOTE_BACKUP_PATH="$REMOTE_BACKUP_PATH/www/$APP/$DOMAIN_IDENTIFIER" +export REMOTE_SOURCE_BACKUP_PATH="$REMOTE_DATA_PATH/$APP/$DOMAIN_NAME" + +export LOCAL_BACKUP_PATH="$SITE_PATH/backups/www/$APP" +mkdir -p "$LOCAL_BACKUP_PATH" + FILE_COUNT="$(find "$LOCAL_BACKUP_PATH" -type f | wc -l)" if [ "$FILE_COUNT" = 0 ]; then exit 0