From 8caae387b60a9eaa4ec3bc7a4e6bcc66d0af6212 Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Sun, 5 Mar 2023 11:50:22 -0500 Subject: [PATCH] Simplify and refactor. --- deployment/deploy.sh | 9 ++------- deployment/destroy.sh | 2 ++ deployment/migrate.sh | 2 ++ deployment/www/go.sh | 3 --- install.sh | 4 ++-- management/provision.sh | 2 +- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/deployment/deploy.sh b/deployment/deploy.sh index 644865e..4b1d870 100755 --- a/deployment/deploy.sh +++ b/deployment/deploy.sh @@ -397,10 +397,6 @@ export DOMAIN_COUNT=$(("$(echo "$DOMAIN_LIST" | tr -cd , | wc -c)"+1)) # let's provision our primary domain first. export DOMAIN_NAME="$PRIMARY_DOMAIN" -# we deploy the WWW and btcpay server under the PRIMARY_DOMAIN. -export DEPLOY_WWW_SERVER=true -export DEPLOY_BTCPAY_SERVER=true - export SITE_PATH="$SITES_PATH/$DOMAIN_NAME" export PRIMARY_WWW_FQDN="$WWW_HOSTNAME.$DOMAIN_NAME" @@ -409,7 +405,6 @@ stub_site_definition # bring the VMs up under the primary domain name. instantiate_vms - # let's stub out the rest of our site definitions, if any. for DOMAIN_NAME in ${OTHER_SITES_LIST//,/ }; do export DOMAIN_NAME="$DOMAIN_NAME" @@ -421,14 +416,14 @@ done # now let's run the www and btcpay-specific provisioning scripts. -if [ "$SKIP_WWW" = false ] && [ "$DEPLOY_BTCPAY_SERVER" = true ]; then +if [ "$SKIP_WWW" = false ]; then bash -c "./www/go.sh" ssh ubuntu@"$PRIMARY_WWW_FQDN" "echo $LATEST_GIT_COMMIT > /home/ubuntu/.ss-githead" fi export DOMAIN_NAME="$PRIMARY_DOMAIN" export SITE_PATH="$SITES_PATH/$DOMAIN_NAME" -if [ "$SKIP_BTCPAY" = false ] && [ "$DEPLOY_BTCPAY_SERVER" = true ]; then +if [ "$SKIP_BTCPAY" = false ]; then ./btcpayserver/go.sh ssh ubuntu@"$BTCPAY_FQDN" "echo $LATEST_GIT_COMMIT > /home/ubuntu/.ss-githead" diff --git a/deployment/destroy.sh b/deployment/destroy.sh index b4704b6..e5a7977 100755 --- a/deployment/destroy.sh +++ b/deployment/destroy.sh @@ -22,6 +22,8 @@ fi . ./cluster_env.sh +. ./project_env.sh + for VM in www btcpayserver; do LXD_NAME="$VM-${DOMAIN_NAME//./-}" diff --git a/deployment/migrate.sh b/deployment/migrate.sh index 6a254b2..6f8f5ce 100755 --- a/deployment/migrate.sh +++ b/deployment/migrate.sh @@ -21,6 +21,8 @@ done . ./cluster_env.sh +. ./project_env.sh + # Check to see if any of the VMs actually don't exist. # (we only migrate instantiated vms) for VM in www btcpayserver; do diff --git a/deployment/www/go.sh b/deployment/www/go.sh index 795c53c..78f0729 100755 --- a/deployment/www/go.sh +++ b/deployment/www/go.sh @@ -159,6 +159,3 @@ fi # xdg-open "http://$GITEA_FQDN" > /dev/null 2>&1 # fi -# if [ "$DEPLOY_BTCPAY_SERVER" = true ]; then -# xdg-open "http://$BTCPAY_USER_FQDN" > /dev/null 2>&1 -# fi diff --git a/install.sh b/install.sh index e3e043f..892d0f5 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -exu +set -eu cd "$(dirname "$0")" # see https://www.sovereign-stack.org/management/ @@ -25,7 +25,7 @@ fi # install snap if ! snap list | grep -q lxd; then sudo snap install lxd --channel=5.10/stable - sleep 3 + sleep 5 # run lxd init on the remote server./dev/nvme1n1 # diff --git a/management/provision.sh b/management/provision.sh index 070de0d..5863d43 100755 --- a/management/provision.sh +++ b/management/provision.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -ex +set -e cd "$(dirname "$0")" # NOTE! This script MUST be executed as root.