Improve volume mounting.
This commit is contained in:
parent
bde59ef717
commit
6a97c0d3f4
@ -55,16 +55,19 @@ else
|
|||||||
# of chainstate/blocks.
|
# of chainstate/blocks.
|
||||||
for CHAIN in testnet mainnet; do
|
for CHAIN in testnet mainnet; do
|
||||||
for DATA in blocks chainstate; do
|
for DATA in blocks chainstate; do
|
||||||
|
# if the storage snapshot doesn't yet exist, create it.
|
||||||
|
if ! lxc storage volume list ss-base -q --format csv -c n | grep -q "$CHAIN-$DATA/snap0"; then
|
||||||
DATA_PATH="/home/ubuntu/.ss/cache/bitcoin/$CHAIN/$DATA"
|
DATA_PATH="/home/ubuntu/.ss/cache/bitcoin/$CHAIN/$DATA"
|
||||||
if [ -d "$DATA_PATH" ]; then
|
if [ -d "$DATA_PATH" ]; then
|
||||||
COMPLETE_FILE_PATH="$DATA_PATH/complete"
|
COMPLETE_FILE_PATH="$DATA_PATH/complete"
|
||||||
if lxc exec "$BASE_IMAGE_VM_NAME" -- [ ! -f "$COMPLETE_FILE_PATH" ]; then
|
if lxc exec "$BASE_IMAGE_VM_NAME" -- [ ! -f "$COMPLETE_FILE_PATH" ]; then
|
||||||
lxc file push --recursive --project=default "$DATA_PATH/" "$BASE_IMAGE_VM_NAME/home/ubuntu/.ss/cache/bitcoin/$CHAIN/$DATA/"
|
lxc file push --recursive --uid=999 --guid=999 --project=default "$DATA_PATH/" "$BASE_IMAGE_VM_NAME/home/ubuntu/.ss/cache/bitcoin/$CHAIN/$DATA/"
|
||||||
lxc exec "$BASE_IMAGE_VM_NAME" -- su ubuntu - bash -c "echo $(date) > $COMPLETE_FILE_PATH"
|
lxc exec "$BASE_IMAGE_VM_NAME" -- su ubuntu - bash -c "echo $(date) > $COMPLETE_FILE_PATH"
|
||||||
else
|
else
|
||||||
echo "INFO: it appears as though $CHAIN/$DATA has already been initialized. Continuing."
|
echo "INFO: it appears as though $CHAIN/$DATA has already been initialized. Continuing."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -77,12 +80,15 @@ fi
|
|||||||
echo "INFO: Publishing '$BASE_IMAGE_VM_NAME' as image '$DOCKER_BASE_IMAGE_NAME'. Please wait."
|
echo "INFO: Publishing '$BASE_IMAGE_VM_NAME' as image '$DOCKER_BASE_IMAGE_NAME'. Please wait."
|
||||||
lxc publish --public "$BASE_IMAGE_VM_NAME/$UBUNTU_BASE_IMAGE_NAME" --project=default --alias="$DOCKER_BASE_IMAGE_NAME"
|
lxc publish --public "$BASE_IMAGE_VM_NAME/$UBUNTU_BASE_IMAGE_NAME" --project=default --alias="$DOCKER_BASE_IMAGE_NAME"
|
||||||
|
|
||||||
echo "INFO: Success! We can now delete the base image."
|
echo "INFO: Success creating the base image. Deleting artifacts from the build process."
|
||||||
lxc delete -f "$BASE_IMAGE_VM_NAME"
|
lxc delete -f "$BASE_IMAGE_VM_NAME"
|
||||||
|
|
||||||
# now let's get a snapshot of each of the blocks/chainstate directories.
|
# now let's get a snapshot of each of the blocks/chainstate directories.
|
||||||
for CHAIN in testnet mainnet; do
|
for CHAIN in testnet mainnet; do
|
||||||
for DATA in blocks chainstate; do
|
for DATA in blocks chainstate; do
|
||||||
|
if ! lxc storage volume list ss-base -q --format csv -c n | grep -q "$CHAIN-$DATA/snap0"; then
|
||||||
|
echo "INFO: Creating a snapshot 'ss-base/$CHAIN-$DATA/snap0'."
|
||||||
lxc storage volume snapshot ss-base --project=default "$CHAIN-$DATA"
|
lxc storage volume snapshot ss-base --project=default "$CHAIN-$DATA"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
@ -354,7 +354,7 @@ EOL
|
|||||||
# create the lxc project as specified by PROJECT_NAME
|
# create the lxc project as specified by PROJECT_NAME
|
||||||
if ! lxc project list | grep -q "$PROJECT_NAME"; then
|
if ! lxc project list | grep -q "$PROJECT_NAME"; then
|
||||||
lxc project create "$PROJECT_NAME"
|
lxc project create "$PROJECT_NAME"
|
||||||
lxc project set "$PROJECT_NAME" features.networks=true features.images=false
|
lxc project set "$PROJECT_NAME" features.networks=true features.images=false features.storage.volumes=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Goal is to get the macvlan interface.
|
# Goal is to get the macvlan interface.
|
||||||
|
10
deploy_vm.sh
10
deploy_vm.sh
@ -41,6 +41,16 @@ 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"
|
||||||
|
|
||||||
|
# of chainstate/blocks.
|
||||||
|
# for CHAIN in testnet mainnet; do
|
||||||
|
# for DATA in blocks chainstate; do
|
||||||
|
# MOUNT_PATH="/$CHAIN/$DATA"
|
||||||
|
# if lxc storage volume list ss-base -q --format csv -c n | grep -q "$CHAIN-$DATA/snap0"; then
|
||||||
|
# lxc storage volume attach ss-base "$CHAIN-$DATA" "$LXD_VM_NAME" "$MOUNT_PATH"
|
||||||
|
# fi
|
||||||
|
# done
|
||||||
|
# done
|
||||||
|
|
||||||
lxc start "$LXD_VM_NAME"
|
lxc start "$LXD_VM_NAME"
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user