forked from ss/sovereign-stack
Control flow updates.
This commit is contained in:
parent
69d5564e44
commit
1bc685fa74
@ -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
|
||||||
|
@ -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"
|
@ -48,8 +48,9 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# remove the nginx stack
|
if [ "$RESTART_FRONT_END" = true ]; then
|
||||||
if docker stack list --format "{{.Name}}" | grep -q reverse-proxy; then
|
# remove the nginx stack
|
||||||
|
if docker stack list --format "{{.Name}}" | grep -q reverse-proxy; then
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
docker stack rm reverse-proxy
|
docker stack rm reverse-proxy
|
||||||
@ -58,22 +59,16 @@ if docker stack list --format "{{.Name}}" | grep -q reverse-proxy; then
|
|||||||
# TODO see if there's a way to check for this.
|
# TODO see if there's a way to check for this.
|
||||||
sleep 15
|
sleep 15
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
# generate the certs and grab a backup
|
||||||
if [ "$STOP_SERVICES" = true ]; then
|
if [ "$RUN_CERT_RENEWAL" = true ]; then
|
||||||
echo "STOPPING as indicated by the --stop flag."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# generate the certs and grab a backup
|
|
||||||
if [ "$RUN_CERT_RENEWAL" = true ]; then
|
|
||||||
./generate_certs.sh
|
./generate_certs.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# let's backup all our letsencrypt certs
|
# let's backup all our letsencrypt certs
|
||||||
export APP="letsencrypt"
|
export APP="letsencrypt"
|
||||||
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
||||||
export DOMAIN_NAME="$DOMAIN_NAME"
|
export DOMAIN_NAME="$DOMAIN_NAME"
|
||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
@ -99,4 +94,5 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
# if we're not restoring, then we may or may not back up.
|
# if we're not restoring, then we may or may not back up.
|
||||||
./backup_path.sh
|
./backup_path.sh
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
11
migrate.sh
11
migrate.sh
@ -6,8 +6,17 @@ 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
|
||||||
|
Loading…
Reference in New Issue
Block a user