1
1

Add iterate over DEPLOYMENT_STRING

This commit is contained in:
Derek Smith 2023-03-13 13:40:07 -04:00
parent c08260a2d4
commit d283dfb353
Signed by: farscapian
GPG Key ID: B443E530A14E1C90
2 changed files with 89 additions and 77 deletions

View File

@ -26,6 +26,13 @@ fi
. ./remote_env.sh . ./remote_env.sh
for PROJECT_CHAIN in ${DEPLOYMENT_STRING//,/ }; do
NO_PARENS="${PROJECT_CHAIN:1:${#PROJECT_CHAIN}-2}"
PROJECT_PREFIX=$(echo "$NO_PARENS" | cut -d'|' -f1)
BITCOIN_CHAIN=$(echo "$NO_PARENS" | cut -d'|' -f2)
export PROJECT_PREFIX="$PROJECT_PREFIX"
export BITCOIN_CHAIN="$BITCOIN_CHAIN"
. ./project_env.sh . ./project_env.sh
if ! lxc info | grep "project:" | grep -q "$PROJECT_NAME"; then if ! lxc info | grep "project:" | grep -q "$PROJECT_NAME"; then
@ -49,7 +56,6 @@ for VM in www btcpayserver; do
fi fi
done done
if lxc network list -q | grep -q ss-ovn; then if lxc network list -q | grep -q ss-ovn; then
lxc network delete ss-ovn lxc network delete ss-ovn
fi fi
@ -58,7 +64,6 @@ if ! lxc info | grep "project:" | grep -q default; then
lxc project switch default lxc project switch default
fi fi
if lxc project list | grep -q "$PROJECT_NAME"; then if lxc project list | grep -q "$PROJECT_NAME"; then
lxc project delete "$PROJECT_NAME" lxc project delete "$PROJECT_NAME"
fi fi
@ -69,3 +74,4 @@ if lxc list | grep -q "$BASE_IMAGE_VM_NAME"; then
# remove the ssh known endpoint else we get warnings. # remove the ssh known endpoint else we get warnings.
ssh-keygen -f "$SSH_HOME/known_hosts" -R "$LXD_NAME" ssh-keygen -f "$SSH_HOME/known_hosts" -R "$LXD_NAME"
fi fi
done

View File

@ -16,10 +16,15 @@ fi
. ./remote_env.sh . ./remote_env.sh
for PROJECT_CHAIN in ${DEPLOYMENT_STRING//,/ }; do
NO_PARENS="${PROJECT_CHAIN:1:${#PROJECT_CHAIN}-2}"
PROJECT_PREFIX=$(echo "$NO_PARENS" | cut -d'|' -f1)
BITCOIN_CHAIN=$(echo "$NO_PARENS" | cut -d'|' -f2)
export PROJECT_PREFIX="$PROJECT_PREFIX"
export BITCOIN_CHAIN="$BITCOIN_CHAIN"
. ./project_env.sh . ./project_env.sh
# Check to see if any of the VMs actually don't exist. # Check to see if any of the VMs actually don't exist.
# (we only migrate instantiated vms) # (we only migrate instantiated vms)
for VM in www btcpayserver; do for VM in www btcpayserver; do
@ -49,7 +54,6 @@ source ../defaults.sh
source "$SITE_PATH/site_definition" source "$SITE_PATH/site_definition"
source ./project/domain_env.sh source ./project/domain_env.sh
# now we want to switch the git HEAD of the project subdirectory to the # now we want to switch the git HEAD of the project subdirectory to the
# version of code that was last used # version of code that was last used
GIT_COMMIT_ON_REMOTE_HOST="$(ssh ubuntu@$BTCPAY_FQDN cat /home/ubuntu/.ss-githead)" GIT_COMMIT_ON_REMOTE_HOST="$(ssh ubuntu@$BTCPAY_FQDN cat /home/ubuntu/.ss-githead)"
@ -71,3 +75,5 @@ cd -
sleep 5 sleep 5
# Then we can run a restore operation and specify the backup archive at the CLI. # Then we can run a restore operation and specify the backup archive at the CLI.
bash -c "./project/deploy.sh -y --restore-www --restore-btcpay --backup-archive-path=$BTCPAY_RESTORE_ARCHIVE_PATH" bash -c "./project/deploy.sh -y --restore-www --restore-btcpay --backup-archive-path=$BTCPAY_RESTORE_ARCHIVE_PATH"
done