Remove lnplay storage volumes.
This commit is contained in:
parent
50d65ebe7c
commit
60efc0a6fc
@ -54,30 +54,34 @@ if ! incus list --format csv | grep -q "$INCUS_VM_NAME"; then
|
|||||||
DOCKER_DISK_SIZE_GB="$BTCPAYSERVER_DOCKER_DISK_SIZE_GB"
|
DOCKER_DISK_SIZE_GB="$BTCPAYSERVER_DOCKER_DISK_SIZE_GB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DOCKER_VOLUME_NAME="$VIRTUAL_MACHINE-docker"
|
SSDATA_VOLUME_NAME=
|
||||||
if ! incus storage volume list ss-base | grep -q "$DOCKER_VOLUME_NAME"; then
|
BACKUP_VOLUME_NAME=
|
||||||
incus storage volume create ss-base "$DOCKER_VOLUME_NAME" --type=block
|
if [ "$VIRTUAL_MACHINE" != lnplayserver ]; then
|
||||||
|
DOCKER_VOLUME_NAME="$VIRTUAL_MACHINE-docker"
|
||||||
|
if ! incus storage volume list ss-base | grep -q "$DOCKER_VOLUME_NAME"; then
|
||||||
|
incus storage volume create ss-base "$DOCKER_VOLUME_NAME" --type=block
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO ensure we are only GROWING the volume--never shrinking
|
||||||
|
incus storage volume set ss-base "$DOCKER_VOLUME_NAME" size="${DOCKER_DISK_SIZE_GB}GB"
|
||||||
|
|
||||||
|
SSDATA_VOLUME_NAME="$VIRTUAL_MACHINE-ss-data"
|
||||||
|
if ! incus storage volume list ss-base | grep -q "$SSDATA_VOLUME_NAME"; then
|
||||||
|
incus storage volume create ss-base "$SSDATA_VOLUME_NAME" --type=filesystem
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO ensure we are only GROWING the volume--never shrinking per zfs volume docs.
|
||||||
|
incus storage volume set ss-base "$SSDATA_VOLUME_NAME" size="${SSDATA_DISK_SIZE_GB}GB"
|
||||||
|
|
||||||
|
BACKUP_VOLUME_NAME="$VIRTUAL_MACHINE-backup"
|
||||||
|
if ! incus storage volume list ss-base | grep -q "$BACKUP_VOLUME_NAME"; then
|
||||||
|
incus storage volume create ss-base "$BACKUP_VOLUME_NAME" --type=filesystem
|
||||||
|
fi
|
||||||
|
|
||||||
|
incus storage volume set ss-base "$BACKUP_VOLUME_NAME" size="${BACKUP_DISK_SIZE_GB}GB"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO ensure we are only GROWING the volume--never shrinking
|
|
||||||
incus storage volume set ss-base "$DOCKER_VOLUME_NAME" size="${DOCKER_DISK_SIZE_GB}GB"
|
|
||||||
|
|
||||||
SSDATA_VOLUME_NAME="$VIRTUAL_MACHINE-ss-data"
|
|
||||||
if ! incus storage volume list ss-base | grep -q "$SSDATA_VOLUME_NAME"; then
|
|
||||||
incus storage volume create ss-base "$SSDATA_VOLUME_NAME" --type=filesystem
|
|
||||||
fi
|
|
||||||
|
|
||||||
# TODO ensure we are only GROWING the volume--never shrinking per zfs volume docs.
|
|
||||||
incus storage volume set ss-base "$SSDATA_VOLUME_NAME" size="${SSDATA_DISK_SIZE_GB}GB"
|
|
||||||
|
|
||||||
|
|
||||||
BACKUP_VOLUME_NAME="$VIRTUAL_MACHINE-backup"
|
|
||||||
if ! incus storage volume list ss-base | grep -q "$BACKUP_VOLUME_NAME"; then
|
|
||||||
incus storage volume create ss-base "$BACKUP_VOLUME_NAME" --type=filesystem
|
|
||||||
fi
|
|
||||||
|
|
||||||
incus storage volume set ss-base "$BACKUP_VOLUME_NAME" size="${BACKUP_DISK_SIZE_GB}GB"
|
|
||||||
|
|
||||||
|
|
||||||
bash -c "./stub_profile.sh --vm=$VIRTUAL_MACHINE --incus-hostname=$INCUS_VM_NAME --ss-volume-name=$SSDATA_VOLUME_NAME --backup-volume-name=$BACKUP_VOLUME_NAME"
|
bash -c "./stub_profile.sh --vm=$VIRTUAL_MACHINE --incus-hostname=$INCUS_VM_NAME --ss-volume-name=$SSDATA_VOLUME_NAME --backup-volume-name=$BACKUP_VOLUME_NAME"
|
||||||
|
|
||||||
@ -89,8 +93,10 @@ if ! incus list --format csv | grep -q "$INCUS_VM_NAME"; then
|
|||||||
# and so we can set DNS internally.
|
# and so we can set DNS internally.
|
||||||
incus config set "$INCUS_VM_NAME" "volatile.enp5s0.hwaddr=$MAC_ADDRESS_TO_PROVISION"
|
incus config set "$INCUS_VM_NAME" "volatile.enp5s0.hwaddr=$MAC_ADDRESS_TO_PROVISION"
|
||||||
|
|
||||||
# attack the docker block device.
|
if [ "$VIRTUAL_MACHINE" != lnplayserver ]; then
|
||||||
incus storage volume attach ss-base "$DOCKER_VOLUME_NAME" "$INCUS_VM_NAME"
|
# attack the docker block device.
|
||||||
|
incus storage volume attach ss-base "$DOCKER_VOLUME_NAME" "$INCUS_VM_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
# if [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
|
# if [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
|
||||||
# # attach any volumes
|
# # attach any volumes
|
||||||
@ -110,7 +116,9 @@ if ! incus list --format csv | grep -q "$INCUS_VM_NAME"; then
|
|||||||
# scan the remote machine and install it's identity in our SSH known_hosts file.
|
# scan the remote machine and install it's identity in our SSH known_hosts file.
|
||||||
ssh-keyscan -H "$FQDN" >> "$SSH_HOME/known_hosts"
|
ssh-keyscan -H "$FQDN" >> "$SSH_HOME/known_hosts"
|
||||||
|
|
||||||
ssh "$FQDN" "sudo chown ubuntu:ubuntu $REMOTE_DATA_PATH"
|
if [ "$VIRTUAL_MACHINE" != lnplayserver ]; then
|
||||||
ssh "$FQDN" "sudo chown -R ubuntu:ubuntu $REMOTE_BACKUP_PATH"
|
ssh "$FQDN" "sudo chown ubuntu:ubuntu $REMOTE_DATA_PATH"
|
||||||
|
ssh "$FQDN" "sudo chown -R ubuntu:ubuntu $REMOTE_BACKUP_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
@ -32,10 +32,6 @@ export BTCPAYSERVER_SSDATA_DISK_SIZE_GB=20
|
|||||||
export BTCPAYSERVER_BACKUP_DISK_SIZE_GB=20
|
export BTCPAYSERVER_BACKUP_DISK_SIZE_GB=20
|
||||||
export BTCPAYSERVER_DOCKER_DISK_SIZE_GB=30
|
export BTCPAYSERVER_DOCKER_DISK_SIZE_GB=30
|
||||||
|
|
||||||
export LNPLAY_SERVER_SSDATA_DISK_SIZE_GB=20
|
|
||||||
export LNPLAY_SERVER_BACKUP_DISK_SIZE_GB=20
|
|
||||||
export LNPLAY_SSERVER_DOCKER_DISK_SIZE_GB=100
|
|
||||||
|
|
||||||
export WWW_HOSTNAME="www"
|
export WWW_HOSTNAME="www"
|
||||||
export BTCPAY_SERVER_HOSTNAME="btcpayserver"
|
export BTCPAY_SERVER_HOSTNAME="btcpayserver"
|
||||||
export LNPLAY_SERVER_HOSTNAME="lnplayserver"
|
export LNPLAY_SERVER_HOSTNAME="lnplayserver"
|
||||||
@ -46,7 +42,6 @@ export NOSTR_HOSTNAME="relay"
|
|||||||
|
|
||||||
export REGISTRY_URL="https://index.docker.io/v1"
|
export REGISTRY_URL="https://index.docker.io/v1"
|
||||||
|
|
||||||
|
|
||||||
export BTCPAY_SERVER_CPU_COUNT="4"
|
export BTCPAY_SERVER_CPU_COUNT="4"
|
||||||
export BTCPAY_SERVER_MEMORY_MB="4096"
|
export BTCPAY_SERVER_MEMORY_MB="4096"
|
||||||
export WWW_SERVER_CPU_COUNT="4"
|
export WWW_SERVER_CPU_COUNT="4"
|
||||||
@ -54,4 +49,3 @@ export WWW_SERVER_MEMORY_MB="4096"
|
|||||||
export LNPLAY_SERVER_CPU_COUNT="4"
|
export LNPLAY_SERVER_CPU_COUNT="4"
|
||||||
export LNPLAY_SERVER_MEMORY_MB="4096"
|
export LNPLAY_SERVER_MEMORY_MB="4096"
|
||||||
export DOCKER_IMAGE_CACHE_FQDN="registry-1.docker.io"
|
export DOCKER_IMAGE_CACHE_FQDN="registry-1.docker.io"
|
||||||
|
|
||||||
|
@ -182,8 +182,13 @@ if [ "$VIRTUAL_MACHINE" != base ]; then
|
|||||||
preserve_hostname: true
|
preserve_hostname: true
|
||||||
fqdn: ${FQDN}
|
fqdn: ${FQDN}
|
||||||
|
|
||||||
resize_rootfs: false
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$VIRTUAL_MACHINE" = www ] || [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
|
||||||
|
# all other machines that are not the base image
|
||||||
|
cat >> "$YAML_PATH" <<EOF
|
||||||
|
resize_rootfs: false
|
||||||
disk_setup:
|
disk_setup:
|
||||||
/dev/sdb:
|
/dev/sdb:
|
||||||
table_type: 'gpt'
|
table_type: 'gpt'
|
||||||
@ -238,21 +243,40 @@ if [ "$VIRTUAL_MACHINE" = www ]; then
|
|||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# All profiles get a root disk and cloud-init config.
|
# All profiles get a root disk and cloud-init config.
|
||||||
cat >> "$YAML_PATH" <<EOF
|
cat >> "$YAML_PATH" <<EOF
|
||||||
description: Default incus profile for ${FILENAME}
|
description: Default incus profile for ${FILENAME}
|
||||||
devices:
|
devices:
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "$VIRTUAL_MACHINE" = lnplayserver ]; then
|
||||||
|
# All profiles get a root disk and cloud-init config.
|
||||||
|
cat >> "$YAML_PATH" <<EOF
|
||||||
root:
|
root:
|
||||||
path: /
|
path: /
|
||||||
pool: ss-base
|
pool: ss-base
|
||||||
type: disk
|
type: disk
|
||||||
|
size: 20GiB
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
# All profiles get a root disk and cloud-init config.
|
||||||
|
cat >> "$YAML_PATH" <<EOF
|
||||||
|
root:
|
||||||
|
path: /
|
||||||
|
pool: ss-base
|
||||||
|
type: disk
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat >> "$YAML_PATH" <<EOF
|
||||||
config:
|
config:
|
||||||
source: cloud-init:config
|
source: cloud-init:config
|
||||||
type: disk
|
type: disk
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if [ "$VIRTUAL_MACHINE" != base ]; then
|
if [ "$VIRTUAL_MACHINE" = www ] || [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
|
||||||
cat >> "$YAML_PATH" <<EOF
|
cat >> "$YAML_PATH" <<EOF
|
||||||
ss-data:
|
ss-data:
|
||||||
path: ${REMOTE_DATA_PATH}
|
path: ${REMOTE_DATA_PATH}
|
||||||
@ -278,7 +302,8 @@ name: ${FILENAME}
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
else
|
else
|
||||||
# If we are deploying a VM that attaches to the network underlay.
|
|
||||||
|
# all other vms attach to the network underlay
|
||||||
cat >> "$YAML_PATH" <<EOF
|
cat >> "$YAML_PATH" <<EOF
|
||||||
enp5s0:
|
enp5s0:
|
||||||
nictype: macvlan
|
nictype: macvlan
|
||||||
@ -316,4 +341,3 @@ else
|
|||||||
# configure the profile with our generated cloud-init.yml file.
|
# configure the profile with our generated cloud-init.yml file.
|
||||||
incus profile edit "$INCUS_HOSTNAME" < "$YAML_PATH"
|
incus profile edit "$INCUS_HOSTNAME" < "$YAML_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -214,8 +214,8 @@ EOL
|
|||||||
PROJECT_NAME="$(incus info | grep "project:" | awk '{print $2}')"
|
PROJECT_NAME="$(incus info | grep "project:" | awk '{print $2}')"
|
||||||
export PROJECT_NAME="$PROJECT_NAME"
|
export PROJECT_NAME="$PROJECT_NAME"
|
||||||
export PROJECT_PATH="$PROJECTS_PATH/$PROJECT_NAME"
|
export PROJECT_PATH="$PROJECTS_PATH/$PROJECT_NAME"
|
||||||
export SKIP_BTCPAYSERVER="$SKIP_BTCPAYSERVER"
|
export SKIP_BTCPAY_SERVER="$SKIP_BTCPAY_SERVER"
|
||||||
export SKIP_WWW="$SKIP_WWW"
|
export SKIP_WWW_SERVER="$SKIP_WWW_SERVER"
|
||||||
export SKIP_LNPLAY_SERVER="$SKIP_LNPLAY_SERVER"
|
export SKIP_LNPLAY_SERVER="$SKIP_LNPLAY_SERVER"
|
||||||
|
|
||||||
|
|
||||||
@ -439,6 +439,19 @@ CHANNEL_SETUP=none
|
|||||||
LNPLAY_SERVER_PATH=${SITES_PATH}/${PRIMARY_DOMAIN}/lnplayserver
|
LNPLAY_SERVER_PATH=${SITES_PATH}/${PRIMARY_DOMAIN}/lnplayserver
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
|
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.
|
||||||
|
bash -c "./project/lnplay/up.sh -y --no-services"
|
||||||
|
|
||||||
|
# stop the instance so we can get an image yo
|
||||||
|
incus stop "$INCUS_VM_NAME"
|
||||||
|
|
||||||
|
# create the incus image.
|
||||||
|
incus publish -q --public "$INCUS_VM_NAME" --alias="$INCUS_VM_NAME" --compression none
|
||||||
|
fi
|
||||||
|
|
||||||
|
# bring up lnplay services.
|
||||||
bash -c "./project/lnplay/up.sh -y"
|
bash -c "./project/lnplay/up.sh -y"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user