Compare commits
5 Commits
2992f34092
...
5dc7194a62
Author | SHA1 | Date | |
---|---|---|---|
5dc7194a62 | |||
1fdf96bfa2 | |||
9e7d9d3a90 | |||
ab08923543 | |||
27a02534b6 |
@ -106,7 +106,7 @@ export PRIMARY_DOMAIN=
|
||||
# this is the git commit of the project/ sub git repo.
|
||||
# used in the migration script to switch into past for backup
|
||||
# then back to present (TARGET_PROJECT_GIT_COMMIT) for restore.
|
||||
export TARGET_PROJECT_GIT_COMMIT=bc4ac89c19e20c86a8376563a0dfe5a314ea4b0c
|
||||
export TARGET_PROJECT_GIT_COMMIT=c2f3612beeb5a386545596fdc3e734b20048013d
|
||||
|
||||
#
|
||||
export TESTNET_BLOCK_HASH=00000000d8277ba1ca66b40b3e3476629e6f0f97c5b8cfaeabfe402e55db223a
|
||||
|
@ -10,7 +10,7 @@ if lxc remote get-default | grep -q "local"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "WARNING: This will DESTROY any existing VMs!"
|
||||
echo "WARNING: This will DESTROY any existing VMs! Use the --purge flag to delete ALL Sovereign Stack LXD resources."
|
||||
|
||||
RESPONSE=
|
||||
read -r -p "Are you sure you want to continue (y/n): ": RESPONSE
|
||||
|
@ -2,7 +2,8 @@
|
||||
You are in the Sovereign Stack Management Environment (SSME). From here, you can issue several commands:
|
||||
|
||||
ss-remote - Take a remote SSH endpoint under management of Sovereign Stack.
|
||||
ss-deploy - Creates a deployment to your active LXD remote.
|
||||
ss-deploy - Deploys Sovereign Stack instances to your currenty remote according to your
|
||||
various remote.conf, project.conf, and site.conf files.
|
||||
ss-show - show the lxd resources associated with the current remote.
|
||||
ss-update - brings an existing deployment up to the newest version of Sovereign Stack.
|
||||
ss-destroy - Destroys the active deployment (WARNING: destructive).
|
||||
|
@ -239,13 +239,16 @@ if ! lxc storage list --format csv | grep -q ss-base; then
|
||||
# on top of the existing filesystem using a loop device, per LXD docs
|
||||
lxc storage create ss-base zfs
|
||||
fi
|
||||
fi
|
||||
|
||||
# create the testnet/mainnet blocks/chainstate subvolumes.
|
||||
for CHAIN in mainnet testnet; do
|
||||
for DATA in blocks chainstate; do
|
||||
if ! lxc storage volume list ss-base | grep -q "$CHAIN-$DATA"; then
|
||||
lxc storage volume create ss-base "$CHAIN-$DATA" --type=filesystem
|
||||
fi
|
||||
# create the testnet/mainnet blocks/chainstate subvolumes.
|
||||
for CHAIN in mainnet testnet; do
|
||||
for DATA in blocks chainstate; do
|
||||
if ! lxc storage volume list ss-base | grep -q "$CHAIN-$DATA"; then
|
||||
lxc storage volume create ss-base "$CHAIN-$DATA" --type=filesystem
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
else
|
||||
echo "WARNING! The host '$FQDN' appears to have Sovereign Stack worksloads already provisioned. Proceed with care."
|
||||
fi
|
||||
|
@ -4,6 +4,23 @@
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
|
||||
PURGE_LXD=false
|
||||
|
||||
# grab any modifications from the command line.
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
--purge)
|
||||
PURGE_LXD=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unexpected option: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
source ../defaults.sh
|
||||
|
||||
./destroy.sh
|
||||
@ -27,39 +44,43 @@ if ! lxc info | grep -q "project: default"; then
|
||||
lxc project delete "$CURRENT_PROJECT"
|
||||
fi
|
||||
|
||||
if lxc profile show default | grep -q "root:"; then
|
||||
lxc profile device remove default root
|
||||
fi
|
||||
|
||||
if lxc profile show default| grep -q "eth0:"; then
|
||||
lxc profile device remove default eth0
|
||||
fi
|
||||
if [ "$PURGE_LXD" = true ]; then
|
||||
|
||||
if lxc network list --format csv | grep -q lxdbr0; then
|
||||
lxc network delete lxdbr0
|
||||
fi
|
||||
if lxc profile show default | grep -q "root:"; then
|
||||
lxc profile device remove default root
|
||||
fi
|
||||
|
||||
if lxc network list --format csv | grep -q lxdbr1; then
|
||||
lxc network delete lxdbr1
|
||||
fi
|
||||
if lxc profile show default| grep -q "eth0:"; then
|
||||
lxc profile device remove default eth0
|
||||
fi
|
||||
|
||||
# create the testnet/mainnet blocks/chainstate subvolumes.
|
||||
for CHAIN in mainnet testnet; do
|
||||
for DATA in blocks chainstate; do
|
||||
if lxc storage volume list ss-base | grep -q "$CHAIN-$DATA"; then
|
||||
lxc storage volume delete ss-base "$CHAIN-$DATA"
|
||||
fi
|
||||
if lxc network list --format csv | grep -q lxdbr0; then
|
||||
lxc network delete lxdbr0
|
||||
fi
|
||||
|
||||
if lxc network list --format csv | grep -q lxdbr1; then
|
||||
lxc network delete lxdbr1
|
||||
fi
|
||||
|
||||
# create the testnet/mainnet blocks/chainstate subvolumes.
|
||||
for CHAIN in mainnet testnet; do
|
||||
for DATA in blocks chainstate; do
|
||||
if lxc storage volume list ss-base | grep -q "$CHAIN-$DATA"; then
|
||||
lxc storage volume delete ss-base "$CHAIN-$DATA"
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
if lxc storage list --format csv | grep -q ss-base; then
|
||||
lxc storage delete ss-base
|
||||
fi
|
||||
if lxc storage list --format csv | grep -q ss-base; then
|
||||
lxc storage delete ss-base
|
||||
fi
|
||||
|
||||
CURRENT_REMOTE="$(lxc remote get-default)"
|
||||
if ! lxc remote get-default | grep -q "local"; then
|
||||
lxc remote switch local
|
||||
lxc remote remove "$CURRENT_REMOTE"
|
||||
CURRENT_REMOTE="$(lxc remote get-default)"
|
||||
if ! lxc remote get-default | grep -q "local"; then
|
||||
lxc remote switch local
|
||||
lxc remote remove "$CURRENT_REMOTE"
|
||||
|
||||
echo "INFO: The remote '$CURRENT_REMOTE' has been removed! You are now controlling your local instance."
|
||||
echo "INFO: The remote '$CURRENT_REMOTE' has been removed! You are now controlling your local instance."
|
||||
fi
|
||||
fi
|
35
install.sh
35
install.sh
@ -17,9 +17,6 @@ fi
|
||||
# lxd resources. By default, we provision the disk under / as a loop device. Admin
|
||||
# can override with CLI modifications.
|
||||
DISK="rpool/lxd"
|
||||
|
||||
#DISK="/dev/sda1"
|
||||
|
||||
export DISK="$DISK"
|
||||
|
||||
# let's check to ensure the management machine is on the Baseline ubuntu
|
||||
@ -96,24 +93,44 @@ if ! lxc list --format csv | grep -q ss-mgmt; then
|
||||
lxc init "images:$BASE_LXC_IMAGE" ss-mgmt --vm -c limits.cpu=4 -c limits.memory=4GiB --profile=default
|
||||
|
||||
# mount the pre-verified sovereign stack git repo into the new vm
|
||||
lxc config device add ss-mgmt sscode disk source="$(pwd)" path=/home/ubuntu/sovereign-stack
|
||||
lxc config device add ss-mgmt ss-code disk source="$(pwd)" path=/home/ubuntu/sovereign-stack
|
||||
|
||||
# if the System Owner has a ~/.ss directory, then we'll mount it into the vm
|
||||
# this allows the data to persist across ss-mgmt vms; ie. install/uninstall
|
||||
if [ -d "$SS_ROOT_PATH" ]; then
|
||||
lxc config device add ss-mgmt ssroot disk source="$SS_ROOT_PATH" path=/home/ubuntu/.ss
|
||||
lxc config device add ss-mgmt ss-root disk source="$SS_ROOT_PATH" path=/home/ubuntu/.ss
|
||||
fi
|
||||
|
||||
# if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in.
|
||||
BITCOIN_TESTNET_BLOCKS_PATH="$HOME/.bitcoin/testnet3/blocks"
|
||||
BITCOIN_DIR="$HOME/.bitcoin"
|
||||
REMOTE_BITCOIN_CACHE_PATH="/home/ubuntu/.ss/cache/bitcoin"
|
||||
BITCOIN_TESTNET_BLOCKS_PATH="$BITCOIN_DIR/testnet3/blocks"
|
||||
if [ -d "$BITCOIN_TESTNET_BLOCKS_PATH" ]; then
|
||||
lxc config device add ss-mgmt ss-testnet-blocks disk source="$BITCOIN_TESTNET_BLOCKS_PATH" path=/home/ubuntu/.ss/cache/bitcoin/testnet/blocks
|
||||
lxc config device add ss-mgmt ss-testnet-blocks disk source="$BITCOIN_TESTNET_BLOCKS_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/testnet/blocks
|
||||
fi
|
||||
|
||||
# if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in.
|
||||
BITCOIN_TESTNET_CHAINSTATE_PATH="$HOME/.bitcoin/testnet3/chainstate"
|
||||
BITCOIN_TESTNET_CHAINSTATE_PATH="$BITCOIN_DIR/testnet3/chainstate"
|
||||
if [ -d "$BITCOIN_TESTNET_CHAINSTATE_PATH" ]; then
|
||||
lxc config device add ss-mgmt ss-testnet-chainstate disk source="$BITCOIN_TESTNET_CHAINSTATE_PATH" path=/home/ubuntu/.ss/cache/bitcoin/testnet/chainstate
|
||||
lxc config device add ss-mgmt ss-testnet-chainstate disk source="$BITCOIN_TESTNET_CHAINSTATE_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/testnet/chainstate
|
||||
fi
|
||||
|
||||
# if a ~/.bitcoin/blocks dir exists, mount it in.
|
||||
BITCOIN_MAINNET_BLOCKS_PATH="$BITCOIN_DIR/blocks"
|
||||
if [ -d "$BITCOIN_MAINNET_BLOCKS_PATH" ]; then
|
||||
lxc config device add ss-mgmt ss-mainnet-blocks disk source="$BITCOIN_MAINNET_BLOCKS_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/blocks
|
||||
else
|
||||
echo "WARNING: the blocks directory was not found for mainnet. It will NOT be mounted into ss-mgmt."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in.
|
||||
BITCOIN_MAINNET_CHAINSTATE_PATH="$BITCOIN_DIR/chainstate"
|
||||
if [ -d "$BITCOIN_MAINNET_CHAINSTATE_PATH" ]; then
|
||||
lxc config device add ss-mgmt ss-mainnet-chainstate disk source="$BITCOIN_MAINNET_CHAINSTATE_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/chainstate
|
||||
else
|
||||
echo "WARNING: the chainstate directory was not found for mainnet. It will NOT be mounted into ss-mgmt."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# mount the ssh directory in there.
|
||||
|
12
uninstall.sh
12
uninstall.sh
@ -32,13 +32,15 @@ if lxc list --format csv | grep -q "ss-mgmt"; then
|
||||
lxc stop ss-mgmt
|
||||
fi
|
||||
|
||||
lxc config device remove ss-mgmt sscode
|
||||
|
||||
if [ -d "$SS_ROOT_PATH" ]; then
|
||||
lxc config device remove ss-mgmt ssroot
|
||||
if lxc config device list ss-mgmt -q | grep -q "ss-code"; then
|
||||
lxc config device remove ss-mgmt ss-code
|
||||
fi
|
||||
|
||||
if [ -d "$HOME/.ssh" ]; then
|
||||
if lxc config device list ss-mgmt -q | grep -q "ss-root"; then
|
||||
lxc config device remove ss-mgmt ss-root
|
||||
fi
|
||||
|
||||
if lxc config device list ss-mgmt -q | grep -q "ss-ssh"; then
|
||||
lxc config device remove ss-mgmt ss-ssh
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user