Updates to migration restoration.

This commit is contained in:
Derek Smith 2022-10-09 20:35:02 -04:00
parent 897e75b016
commit b5a48ef23e
Signed by: farscapian
GPG Key ID: 8F1CD799CCA516CC
3 changed files with 141 additions and 151 deletions

View File

@ -7,16 +7,11 @@ cd "$(dirname "$0")"
# it reaches out to an SSH endpoint and provisions that machine # it reaches out to an SSH endpoint and provisions that machine
# to use LXD. # to use LXD.
COMMAND="${1:-}"
DATA_PLANE_MACVLAN_INTERFACE= DATA_PLANE_MACVLAN_INTERFACE=
DISK_TO_USE=loop DISK_TO_USE=loop
if [ "$COMMAND" = create ]; then
# override the cluster name. # override the cluster name.
CLUSTER_NAME="${2:-}" CLUSTER_NAME="${1:-}"
if [ -z "$CLUSTER_NAME" ]; then if [ -z "$CLUSTER_NAME" ]; then
echo "ERROR: The cluster name was not provided." echo "ERROR: The cluster name was not provided."
exit 1 exit 1
@ -39,7 +34,7 @@ if [ "$COMMAND" = create ]; then
export LXD_CLUSTER_PASSWORD="$(gpg --gen-random --armor 1 14)" export LXD_CLUSTER_PASSWORD="$(gpg --gen-random --armor 1 14)"
export SOVEREIGN_STACK_MAC_ADDRESS="CHANGE_ME_REQUIRED" export SOVEREIGN_STACK_MAC_ADDRESS="CHANGE_ME_REQUIRED"
export PROJECT_NAME="$CLUSTER_NAME-public" export PROJECT_NAME="public"
export REGISTRY_URL="http://$(hostname).$(resolvectl status | grep 'DNS Domain:' | awk '{ print $3 }'):5000" export REGISTRY_URL="http://$(hostname).$(resolvectl status | grep 'DNS Domain:' | awk '{ print $3 }'):5000"
export REGISTRY_USERNAME="CHANGE_ME" export REGISTRY_USERNAME="CHANGE_ME"
export REGISTRY_PASSWORD="CHANGE_ME" export REGISTRY_PASSWORD="CHANGE_ME"
@ -56,7 +51,7 @@ EOL
source "$CLUSTER_DEFINITION" source "$CLUSTER_DEFINITION"
if ! lxc remote list | grep -q "$CLUSTER_NAME"; then if ! lxc remote list | grep -q "$CLUSTER_NAME"; then
FQDN="${3:-}" FQDN="${2:-}"
shift shift
if [ -z "$FQDN" ]; then if [ -z "$FQDN" ]; then
@ -215,7 +210,6 @@ cluster:
cluster_token: "" cluster_token: ""
EOF EOF
# configure the LXD Daemon with our preseed. # configure the LXD Daemon with our preseed.
cat "$CLUSTER_MASTER_LXD_INIT" | ssh "ubuntu@$FQDN" lxd init --preseed cat "$CLUSTER_MASTER_LXD_INIT" | ssh "ubuntu@$FQDN" lxd init --preseed
@ -233,7 +227,3 @@ EOF
fi fi
echo "HINT: Now you can consider running 'ss-deploy'." echo "HINT: Now you can consider running 'ss-deploy'."
else
echo "ERROR: invalid command."
exit 1
fi

View File

@ -39,7 +39,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
if [ "$RESTORE_WWW" = true ]; then if [ "$RESTORE_WWW" = true ]; then
./restore_path.sh ./restore_path.sh
ssh "$PRIMARY_WWW_FQDN" sudo chown ubuntu:ubuntu "$REMOTE_HOME/$APP" #ssh "$PRIMARY_WWW_FQDN" sudo chown ubuntu:ubuntu "$REMOTE_HOME/$APP"
elif [ "$BACKUP_APPS" = true ]; then elif [ "$BACKUP_APPS" = true ]; then
# 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
@ -87,7 +87,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
sleep 5 sleep 5
echo "STARTING restore_path.sh for letsencrypt." echo "STARTING restore_path.sh for letsencrypt."
./restore_path.sh ./restore_path.sh
ssh "$PRIMARY_WWW_FQDN" sudo chown ubuntu:ubuntu "$REMOTE_HOME/$APP" #ssh "$PRIMARY_WWW_FQDN" sudo chown ubuntu:ubuntu "$REMOTE_HOME/$APP"
elif [ "$BACKUP_APPS" = true ]; then elif [ "$BACKUP_APPS" = true ]; then
# 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

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
set -ex set -eu
export DOMAIN_NAME= export DOMAIN_NAME=
export DUPLICITY_BACKUP_PASSPHRASE= export DUPLICITY_BACKUP_PASSPHRASE=