Compare commits
2 Commits
5260567a18
...
0ede72d556
Author | SHA1 | Date | |
---|---|---|---|
0ede72d556 | |||
ba153765a7 |
@ -7,13 +7,12 @@ bash -c "./stub_lxc_profile.sh --lxd-hostname=$BASE_IMAGE_VM_NAME"
|
|||||||
|
|
||||||
# let's download our base image.
|
# let's download our base image.
|
||||||
if ! lxc image list --format csv --columns l | grep -q "$UBUNTU_BASE_IMAGE_NAME"; then
|
if ! lxc image list --format csv --columns l | grep -q "$UBUNTU_BASE_IMAGE_NAME"; then
|
||||||
# if the image doesn't exist, download it from Ubuntu's image server
|
# if the image if cached locally, import it from disk, otherwise download it from ubuntu
|
||||||
# TODO see if we can fetch this file from a more censorship-resistant source, e.g., ipfs
|
IMAGE_IDENTIFIER=$(find "$SS_JAMMY_PATH" | grep ".qcow2" | head -n1 | cut -d "." -f1)
|
||||||
# we don't really need to cache this locally since it gets continually updated upstream.
|
METADATA_FILE="$SS_JAMMY_PATH/meta-$IMAGE_IDENTIFIER.tar.xz"
|
||||||
if [ -d "$SS_JAMMY_PATH" ]; then
|
IMAGE_FILE="$SS_JAMMY_PATH/$IMAGE_IDENTIFIER.qcow2"
|
||||||
lxc image import "$SS_JAMMY_PATH/meta-bf1a2627bdddbfb0a9bf1f8ae146fa794800c6c91281d3db88c8d762f58bd057.tar.xz" \
|
if [ -d "$SS_JAMMY_PATH" ] && [ -f "$METADATA_FILE" ] && [ -f "$IMAGE_FILE" ]; then
|
||||||
"$SS_JAMMY_PATH/bf1a2627bdddbfb0a9bf1f8ae146fa794800c6c91281d3db88c8d762f58bd057.qcow2" \
|
lxc image import "$METADATA_FILE" "$IMAGE_FILE" --alias "$UBUNTU_BASE_IMAGE_NAME"
|
||||||
--alias "$UBUNTU_BASE_IMAGE_NAME"
|
|
||||||
else
|
else
|
||||||
# copy the image down from canonical.
|
# copy the image down from canonical.
|
||||||
lxc image copy "images:$BASE_LXC_IMAGE" "$REMOTE_NAME": --alias "$UBUNTU_BASE_IMAGE_NAME" --public --vm --auto-update
|
lxc image copy "images:$BASE_LXC_IMAGE" "$REMOTE_NAME": --alias "$UBUNTU_BASE_IMAGE_NAME" --public --vm --auto-update
|
||||||
|
18
deploy_vm.sh
18
deploy_vm.sh
@ -41,15 +41,15 @@ if ! lxc list --format csv | grep -q "$LXD_VM_NAME"; then
|
|||||||
lxc config set "$LXD_VM_NAME" "volatile.enp5s0.hwaddr=$MAC_ADDRESS_TO_PROVISION"
|
lxc config set "$LXD_VM_NAME" "volatile.enp5s0.hwaddr=$MAC_ADDRESS_TO_PROVISION"
|
||||||
lxc config device override "$LXD_VM_NAME" root size="${ROOT_DISK_SIZE_GB}GB"
|
lxc config device override "$LXD_VM_NAME" root size="${ROOT_DISK_SIZE_GB}GB"
|
||||||
|
|
||||||
# # attach any volumes
|
if [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
|
||||||
# for CHAIN in testnet mainnet; do
|
# attach any volumes
|
||||||
# for DATA in blocks chainstate; do
|
for CHAIN in testnet mainnet; do
|
||||||
# MOUNT_PATH="/$CHAIN-$DATA"
|
for DATA in blocks chainstate; do
|
||||||
# if lxc storage volume list ss-base -q --format csv -c n | grep -q "$CHAIN-$DATA/snap0"; then
|
MOUNT_PATH="/$CHAIN-$DATA"
|
||||||
# lxc storage volume attach ss-base "$CHAIN-$DATA" "$LXD_VM_NAME" "$MOUNT_PATH"
|
lxc config device add "$LXD_VM_NAME" "$CHAIN-$DATA" disk pool=ss-base source="$CHAIN-$DATA" path="$MOUNT_PATH"
|
||||||
# fi
|
done
|
||||||
# done
|
done
|
||||||
# done
|
fi
|
||||||
|
|
||||||
lxc start "$LXD_VM_NAME"
|
lxc start "$LXD_VM_NAME"
|
||||||
sleep 10
|
sleep 10
|
||||||
|
@ -90,7 +90,7 @@ if [ "$RESTART_FRONT_END" = true ]; then
|
|||||||
if docker stack list --format "{{.Name}}" | grep -q reverse-proxy; then
|
if docker stack list --format "{{.Name}}" | grep -q reverse-proxy; then
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
docker stack down reverse-proxy
|
docker stack rm reverse-proxy
|
||||||
|
|
||||||
# wait for all docker containers to stop.
|
# wait for all docker containers to stop.
|
||||||
# TODO see if there's a way to check for this.
|
# TODO see if there's a way to check for this.
|
||||||
|
@ -20,7 +20,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
STACK_NAME="$DOMAIN_IDENTIFIER-$APP-$LANGUAGE_CODE"
|
STACK_NAME="$DOMAIN_IDENTIFIER-$APP-$LANGUAGE_CODE"
|
||||||
|
|
||||||
if docker stack list --format "{{.Name}}" | grep -q "$STACK_NAME"; then
|
if docker stack list --format "{{.Name}}" | grep -q "$STACK_NAME"; then
|
||||||
docker stack down "$STACK_NAME"
|
docker stack rm "$STACK_NAME"
|
||||||
sleep 2
|
sleep 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user