Compare commits
5 Commits
8b6db37380
...
355adb13ab
Author | SHA1 | Date | |
---|---|---|---|
355adb13ab | |||
17d7e9c75a | |||
575deff1d2 | |||
6fef36096e | |||
0c6e00deb2 |
@ -13,6 +13,7 @@ export INCUS_CONFIG_PATH="$SS_ROOT_PATH/incus"
|
||||
export SS_CACHE_PATH="$SS_ROOT_PATH/cache"
|
||||
|
||||
|
||||
|
||||
export REMOTE_HOME="/home/ubuntu"
|
||||
export REMOTE_DATA_PATH="$REMOTE_HOME/ss-data"
|
||||
export REMOTE_DATA_PATH_LETSENCRYPT="$REMOTE_DATA_PATH/letsencrypt"
|
||||
|
@ -10,7 +10,7 @@ if incus remote get-default -q | grep -q "local"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
KEEP_DOCKER_VOLUME=true
|
||||
KEEP_ZFS_STORAGE_VOLUMES=true
|
||||
OTHER_SITES_LIST=
|
||||
SKIP_BTCPAY_SERVER=false
|
||||
SKIP_WWW_SERVER=false
|
||||
@ -25,7 +25,7 @@ LNPLAY_SERVER_MAC_ADDRESS=
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
--purge)
|
||||
KEEP_DOCKER_VOLUME=false
|
||||
KEEP_ZFS_STORAGE_VOLUMES=false
|
||||
shift
|
||||
;;
|
||||
--skip-btcpayserver)
|
||||
@ -62,13 +62,16 @@ source ./project/domain_env.sh
|
||||
|
||||
source ./domain_list.sh
|
||||
|
||||
|
||||
|
||||
|
||||
SERVERS=
|
||||
if [ "$SKIP_BTCPAY_SERVER" = false ] && [ -n "$WWW_SERVER_MAC_ADDRESS" ]; then
|
||||
SERVERS="btcpayserver"
|
||||
if [ "$SKIP_WWW_SERVER" = false ] && [ -n "$WWW_SERVER_MAC_ADDRESS" ]; then
|
||||
SERVERS="www $SERVERS"
|
||||
fi
|
||||
|
||||
if [ "$SKIP_WWW_SERVER" = false ] && [ -n "$BTCPAY_SERVER_MAC_ADDRESS" ]; then
|
||||
SERVERS="www $SERVERS"
|
||||
if [ "$SKIP_BTCPAY_SERVER" = false ] && [ -n "$BTCPAY_SERVER_MAC_ADDRESS" ]; then
|
||||
SERVERS="btcpayserver"
|
||||
fi
|
||||
|
||||
if [ "$SKIP_LNPLAY_SERVER" = false ] && [ -n "$LNPLAY_SERVER_MAC_ADDRESS" ]; then
|
||||
@ -76,6 +79,7 @@ if [ "$SKIP_LNPLAY_SERVER" = false ] && [ -n "$LNPLAY_SERVER_MAC_ADDRESS" ]; the
|
||||
fi
|
||||
|
||||
|
||||
|
||||
for VIRTUAL_MACHINE in $SERVERS; do
|
||||
|
||||
INCUS_VM_NAME="$VIRTUAL_MACHINE-${PRIMARY_DOMAIN//./-}"
|
||||
@ -95,8 +99,7 @@ for VIRTUAL_MACHINE in $SERVERS; do
|
||||
incus profile delete "$INCUS_VM_NAME"
|
||||
fi
|
||||
|
||||
if [ "$KEEP_DOCKER_VOLUME" = false ]; then
|
||||
|
||||
if [ "$KEEP_ZFS_STORAGE_VOLUMES" = false ]; then
|
||||
# d for docker; b for backup; s for ss-data
|
||||
for DATA in docker backup ss-data; do
|
||||
VOLUME_NAME="$VIRTUAL_MACHINE-$DATA"
|
||||
@ -109,13 +112,29 @@ for VIRTUAL_MACHINE in $SERVERS; do
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
# we maintain the volumes
|
||||
# TODO make a snapshot on all the zfs storage volumes.
|
||||
echo "TODO: create snapshot of ZFS volumes and pull them to mgmt machine."
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
BACKUP_WWW_APPS=true
|
||||
echo "BACKUP_WWW_APPS: $BACKUP_WWW_APPS"
|
||||
|
||||
|
||||
echo "SERVERS: $SERVERS"
|
||||
echo "BACKUP_WWW_APPS: $BACKUP_WWW_APPS"
|
||||
|
||||
|
||||
# let's grab a snapshot of the
|
||||
if [ "$BACKUP_WWW_APPS" = true ]; then
|
||||
#SNAPSHOT_ID=$(cat /dev/urandom | tr -dc 'a-aA-Z' | fold -w 6 | head -n 1)
|
||||
#incus storage volume snapshot create ss-base www-ss-data "$SNAPSHOT_ID"
|
||||
BACKUP_LOCATION="$HOME/ss/backups"
|
||||
mkdir -p "$BACKUP_LOCATION"
|
||||
incus storage volume export ss-base "www-ss-data" "$BACKUP_LOCATION/project-$(incus project list --format csv | grep "(current)" | awk '{print $1}')_www-ss-data_""$(date +%s)"".tar.gz"
|
||||
#incus storage volume snapshot delete ss-base "www-ss-data" "$SNAPSHOT_ID"
|
||||
fi
|
||||
|
||||
|
||||
if incus network list -q | grep -q ss-ovn; then
|
||||
incus network delete ss-ovn
|
||||
fi
|
||||
|
@ -196,6 +196,8 @@ profiles:
|
||||
name: default
|
||||
EOF
|
||||
|
||||
ssh ubuntu@"$FQDN" incus project list -q >> /dev/null
|
||||
|
||||
# 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
|
||||
@ -234,8 +236,4 @@ if ! incus storage list --format csv | grep -q ss-base; then
|
||||
# done
|
||||
# done
|
||||
|
||||
else
|
||||
echo "WARNING! The host '$FQDN' appears to have Sovereign Stack worksloads already provisioned."
|
||||
echo "INFO: Here are your current Deployments."
|
||||
incus project list -q
|
||||
fi
|
||||
|
@ -426,8 +426,9 @@ EOL
|
||||
|
||||
LNPLAY_ENV_FILE=./project/lnplay/environments/"$LNPLAY_SERVER_FQDN"
|
||||
|
||||
# and we have to set our environment file as well.
|
||||
cat > "$LNPLAY_ENV_FILE" <<EOL
|
||||
if [ ! -f "$LNPLAY_ENV_FILE" ]; then
|
||||
# and we have to set our environment file as well.
|
||||
cat > "$LNPLAY_ENV_FILE" <<EOL
|
||||
DOCKER_HOST=ssh://ubuntu@${LNPLAY_SERVER_FQDN}
|
||||
DOMAIN_NAME=${PRIMARY_DOMAIN}
|
||||
ENABLE_TLS=true
|
||||
@ -435,8 +436,11 @@ BTC_CHAIN=${BITCOIN_CHAIN}
|
||||
CHANNEL_SETUP=none
|
||||
LNPLAY_SERVER_PATH=${SITES_PATH}/${PRIMARY_DOMAIN}/lnplayserver
|
||||
DEPLOY_PRISM_PLUGIN=true
|
||||
NAMES_FILE_PATH
|
||||
EOL
|
||||
|
||||
fi
|
||||
|
||||
INCUS_VM_NAME="${LNPLAY_SERVER_FQDN//./-}"
|
||||
if ! incus image list -q --format csv | grep -q "$INCUS_VM_NAME"; then
|
||||
# do all the docker image creation steps, but don't run services.
|
||||
|
@ -65,5 +65,10 @@ Architectures: $(dpkg --print-architecture)
|
||||
Signed-By: /etc/apt/keyrings/zabbly.asc
|
||||
|
||||
EOF'
|
||||
|
||||
apt-get update
|
||||
apt-get install incus -y --no-install-recommends
|
||||
|
||||
# we || true this here because installing incus fails.
|
||||
# TODO see if this can be fixed by installing JUST the incus client.
|
||||
# none of the systemd/daemon stuff is needed necessarily.
|
||||
apt-get install incus -y
|
||||
|
Loading…
Reference in New Issue
Block a user