1
1

Add --skip logic for VMs.

This commit is contained in:
Derek Smith 2023-08-12 12:14:00 -04:00
parent f41601ad04
commit 919acbf172
Signed by: farscapian
GPG Key ID: B443E530A14E1C90
3 changed files with 47 additions and 2 deletions

View File

@ -36,6 +36,10 @@ if ! lxc list --format csv | grep -q "$LXD_VM_NAME"; then
SSDATA_DISK_SIZE_GB=
DOCKER_DISK_SIZE_GB=
if [ "$VIRTUAL_MACHINE" = www ]; then
if [ "$SKIP_WWW" = true ]; then
exit 0
fi
VM_ID="w"
BACKUP_DISK_SIZE_GB="$WWW_BACKUP_DISK_SIZE_GB"
SSDATA_DISK_SIZE_GB="$WWW_SSDATA_DISK_SIZE_GB"
@ -43,6 +47,10 @@ if ! lxc list --format csv | grep -q "$LXD_VM_NAME"; then
fi
if [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
if [ "$SKIP_BTCPAYSERVER" = true ]; then
exit 0
fi
VM_ID="b"
BACKUP_DISK_SIZE_GB="$BTCPAYSERVER_BACKUP_DISK_SIZE_GB"
SSDATA_DISK_SIZE_GB="$BTCPAYSERVER_SSDATA_DISK_SIZE_GB"
@ -50,6 +58,10 @@ if ! lxc list --format csv | grep -q "$LXD_VM_NAME"; then
fi
if [ "$VIRTUAL_MACHINE" = clamsserver ]; then
if [ "$SKIP_CLAMSSERVER" = true ]; then
exit 0
fi
VM_ID="c"
BACKUP_DISK_SIZE_GB="$BTCPAYSERVER_BACKUP_DISK_SIZE_GB"
SSDATA_DISK_SIZE_GB="$BTCPAYSERVER_SSDATA_DISK_SIZE_GB"

View File

@ -11,6 +11,9 @@ if lxc remote get-default -q | grep -q "local"; then
fi
KEEP_DOCKER_VOLUME=true
SKIP_BTCPAYSERVER=false
SKIP_WWW=false
SKIP_CLAMSSERVER=false
# grab any modifications from the command line.
for i in "$@"; do
@ -19,6 +22,18 @@ for i in "$@"; do
KEEP_DOCKER_VOLUME=false
shift
;;
--skip-btcpayserver)
SKIP_BTCPAYSERVER=true
shift
;;
--skip-wwwserver)
SKIP_WWW=true
shift
;;
--skip-clamsserver)
SKIP_CLAMSSERVER=true
shift
;;
*)
echo "Unexpected option: $1"
exit 1
@ -26,6 +41,19 @@ for i in "$@"; do
esac
done
SERVERS=
if [ "$SKIP_BTCPAYSERVER" = false ]; then
SERVERS="btcpayserver"
fi
if [ "$SKIP_WWW" = false ]; then
SERVERS="www $SERVERS"
fi
if [ "$SKIP_CLAMSSERVER" = false ]; then
SERVERS="clamsserver $SERVERS"
fi
. ./deployment_defaults.sh
. ./remote_env.sh
@ -77,9 +105,10 @@ for VIRTUAL_MACHINE in www btcpayserver; do
fi
fi
done
# 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
SKIP=www
done
if lxc network list -q | grep -q ss-ovn; then

View File

@ -221,6 +221,10 @@ EOL
PROJECT_NAME="$(lxc info | grep "project:" | awk '{print $2}')"
export PROJECT_NAME="$PROJECT_NAME"
export PROJECT_PATH="$PROJECTS_PATH/$PROJECT_NAME"
export SKIP_BTCPAYSERVER="$SKIP_BTCPAYSERVER"
export SKIP_WWW="$SKIP_WWW"
export SKIP_CLAMSSERVER="$SKIP_CLAMSSERVER"
mkdir -p "$PROJECT_PATH" "$REMOTE_PATH/projects"