From 7512cbfd90a0f0a85cfcece78feb4590fbd21ce4 Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Thu, 30 Nov 2023 16:34:44 -0500 Subject: [PATCH] Updates Undo --- deployment/deployment_defaults.sh | 1 + deployment/project | 2 +- deployment/project_env.sh | 3 --- deployment/remote.sh | 24 +++++++++--------------- deployment/remote_env.sh | 29 +++++++++++------------------ deployment/reset.sh | 2 +- 6 files changed, 23 insertions(+), 38 deletions(-) diff --git a/deployment/deployment_defaults.sh b/deployment/deployment_defaults.sh index 813abe0..30f6975 100755 --- a/deployment/deployment_defaults.sh +++ b/deployment/deployment_defaults.sh @@ -54,3 +54,4 @@ export WWW_SERVER_MEMORY_MB="4096" export LNPLAY_SERVER_CPU_COUNT="4" export LNPLAY_SERVER_MEMORY_MB="4096" export DOCKER_IMAGE_CACHE_FQDN="registry-1.docker.io" + diff --git a/deployment/project b/deployment/project index 5223997..0f9f564 160000 --- a/deployment/project +++ b/deployment/project @@ -1 +1 @@ -Subproject commit 52239974d4c339c34e553e2aff6678456194682c +Subproject commit 0f9f564b82862982d2726c8e8b016274e53e30aa diff --git a/deployment/project_env.sh b/deployment/project_env.sh index f49338d..d78e6e3 100755 --- a/deployment/project_env.sh +++ b/deployment/project_env.sh @@ -10,10 +10,7 @@ if [ "$PROJECT_NAME" = default ]; then exit 1 fi -BITCOIN_CHAIN=$(echo "$PROJECT_NAME" | cut -d'-' -f2) - export PROJECT_PATH="$PROJECTS_PATH/$PROJECT_NAME" -export BITCOIN_CHAIN="$BITCOIN_CHAIN" PROJECT_DEFINITION_PATH="$PROJECT_PATH/project.conf" diff --git a/deployment/remote.sh b/deployment/remote.sh index cafec6d..603641c 100755 --- a/deployment/remote.sh +++ b/deployment/remote.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -exu cd "$(dirname "$0")" # This script is meant to be executed on the management machine. @@ -139,9 +139,10 @@ fi # install dependencies. ssh -t "ubuntu@$FQDN" 'sudo apt update && sudo apt upgrade -y && sudo apt install htop dnsutils nano -y' -scp ../install_incus.sh "ubuntu@$FQDN:$REMOTE_DATA_PATH/install_incus.sh" -ssh -t "ubuntu@$FQDN" "sudo chmod +x $REMOTE_DATA_PATH/install_incus.sh" -ssh -t "ubuntu@$FQDN" "sudo bash -c $REMOTE_DATA_PATH/install_incus.sh" +REMOTE_SCRIPT_PATH="$REMOTE_HOME/install_incus.sh" +scp ../install_incus.sh "ubuntu@$FQDN:$REMOTE_SCRIPT_PATH" +ssh -t "ubuntu@$FQDN" "chmod +x $REMOTE_SCRIPT_PATH" +ssh -t "ubuntu@$FQDN" "sudo bash -c $REMOTE_SCRIPT_PATH" # install OVN for the project-specific bridge networks ssh -t "ubuntu@$FQDN" "sudo apt-get install -y ovn-host ovn-central && sudo ovs-vsctl set open_vswitch . external_ids:ovn-remote=unix:/var/run/ovn/ovnsb_db.sock external_ids:ovn-encap-type=geneve external_ids:ovn-encap-ip=127.0.0.1" @@ -193,23 +194,16 @@ profiles: pool: ss-base type: disk name: default -cluster: - server_name: ${REMOTE_NAME} - enabled: true - member_config: [] - cluster_address: "" - cluster_certificate: "" - server_address: "" - cluster_password: "" - cluster_certificate_path: "" - cluster_token: "" EOF # ensure the incus service is available over the network, then add a incus remote, then switch the active remote to it. if wait-for-it -t 20 "$FQDN:8443"; then + # before we add the remote, we need a trust token from the incus server + INCUS_CERT_TRUST_TOKEN=$(ssh ubuntu@"$FQDN" incus config trust add ss-mgmt | tail -n 1) + # now create a remote on your local incus client and switch to it. # the software will now target the new remote. - incus remote add "$REMOTE_NAME" "$FQDN" --auth-type=tls --accept-certificate + incus remote add "$REMOTE_NAME" "$FQDN" --auth-type=tls --accept-certificate --token="$INCUS_CERT_TRUST_TOKEN" incus remote switch "$REMOTE_NAME" echo "INFO: A new remote named '$REMOTE_NAME' has been created. Your incus client has been switched to it." diff --git a/deployment/remote_env.sh b/deployment/remote_env.sh index 60f02d9..fe57881 100755 --- a/deployment/remote_env.sh +++ b/deployment/remote_env.sh @@ -3,6 +3,17 @@ set -eu CURRENT_REMOTE="$(incus remote get-default)" +DEPLOYMENT_STRING= + + +SS_ROOT_PATH="$HOME/ss" +REMOTES_PATH="$SS_ROOT_PATH/remotes" +PROJECTS_PATH="$SS_ROOT_PATH/projects" +SITES_PATH="$SS_ROOT_PATH/sites" +INCUS_CONFIG_PATH="$SS_ROOT_PATH/incus" +SS_CACHE_PATH="$SS_ROOT_PATH/cache" + + if echo "$CURRENT_REMOTE" | grep -q "production"; then echo "WARNING: You are running a migration procedure on a production system." @@ -40,24 +51,6 @@ fi source "$REMOTE_DEFINITION" -# let's provision the projects if specified in the remote.conf file. -# we assume projects are created EXTERNALLY to sovereign-stack when DEPLOYMENT_STRING is null. -if [ -n "$DEPLOYMENT_STRING" ]; then - # ensure our projects are provisioned according to DEPLOYMENT_STRING - 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) - PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN" - - # create the incus project as specified by PROJECT_NAME - if ! incus project list | grep -q "$PROJECT_NAME"; then - incus project create "$PROJECT_NAME" - incus project set "$PROJECT_NAME" features.networks=true features.images=false features.storage.volumes=true - incus project switch "$PROJECT_NAME" - fi - done -fi # default values are already at regtest mode. if [ "$BITCOIN_CHAIN" = testnet ]; then diff --git a/deployment/reset.sh b/deployment/reset.sh index 294920f..24fc0ba 100755 --- a/deployment/reset.sh +++ b/deployment/reset.sh @@ -20,7 +20,7 @@ for i in "$@"; do esac done -source ../defaults.sh +source ../defaults.env ./down.sh