Control flow updates.

This commit is contained in:
Derek Smith 2022-12-25 12:59:02 -05:00
parent 69d5564e44
commit 1bc685fa74
Signed by: farscapian
GPG Key ID: 8F1CD799CCA516CC
4 changed files with 59 additions and 52 deletions

View File

@ -23,6 +23,7 @@ RECONFIGURE_BTCPAY_SERVER=false
CLUSTER_NAME="$(lxc remote get-default)" CLUSTER_NAME="$(lxc remote get-default)"
STOP_SERVICES=false STOP_SERVICES=false
USER_SAYS_YES=false USER_SAYS_YES=false
RESTART_FRONT_END=false
# grab any modifications from the command line. # grab any modifications from the command line.
for i in "$@"; do for i in "$@"; do

View File

@ -34,4 +34,5 @@ scp -r "$LOCAL_BACKUP_PATH" "$PRIMARY_WWW_FQDN:$REMOTE_BACKUP_PATH"
# now we run duplicity to restore the archive. # now we run duplicity to restore the archive.
ssh "$PRIMARY_WWW_FQDN" sudo PASSPHRASE="$DUPLICITY_BACKUP_PASSPHRASE" duplicity --force restore "file://$REMOTE_BACKUP_PATH/$APP" "$REMOTE_SOURCE_BACKUP_PATH/" ssh "$PRIMARY_WWW_FQDN" sudo PASSPHRASE="$DUPLICITY_BACKUP_PASSPHRASE" duplicity --force restore "file://$REMOTE_BACKUP_PATH/$APP" "$REMOTE_SOURCE_BACKUP_PATH/"
ssh "$PRIMARY_WWW_FQDN" sudo chown ubuntu:ubuntu "$REMOTE_BACKUP_PATH" # reset folder owner to ubuntu
ssh "$PRIMARY_WWW_FQDN" sudo chown ubuntu:ubuntu "$REMOTE_HOME/$APP"

View File

@ -48,6 +48,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
done done
done done
if [ "$RESTART_FRONT_END" = true ]; then
# remove the nginx stack # remove the nginx stack
if docker stack list --format "{{.Name}}" | grep -q reverse-proxy; then if docker stack list --format "{{.Name}}" | grep -q reverse-proxy; then
sleep 2 sleep 2
@ -60,12 +61,6 @@ if docker stack list --format "{{.Name}}" | grep -q reverse-proxy; then
fi fi
#
if [ "$STOP_SERVICES" = true ]; then
echo "STOPPING as indicated by the --stop flag."
exit 0
fi
# generate the certs and grab a backup # generate the certs and grab a backup
if [ "$RUN_CERT_RENEWAL" = true ]; then if [ "$RUN_CERT_RENEWAL" = true ]; then
./generate_certs.sh ./generate_certs.sh
@ -100,3 +95,4 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
./backup_path.sh ./backup_path.sh
fi fi
done done
fi

View File

@ -6,10 +6,19 @@ cd "$(dirname "$0")"
CURRENT_CLUSTER="$(lxc remote get-default)" CURRENT_CLUSTER="$(lxc remote get-default)"
if echo "$CURRENT_CLUSTER" | grep -q "production"; then if echo "$CURRENT_CLUSTER" | grep -q "production"; then
echo "ERROR: YOU MUST COMMENT THIS OUT BEFORE YOU CAN RUN MIGRATE ON PROUDCTION/." echo "WARNING: You are running a migration procedure on a production system."
echo ""
RESPONSE=
read -r -p " Are you sure you want to continue (y) ": RESPONSE
if [ "$RESPONSE" != "y" ]; then
echo "STOPPING."
exit 1 exit 1
fi fi
fi
source ./defaults.sh source ./defaults.sh
export CLUSTER_PATH="$CLUSTERS_DIR/$CURRENT_CLUSTER" export CLUSTER_PATH="$CLUSTERS_DIR/$CURRENT_CLUSTER"