Refactor Backup
This commit is contained in:
parent
56e0e057a6
commit
6256ecd1b7
47
www/backup_www.sh
Executable file
47
www/backup_www.sh
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -exu
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
APP=
|
||||||
|
|
||||||
|
# grab any modifications from the command line.
|
||||||
|
for i in "$@"; do
|
||||||
|
case $i in
|
||||||
|
--app=*)
|
||||||
|
APP="${i#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unexpected option: $1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$APP" ]; then
|
||||||
|
echo "ERROR: You must specify the --app= paramater."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
||||||
|
export DOMAIN_NAME="$DOMAIN_NAME"
|
||||||
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
|
# source the site path so we know what features it has.
|
||||||
|
source ../../deployment_defaults.sh
|
||||||
|
source ../project_defaults.sh
|
||||||
|
source "$SITE_PATH/site.conf"
|
||||||
|
source ../domain_env.sh
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
# ensure our local backup path exists so we can pull down the duplicity archive to the management machine.
|
||||||
|
export LOCAL_BACKUP_PATH="$SITE_PATH/backups/www/$APP"
|
||||||
|
mkdir -p "$LOCAL_BACKUP_PATH"
|
||||||
|
|
||||||
|
./backup_path.sh
|
||||||
|
done
|
30
www/go.sh
30
www/go.sh
@ -87,36 +87,6 @@ if [ "$RUN_CERT_RENEWAL" = true ] && [ "$RESTORE_CERTS" = false ] && [ "$STACKS_
|
|||||||
./generate_certs.sh
|
./generate_certs.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# let's backup all our letsencrypt certs
|
|
||||||
export APP="letsencrypt"
|
|
||||||
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|
||||||
export DOMAIN_NAME="$DOMAIN_NAME"
|
|
||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
|
||||||
source ../../deployment_defaults.sh
|
|
||||||
source ../project_defaults.sh
|
|
||||||
source "$SITE_PATH/site.conf"
|
|
||||||
source ../domain_env.sh
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
# ensure our local backup path exists so we can pull down the duplicity archive to the management machine.
|
|
||||||
export LOCAL_BACKUP_PATH="$SITE_PATH/backups/www/$APP"
|
|
||||||
mkdir -p "$LOCAL_BACKUP_PATH"
|
|
||||||
|
|
||||||
# we grab a backup of the certs unless we're restoring.
|
|
||||||
if [ "$RESTORE_CERTS" = true ]; then
|
|
||||||
./restore_path.sh
|
|
||||||
else
|
|
||||||
if [ "$BACKUP_WWW_APPS" = true ]; then
|
|
||||||
./backup_path.sh
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# nginx gets deployed first since it "owns" the docker networks of downstream services.
|
# nginx gets deployed first since it "owns" the docker networks of downstream services.
|
||||||
./stub/nginx_yml.sh
|
./stub/nginx_yml.sh
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user