Compare commits
No commits in common. "be69d5774d65b7807ff5843f8ec44e44dfae7bc0" and "441eff3f26559b467d8dddefff97bdd5c588c2fc" have entirely different histories.
be69d5774d
...
441eff3f26
28
defaults.sh
28
defaults.sh
@ -4,7 +4,7 @@ set -e
|
|||||||
|
|
||||||
export DEPLOY_GHOST=true
|
export DEPLOY_GHOST=true
|
||||||
export DEPLOY_CLAMS=false
|
export DEPLOY_CLAMS=false
|
||||||
export DEPLOY_NOSTR=false
|
|
||||||
export DEPLOY_NEXTCLOUD=false
|
export DEPLOY_NEXTCLOUD=false
|
||||||
export DEPLOY_GITEA=false
|
export DEPLOY_GITEA=false
|
||||||
|
|
||||||
@ -74,10 +74,10 @@ export NOSTR_RELAY_IMAGE="scsibug/nostr-rs-relay"
|
|||||||
export WWW_SERVER_MAC_ADDRESS=
|
export WWW_SERVER_MAC_ADDRESS=
|
||||||
export BTCPAYSERVER_MAC_ADDRESS=
|
export BTCPAYSERVER_MAC_ADDRESS=
|
||||||
|
|
||||||
export SS_ROOT_PATH="$HOME/ss"
|
export SS_ROOT_PATH="$HOME/.ss"
|
||||||
|
|
||||||
export REMOTES_PATH="$SS_ROOT_PATH/remotes"
|
export REMOTES_DIR="$SS_ROOT_PATH/remotes"
|
||||||
export PROJECTS_PATH="$SS_ROOT_PATH/projects"
|
export PROJECTS_DIR="$SS_ROOT_PATH/projects"
|
||||||
export SITES_PATH="$SS_ROOT_PATH/sites"
|
export SITES_PATH="$SS_ROOT_PATH/sites"
|
||||||
|
|
||||||
# mount into ss-mgmt/home/ubuntu/snap/lxd/common/config
|
# mount into ss-mgmt/home/ubuntu/snap/lxd/common/config
|
||||||
@ -96,29 +96,19 @@ export OTHER_SITES_LIST=
|
|||||||
export BTCPAY_ALT_NAMES=
|
export BTCPAY_ALT_NAMES=
|
||||||
export BITCOIN_CHAIN=regtest
|
export BITCOIN_CHAIN=regtest
|
||||||
export REMOTE_HOME="/home/ubuntu"
|
export REMOTE_HOME="/home/ubuntu"
|
||||||
export REMOTE_DATA_PATH="$REMOTE_HOME/ss-data"
|
|
||||||
export REMOTE_DATA_PATH_LETSENCRYPT="$REMOTE_DATA_PATH/letsencrypt"
|
|
||||||
export REMOTE_BACKUP_PATH="$REMOTE_HOME/backups"
|
|
||||||
export BTCPAY_SERVER_APPPATH="$REMOTE_DATA_PATH/btcpayserver-docker"
|
|
||||||
|
|
||||||
# this space is for OS, docker images, etc
|
export BTCPAY_SERVER_APPPATH="$REMOTE_HOME/btcpayserver-docker"
|
||||||
# values here are fine for regtest generally. Later scripts adjust
|
export REMOTE_CERT_BASE_DIR="$REMOTE_HOME/.certs"
|
||||||
# these values based on testnet/mainnet
|
|
||||||
export WWW_SSDATA_DISK_SIZE_GB=20
|
|
||||||
export WWW_BACKUP_DISK_SIZE_GB=50
|
|
||||||
export WWW_DOCKER_DISK_SIZE_GB=30
|
|
||||||
|
|
||||||
export BTCPAYSERVER_SSDATA_DISK_SIZE_GB=20
|
|
||||||
export BTCPAYSERVER_BACKUP_DISK_SIZE_GB=5
|
|
||||||
export BTCPAYSERVER_DOCKER_DISK_SIZE_GB=30
|
|
||||||
|
|
||||||
|
# this space is for OS, docker images, etc. DOES NOT INCLUDE USER DATA.
|
||||||
|
export ROOT_DISK_SIZE_GB=20
|
||||||
export REGISTRY_URL="https://index.docker.io/v1"
|
export REGISTRY_URL="https://index.docker.io/v1"
|
||||||
export PRIMARY_DOMAIN=
|
export PRIMARY_DOMAIN=
|
||||||
|
|
||||||
# this is the git commit of the project/ sub git repo.
|
# this is the git commit of the project/ sub git repo.
|
||||||
# used in the migration script to switch into past for backup
|
# used in the migration script to switch into past for backup
|
||||||
# then back to present (TARGET_PROJECT_GIT_COMMIT) for restore.
|
# then back to present (TARGET_PROJECT_GIT_COMMIT) for restore.
|
||||||
export TARGET_PROJECT_GIT_COMMIT=f05daa9bfb11242eab920fdc4dd490d9bfdd6fbb
|
export TARGET_PROJECT_GIT_COMMIT=7a710d09162f98fa38e4c60fa00c87c8bcbeb5e9
|
||||||
|
|
||||||
#
|
#
|
||||||
export TESTNET_BLOCK_HASH=00000000d8277ba1ca66b40b3e3476629e6f0f97c5b8cfaeabfe402e55db223a
|
export TESTNET_BLOCK_HASH=00000000d8277ba1ca66b40b3e3476629e6f0f97c5b8cfaeabfe402e55db223a
|
||||||
|
102
deployment/destroy.sh
Executable file
102
deployment/destroy.sh
Executable file
@ -0,0 +1,102 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
# this script destroys all resources in the current project.
|
||||||
|
|
||||||
|
if lxc remote get-default | grep -q "local"; then
|
||||||
|
echo "ERROR: you are on the local lxc remote. Nothing to destroy"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "WARNING: This will DESTROY any existing VMs!"
|
||||||
|
|
||||||
|
RESPONSE=
|
||||||
|
read -r -p "Are you sure you want to continue (y/n): ": RESPONSE
|
||||||
|
if [ "$RESPONSE" != "y" ]; then
|
||||||
|
echo "STOPPING."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
USER_TARGET_PROJECT=
|
||||||
|
|
||||||
|
# grab any modifications from the command line.
|
||||||
|
for i in "$@"; do
|
||||||
|
case $i in
|
||||||
|
--project=*)
|
||||||
|
USER_TARGET_PROJECT="${i#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unexpected option: $1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
. ../defaults.sh
|
||||||
|
|
||||||
|
. ./remote_env.sh
|
||||||
|
|
||||||
|
for PROJECT_CHAIN in ${DEPLOYMENT_STRING//,/ }; do
|
||||||
|
NO_PARENS="${PROJECT_CHAIN:1:${#PROJECT_CHAIN}-2}"
|
||||||
|
PROJECT_PREFIX=$(echo "$NO_PARENS" | cut -d'|' -f1)
|
||||||
|
BITCOIN_CHAIN=$(echo "$NO_PARENS" | cut -d'|' -f2)
|
||||||
|
|
||||||
|
PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN"
|
||||||
|
PROJECT_PATH="$PROJECTS_DIR/$PROJECT_NAME"
|
||||||
|
|
||||||
|
# if the user sets USER_TARGET_PROJECT, let's ensure the project exists.
|
||||||
|
if [ -n "$USER_TARGET_PROJECT" ]; then
|
||||||
|
if [ "$PROJECT_NAME" != "$USER_TARGET_PROJECT" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PROJECT_NAME="$PROJECT_NAME"
|
||||||
|
export PROJECT_PATH="$PROJECT_PATH"
|
||||||
|
|
||||||
|
. ./project_env.sh
|
||||||
|
|
||||||
|
if ! lxc info | grep "project:" | grep -q "$PROJECT_NAME"; then
|
||||||
|
if lxc project list | grep -q "$PROJECT_NAME"; then
|
||||||
|
lxc project switch "$PROJECT_NAME"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
for VM in www btcpayserver; do
|
||||||
|
LXD_NAME="$VM-${DOMAIN_NAME//./-}"
|
||||||
|
|
||||||
|
if lxc list | grep -q "$LXD_NAME"; then
|
||||||
|
lxc delete -f "$LXD_NAME"
|
||||||
|
|
||||||
|
# remove the ssh known endpoint else we get warnings.
|
||||||
|
ssh-keygen -f "$SSH_HOME/known_hosts" -R "$LXD_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if lxc profile list | grep -q "$LXD_NAME"; then
|
||||||
|
lxc profile delete "$LXD_NAME"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if lxc network list -q | grep -q ss-ovn; then
|
||||||
|
lxc network delete ss-ovn
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! lxc info | grep "project:" | grep -q default; then
|
||||||
|
lxc project switch default
|
||||||
|
fi
|
||||||
|
|
||||||
|
if lxc project list | grep -q "$PROJECT_NAME"; then
|
||||||
|
lxc project delete "$PROJECT_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# delete the base image so it can be created.
|
||||||
|
if lxc list | grep -q "$BASE_IMAGE_VM_NAME"; then
|
||||||
|
lxc delete -f "$BASE_IMAGE_VM_NAME"
|
||||||
|
# remove the ssh known endpoint else we get warnings.
|
||||||
|
ssh-keygen -f "$SSH_HOME/known_hosts" -R "$LXD_NAME"
|
||||||
|
fi
|
||||||
|
done
|
@ -1,95 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# https://www.sovereign-stack.org/ss-down/
|
|
||||||
|
|
||||||
set -exu
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
|
|
||||||
if lxc remote get-default -q | grep -q "local"; then
|
|
||||||
echo "ERROR: you are on the local lxc remote. Nothing to take down"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
KEEP_DOCKER_VOLUME=true
|
|
||||||
|
|
||||||
# grab any modifications from the command line.
|
|
||||||
for i in "$@"; do
|
|
||||||
case $i in
|
|
||||||
--destroy)
|
|
||||||
KEEP_DOCKER_VOLUME=false
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unexpected option: $1"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
. ../defaults.sh
|
|
||||||
|
|
||||||
. ./remote_env.sh
|
|
||||||
|
|
||||||
. ./project_env.sh
|
|
||||||
|
|
||||||
|
|
||||||
# let's bring down services on the remote deployment if necessary.
|
|
||||||
export DOMAIN_NAME="$PRIMARY_DOMAIN"
|
|
||||||
export SITE_PATH="$SITES_PATH/$PRIMARY_DOMAIN"
|
|
||||||
|
|
||||||
source "$SITE_PATH/site.conf"
|
|
||||||
source ./project/domain_env.sh
|
|
||||||
|
|
||||||
SKIP=btcpayserver
|
|
||||||
for VIRTUAL_MACHINE in www btcpayserver; do
|
|
||||||
LXD_NAME="$VIRTUAL_MACHINE-${PRIMARY_DOMAIN//./-}"
|
|
||||||
|
|
||||||
if lxc list | grep -q "$LXD_NAME"; then
|
|
||||||
bash -c "./project/deploy.sh --stop --skip-$SKIP"
|
|
||||||
|
|
||||||
lxc stop "$LXD_NAME"
|
|
||||||
|
|
||||||
lxc delete "$LXD_NAME"
|
|
||||||
|
|
||||||
# remove the ssh known endpoint else we get warnings.
|
|
||||||
ssh-keygen -f "$SSH_HOME/known_hosts" -R "$LXD_NAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if lxc profile list | grep -q "$LXD_NAME"; then
|
|
||||||
lxc profile delete "$LXD_NAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$KEEP_DOCKER_VOLUME" = false ]; then
|
|
||||||
# destroy the docker volume
|
|
||||||
VM_ID=w
|
|
||||||
if [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
|
|
||||||
VM_ID="b"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# d for docker; b for backup; s for ss-data
|
|
||||||
for DATA in d b s; do
|
|
||||||
VOLUME_NAME="$PRIMARY_DOMAIN_IDENTIFIER-$VM_ID""$DATA"
|
|
||||||
if lxc storage volume list ss-base -q | grep -q "$VOLUME_NAME"; then
|
|
||||||
RESPONSE=
|
|
||||||
read -r -p "Are you sure you want to delete the '$VOLUME_NAME' volume intended for '$LXD_NAME'?": RESPONSE
|
|
||||||
|
|
||||||
if [ "$RESPONSE" = "y" ]; then
|
|
||||||
lxc storage volume delete ss-base "$VOLUME_NAME"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
SKIP=www
|
|
||||||
done
|
|
||||||
|
|
||||||
if lxc network list -q | grep -q ss-ovn; then
|
|
||||||
lxc network delete ss-ovn
|
|
||||||
fi
|
|
||||||
|
|
||||||
# delete the base image so it can be created.
|
|
||||||
if lxc list | grep -q "$BASE_IMAGE_VM_NAME"; then
|
|
||||||
lxc delete -f "$BASE_IMAGE_VM_NAME" --project default
|
|
||||||
# remove the ssh known endpoint else we get warnings.
|
|
||||||
ssh-keygen -f "$SSH_HOME/known_hosts" -R "$BASE_IMAGE_VM_NAME"
|
|
||||||
fi
|
|
@ -2,13 +2,12 @@
|
|||||||
You are in the Sovereign Stack Management Environment (SSME). From here, you can issue several commands:
|
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-remote - Take a remote SSH endpoint under management of Sovereign Stack.
|
||||||
ss-reset - The opposite of ss-remote; de-provisions an existing remote.
|
ss-deploy - Deploys Sovereign Stack instances to your currenty remote according to your
|
||||||
ss-up - Instantiate a deployment to your active project according to your
|
|
||||||
various remote.conf, project.conf, and site.conf files.
|
various remote.conf, project.conf, and site.conf files.
|
||||||
ss-down - Reverses ss-up. Takes the active project down. Non-destructive of user data,
|
|
||||||
unless you provide the --destroy flag.
|
|
||||||
ss-update - This is just ss-down then ss-up.
|
|
||||||
ss-show - show the lxd resources associated with the current remote.
|
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).
|
||||||
|
ss-reset - The opposite of ss-remote; deprovisions on the current remote.
|
||||||
|
|
||||||
For more infomation about all these topics, consult the Sovereign Stack website starting with:
|
For more infomation about all these topics, consult the Sovereign Stack website starting with:
|
||||||
|
|
||||||
|
@ -1,19 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
PROJECT_NAME="$(lxc info | grep "project:" | awk '{print $2}')"
|
|
||||||
export PROJECT_NAME="$PROJECT_NAME"
|
|
||||||
|
|
||||||
if [ "$PROJECT_NAME" = default ]; then
|
|
||||||
echo "ERROR: You are on the default project. Use 'lxc project list' and 'lxc project switch <project>'."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
BITCOIN_CHAIN=$(echo "$PROJECT_NAME" | cut -d'-' -f2)
|
|
||||||
|
|
||||||
export PROJECT_PATH="$PROJECTS_PATH/$PROJECT_NAME"
|
|
||||||
export BITCOIN_CHAIN="$BITCOIN_CHAIN"
|
|
||||||
|
|
||||||
PROJECT_DEFINITION_PATH="$PROJECT_PATH/project.conf"
|
PROJECT_DEFINITION_PATH="$PROJECT_PATH/project.conf"
|
||||||
|
|
||||||
@ -38,13 +27,8 @@ fi
|
|||||||
|
|
||||||
source "$PRIMARY_SITE_DEFINITION_PATH"
|
source "$PRIMARY_SITE_DEFINITION_PATH"
|
||||||
|
|
||||||
SHASUM_OF_PRIMARY_DOMAIN="$(echo -n "$PRIMARY_DOMAIN" | sha256sum | awk '{print $1;}' )"
|
if ! lxc info | grep "project:" | grep -q "$PROJECT_NAME"; then
|
||||||
export PRIMARY_DOMAIN_IDENTIFIER="${SHASUM_OF_PRIMARY_DOMAIN: -6}"
|
if lxc project list | grep -q "$PROJECT_NAME"; then
|
||||||
|
lxc project switch "$PROJECT_NAME"
|
||||||
export WWW_SSDATA_DISK_SIZE_GB="$WWW_SSDATA_DISK_SIZE_GB"
|
fi
|
||||||
export WWW_BACKUP_DISK_SIZE_GB="$WWW_BACKUP_DISK_SIZE_GB"
|
fi
|
||||||
export WWW_DOCKER_DISK_SIZE_GB="$WWW_DOCKER_DISK_SIZE_GB"
|
|
||||||
|
|
||||||
export BTCPAYSERVER_SSDATA_DISK_SIZE_GB="$BTCPAYSERVER_SSDATA_DISK_SIZE_GB"
|
|
||||||
export BTCPAYSERVER_BACKUP_DISK_SIZE_GB="$BTCPAYSERVER_BACKUP_DISK_SIZE_GB"
|
|
||||||
export BTCPAYSERVER_DOCKER_DISK_SIZE_GB="$BTCPAYSERVER_DOCKER_DISK_SIZE_GB"
|
|
@ -21,7 +21,7 @@ fi
|
|||||||
#shellcheck disable=SC1091
|
#shellcheck disable=SC1091
|
||||||
source ../defaults.sh
|
source ../defaults.sh
|
||||||
|
|
||||||
export REMOTE_PATH="$REMOTES_PATH/$REMOTE_NAME"
|
export REMOTE_PATH="$REMOTES_DIR/$REMOTE_NAME"
|
||||||
REMOTE_DEFINITION="$REMOTE_PATH/remote.conf"
|
REMOTE_DEFINITION="$REMOTE_PATH/remote.conf"
|
||||||
export REMOTE_DEFINITION="$REMOTE_DEFINITION"
|
export REMOTE_DEFINITION="$REMOTE_DEFINITION"
|
||||||
|
|
||||||
@ -88,7 +88,6 @@ if ! lxc remote list | grep -q "$REMOTE_NAME"; then
|
|||||||
ssh-copy-id -i "$HOME/.ssh/id_rsa.pub" "ubuntu@$FQDN"
|
ssh-copy-id -i "$HOME/.ssh/id_rsa.pub" "ubuntu@$FQDN"
|
||||||
|
|
||||||
if [ -z "$DISK_TO_USE" ]; then
|
if [ -z "$DISK_TO_USE" ]; then
|
||||||
if ! ssh "ubuntu@$FQDN" lxc storage list -q | grep -q ss-base; then
|
|
||||||
echo "INFO: It looks like the DISK_TO_USE has not been set. Enter it now."
|
echo "INFO: It looks like the DISK_TO_USE has not been set. Enter it now."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@ -97,7 +96,6 @@ if ! lxc remote list | grep -q "$REMOTE_NAME"; then
|
|||||||
echo "Please enter the disk or partition that Sovereign Stack will use to store data: "
|
echo "Please enter the disk or partition that Sovereign Stack will use to store data: "
|
||||||
read -r DISK_TO_USE
|
read -r DISK_TO_USE
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "ERROR: the remote already exists! You need to go delete your lxd remote if you want to re-create your remote."
|
echo "ERROR: the remote already exists! You need to go delete your lxd remote if you want to re-create your remote."
|
||||||
@ -131,14 +129,14 @@ if ! command -v lxc >/dev/null 2>&1; then
|
|||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if lxc network list --format csv -q --project default | grep -q lxdbr0; then
|
if lxc network list --format csv | grep -q lxdbr0; then
|
||||||
lxc network delete lxdbr0 --project default
|
lxc network delete lxdbr0
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if lxc network list --format csv -q project default | grep -q lxdbr1; then
|
if lxc network list --format csv | grep -q lxdbr1; then
|
||||||
lxc network delete lxdbr1 --project default
|
lxc network delete lxdbr1
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -152,7 +150,9 @@ if ! ssh "ubuntu@$FQDN" snap list | grep -q lxd; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# install OVN for the project-specific bridge networks
|
# install OVN for the project-specific bridge networks
|
||||||
ssh -t "ubuntu@$FQDN" "sudo apt-get install -y ovn-host ovn-central && sudo ovs-vsctl set open_vswitch . external_ids:ovn-remote=unix:/var/run/ovn/ovnsb_db.sock external_ids:ovn-encap-type=geneve external_ids:ovn-encap-ip=127.0.0.1"
|
ssh -t "ubuntu@$FQDN" "sudo apt-get install -y ovn-host ovn-central"
|
||||||
|
|
||||||
|
ssh -t "ubuntu@$FQDN" "sudo ovs-vsctl set open_vswitch . external_ids:ovn-remote=unix:/var/run/ovn/ovnsb_db.sock external_ids:ovn-encap-type=geneve external_ids:ovn-encap-ip=127.0.0.1"
|
||||||
|
|
||||||
# if the user did not specify the interface, we just use whatever is used for the default route.
|
# if the user did not specify the interface, we just use whatever is used for the default route.
|
||||||
if [ -z "$DATA_PLANE_MACVLAN_INTERFACE" ]; then
|
if [ -z "$DATA_PLANE_MACVLAN_INTERFACE" ]; then
|
||||||
@ -240,14 +240,14 @@ if ! lxc storage list --format csv | grep -q ss-base; then
|
|||||||
lxc storage create ss-base zfs
|
lxc storage create ss-base zfs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# # create the testnet/mainnet blocks/chainstate subvolumes.
|
# create the testnet/mainnet blocks/chainstate subvolumes.
|
||||||
# for CHAIN in mainnet testnet; do
|
for CHAIN in mainnet testnet; do
|
||||||
# for DATA in blocks chainstate; do
|
for DATA in blocks chainstate; do
|
||||||
# if ! lxc storage volume list ss-base | grep -q "$CHAIN-$DATA"; then
|
if ! lxc storage volume list ss-base | grep -q "$CHAIN-$DATA"; then
|
||||||
# lxc storage volume create ss-base "$CHAIN-$DATA" --type=filesystem
|
lxc storage volume create ss-base "$CHAIN-$DATA" --type=filesystem
|
||||||
# fi
|
fi
|
||||||
# done
|
done
|
||||||
# done
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "WARNING! The host '$FQDN' appears to have Sovereign Stack worksloads already provisioned. Proceed with care."
|
echo "WARNING! The host '$FQDN' appears to have Sovereign Stack worksloads already provisioned. Proceed with care."
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
CURRENT_REMOTE="$(lxc remote get-default)"
|
CURRENT_REMOTE="$(lxc remote get-default)"
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ if echo "$CURRENT_REMOTE" | grep -q "production"; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export REMOTE_PATH="$REMOTES_PATH/$CURRENT_REMOTE"
|
export REMOTE_PATH="$REMOTES_DIR/$CURRENT_REMOTE"
|
||||||
REMOTE_DEFINITION="$REMOTE_PATH/remote.conf"
|
REMOTE_DEFINITION="$REMOTE_PATH/remote.conf"
|
||||||
export REMOTE_DEFINITION="$REMOTE_DEFINITION"
|
export REMOTE_DEFINITION="$REMOTE_DEFINITION"
|
||||||
|
|
||||||
@ -37,50 +38,3 @@ if [ ! -f "$REMOTE_DEFINITION" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
source "$REMOTE_DEFINITION"
|
source "$REMOTE_DEFINITION"
|
||||||
|
|
||||||
# ensure our projects are provisioned according to DEPLOYMENT_STRING
|
|
||||||
for PROJECT_CHAIN in ${DEPLOYMENT_STRING//,/ }; do
|
|
||||||
NO_PARENS="${PROJECT_CHAIN:1:${#PROJECT_CHAIN}-2}"
|
|
||||||
PROJECT_PREFIX=$(echo "$NO_PARENS" | cut -d'|' -f1)
|
|
||||||
BITCOIN_CHAIN=$(echo "$NO_PARENS" | cut -d'|' -f2)
|
|
||||||
PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN"
|
|
||||||
|
|
||||||
# create the lxc project as specified by PROJECT_NAME
|
|
||||||
if ! lxc project list | grep -q "$PROJECT_NAME"; then
|
|
||||||
lxc project create "$PROJECT_NAME"
|
|
||||||
lxc project set "$PROJECT_NAME" features.networks=true features.images=false features.storage.volumes=true
|
|
||||||
lxc project switch "$PROJECT_NAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# default values are already at regtest mode.
|
|
||||||
if [ "$BITCOIN_CHAIN" = testnet ]; then
|
|
||||||
|
|
||||||
WWW_SSDATA_DISK_SIZE_GB=30
|
|
||||||
WWW_BACKUP_DISK_SIZE_GB=30
|
|
||||||
WWW_DOCKER_DISK_SIZE_GB=50
|
|
||||||
|
|
||||||
BTCPAYSERVER_SSDATA_DISK_SIZE_GB=30
|
|
||||||
BTCPAYSERVER_BACKUP_DISK_SIZE_GB=30
|
|
||||||
BTCPAYSERVER_DOCKER_DISK_SIZE_GB=100
|
|
||||||
|
|
||||||
elif [ "$BITCOIN_CHAIN" = mainnet ]; then
|
|
||||||
|
|
||||||
WWW_SSDATA_DISK_SIZE_GB=40
|
|
||||||
WWW_BACKUP_DISK_SIZE_GB=40
|
|
||||||
WWW_DOCKER_DISK_SIZE_GB=1000
|
|
||||||
|
|
||||||
BTCPAYSERVER_SSDATA_DISK_SIZE_GB=30
|
|
||||||
BTCPAYSERVER_BACKUP_DISK_SIZE_GB=30
|
|
||||||
BTCPAYSERVER_DOCKER_DISK_SIZE_GB=500
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
export WWW_SSDATA_DISK_SIZE_GB="$WWW_SSDATA_DISK_SIZE_GB"
|
|
||||||
export WWW_BACKUP_DISK_SIZE_GB="$WWW_BACKUP_DISK_SIZE_GB"
|
|
||||||
export WWW_DOCKER_DISK_SIZE_GB="$WWW_DOCKER_DISK_SIZE_GB"
|
|
||||||
|
|
||||||
export BTCPAYSERVER_SSDATA_DISK_SIZE_GB="$BTCPAYSERVER_SSDATA_DISK_SIZE_GB"
|
|
||||||
export BTCPAYSERVER_BACKUP_DISK_SIZE_GB="$BTCPAYSERVER_BACKUP_DISK_SIZE_GB"
|
|
||||||
export BTCPAYSERVER_DOCKER_DISK_SIZE_GB="$BTCPAYSERVER_DOCKER_DISK_SIZE_GB"
|
|
||||||
|
|
||||||
done
|
|
@ -23,7 +23,7 @@ done
|
|||||||
|
|
||||||
source ../defaults.sh
|
source ../defaults.sh
|
||||||
|
|
||||||
./down.sh
|
./destroy.sh
|
||||||
|
|
||||||
# these only get initialzed upon creation, so we MUST delete here so they get recreated.
|
# these only get initialzed upon creation, so we MUST delete here so they get recreated.
|
||||||
if lxc profile list | grep -q "$BASE_IMAGE_VM_NAME"; then
|
if lxc profile list | grep -q "$BASE_IMAGE_VM_NAME"; then
|
||||||
@ -55,22 +55,22 @@ if [ "$PURGE_LXD" = true ]; then
|
|||||||
lxc profile device remove default eth0
|
lxc profile device remove default eth0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if lxc network list --format csv -q --project default | grep -q lxdbr0; then
|
if lxc network list --format csv | grep -q lxdbr0; then
|
||||||
lxc network delete lxdbr0 --project default
|
lxc network delete lxdbr0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if lxc network list --format csv -q --project default | grep -q lxdbr1; then
|
if lxc network list --format csv | grep -q lxdbr1; then
|
||||||
lxc network delete lxdbr1 --project default
|
lxc network delete lxdbr1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# # create the testnet/mainnet blocks/chainstate subvolumes.
|
# create the testnet/mainnet blocks/chainstate subvolumes.
|
||||||
# for CHAIN in mainnet testnet; do
|
for CHAIN in mainnet testnet; do
|
||||||
# for DATA in blocks chainstate; do
|
for DATA in blocks chainstate; do
|
||||||
# if lxc storage volume list ss-base | grep -q "$CHAIN-$DATA"; then
|
if lxc storage volume list ss-base | grep -q "$CHAIN-$DATA"; then
|
||||||
# lxc storage volume delete ss-base "$CHAIN-$DATA"
|
lxc storage volume delete ss-base "$CHAIN-$DATA"
|
||||||
# fi
|
fi
|
||||||
# done
|
done
|
||||||
# done
|
done
|
||||||
|
|
||||||
if lxc storage list --format csv | grep -q ss-base; then
|
if lxc storage list --format csv | grep -q ss-base; then
|
||||||
lxc storage delete ss-base
|
lxc storage delete ss-base
|
||||||
|
@ -7,36 +7,39 @@ cd "$(dirname "$0")"
|
|||||||
|
|
||||||
. ./remote_env.sh
|
. ./remote_env.sh
|
||||||
|
|
||||||
|
|
||||||
echo "Global Settings:"
|
echo "Global Settings:"
|
||||||
|
|
||||||
lxc image list
|
lxc image list
|
||||||
lxc storage list
|
lxc storage list
|
||||||
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
|
|
||||||
PROJECT_NAME="$(lxc info | grep "project:" | awk '{print $2}')"
|
|
||||||
export export="$PROJECT_NAME"
|
|
||||||
export PROJECT_PATH="$PROJECTS_PATH/$PROJECT_NAME"
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo "Active project: $PROJECT_NAME"
|
|
||||||
echo "----------------------------------------------------------"
|
|
||||||
|
|
||||||
echo " Networks:"
|
|
||||||
lxc network list
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo " Storage Volumes:"
|
|
||||||
lxc storage volume list ss-base
|
lxc storage volume list ss-base
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
|
||||||
|
for PROJECT_CHAIN in ${DEPLOYMENT_STRING//,/ }; do
|
||||||
|
NO_PARENS="${PROJECT_CHAIN:1:${#PROJECT_CHAIN}-2}"
|
||||||
|
PROJECT_PREFIX=$(echo "$NO_PARENS" | cut -d'|' -f1)
|
||||||
|
BITCOIN_CHAIN=$(echo "$NO_PARENS" | cut -d'|' -f2)
|
||||||
|
PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "Project: $PROJECT_NAME"
|
||||||
|
echo "----------------------------------------------------------"
|
||||||
|
if ! lxc info | grep "project:" | grep -q "$PROJECT_NAME"; then
|
||||||
|
if lxc project list | grep -q "$PROJECT_NAME"; then
|
||||||
|
lxc project switch "$PROJECT_NAME"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo " Networks:"
|
||||||
|
lxc network list
|
||||||
echo
|
echo
|
||||||
echo " Profiles:"
|
echo " Profiles:"
|
||||||
lxc profile list
|
lxc profile list
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo " Instances (VMs):"
|
echo " Instances (VMs):"
|
||||||
lxc list
|
lxc list
|
||||||
|
echo "----------------------------------------------------------"
|
||||||
|
done
|
@ -22,10 +22,54 @@ if [ "$RESPONSE" != "y" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
USER_TARGET_PROJECT=
|
||||||
|
|
||||||
|
# grab any modifications from the command line.
|
||||||
|
for i in "$@"; do
|
||||||
|
case $i in
|
||||||
|
--project=*)
|
||||||
|
USER_TARGET_PROJECT="${i#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unexpected option: $1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
. ../defaults.sh
|
. ../defaults.sh
|
||||||
|
|
||||||
. ./remote_env.sh
|
. ./remote_env.sh
|
||||||
|
|
||||||
|
for PROJECT_CHAIN in ${DEPLOYMENT_STRING//,/ }; do
|
||||||
|
NO_PARENS="${PROJECT_CHAIN:1:${#PROJECT_CHAIN}-2}"
|
||||||
|
PROJECT_PREFIX=$(echo "$NO_PARENS" | cut -d'|' -f1)
|
||||||
|
BITCOIN_CHAIN=$(echo "$NO_PARENS" | cut -d'|' -f2)
|
||||||
|
export PROJECT_PREFIX="$PROJECT_PREFIX"
|
||||||
|
export BITCOIN_CHAIN="$BITCOIN_CHAIN"
|
||||||
|
|
||||||
|
PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN"
|
||||||
|
PROJECT_PATH="$PROJECTS_DIR/$PROJECT_NAME"
|
||||||
|
|
||||||
|
# if the user sets USER_TARGET_PROJECT, let's ensure the project exists.
|
||||||
|
if [ -n "$USER_TARGET_PROJECT" ]; then
|
||||||
|
if ! lxc project list | grep -q "$USER_TARGET_PROJECT"; then
|
||||||
|
echo "ERROR: the project does not exist! Nothing to update."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$PROJECT_NAME" != "$USER_TARGET_PROJECT" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PROJECT_NAME="$PROJECT_NAME"
|
||||||
|
export PROJECT_PATH="$PROJECT_PATH"
|
||||||
|
|
||||||
. ./project_env.sh
|
. ./project_env.sh
|
||||||
|
|
||||||
# Check to see if any of the VMs actually don't exist.
|
# Check to see if any of the VMs actually don't exist.
|
||||||
@ -68,25 +112,18 @@ git checkout "$GIT_COMMIT_ON_REMOTE_HOST"
|
|||||||
cd -
|
cd -
|
||||||
|
|
||||||
# run deploy which backups up everything, but doesnt restart any services.
|
# run deploy which backups up everything, but doesnt restart any services.
|
||||||
bash -c "./project/deploy.sh --stop --backup-archive-path=$BTCPAY_RESTORE_ARCHIVE_PATH --backup-www --backup-btcpayserver"
|
bash -c "./project/deploy.sh --project=$PROJECT_NAME --stop --no-cert-renew --backup-archive-path=$BTCPAY_RESTORE_ARCHIVE_PATH"
|
||||||
|
|
||||||
# call the down script (be default it is non-destructuve of user data.)
|
# call the destroy script. If user proceed, then user data is DESTROYED!
|
||||||
./down.sh
|
bash -c "./destroy.sh --project=$PROJECT_NAME"
|
||||||
|
|
||||||
|
|
||||||
# next we switch back to the current version of Sovereign Stack scripts for bringin up the new version.
|
|
||||||
cd project/
|
cd project/
|
||||||
echo "INFO: switching the 'project' repo back to the most recent commit '$TARGET_PROJECT_GIT_COMMIT'"
|
echo "INFO: switching the 'project' repo back to the most recent commit '$TARGET_PROJECT_GIT_COMMIT'"
|
||||||
echo " That way new deployments will be instantiated using the latest codebase."
|
echo " That way new deployments will be instantiated using the latest codebase."
|
||||||
git checkout "$TARGET_PROJECT_GIT_COMMIT"
|
git checkout "$TARGET_PROJECT_GIT_COMMIT"
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
# Then we can run a restore operation and specify the backup archive at the CLI.
|
||||||
|
bash -c "./project/deploy.sh --project=$PROJECT_NAME -y --restore-www --restore-btcpay --backup-archive-path=$BTCPAY_RESTORE_ARCHIVE_PATH"
|
||||||
|
|
||||||
# TODO we can do some additional logic here. FOr example if the user wants to provide a source/target project/remote,
|
done
|
||||||
# we can backup the source remote+project and restore it to the target remote+project. This will facilitate cross-device migrations
|
|
||||||
|
|
||||||
# However, if the source and target project/remote are the same, we don't really
|
|
||||||
# need to do any restorations (or backups for that matter, though we still grab one);
|
|
||||||
# we simply mount the existing data. That's the more common case where the user is simply upgrading the system in-place.
|
|
||||||
|
|
||||||
./project/deploy.sh
|
|
97
install.sh
97
install.sh
@ -1,9 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
set -exu
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
# https://www.sovereign-stack.org/install/
|
# see https://www.sovereign-stack.org/management/
|
||||||
|
|
||||||
# this script is not meant to be executed from the SSME; Let's let's check and abort if so.
|
# this script is not meant to be executed from the SSME; Let's let's check and abort if so.
|
||||||
if [ "$(hostname)" = ss-mgmt ]; then
|
if [ "$(hostname)" = ss-mgmt ]; then
|
||||||
@ -19,6 +19,13 @@ fi
|
|||||||
DISK="rpool/lxd"
|
DISK="rpool/lxd"
|
||||||
export DISK="$DISK"
|
export DISK="$DISK"
|
||||||
|
|
||||||
|
# let's check to ensure the management machine is on the Baseline ubuntu
|
||||||
|
# TODO maybe remove this check; this theoretically should work on anything that support bash and lxd?
|
||||||
|
if ! lsb_release -d | grep -q "Ubuntu 22.04"; then
|
||||||
|
echo "ERROR: Your machine is not running the Ubuntu 22.04 LTS baseline OS on your management machine."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# install lxd snap and initialize it
|
# install lxd snap and initialize it
|
||||||
if ! snap list | grep -q lxd; then
|
if ! snap list | grep -q lxd; then
|
||||||
sudo snap install lxd --channel=latest/candidate
|
sudo snap install lxd --channel=latest/candidate
|
||||||
@ -79,68 +86,48 @@ fi
|
|||||||
|
|
||||||
# if the ss-mgmt doesn't exist, create it.
|
# if the ss-mgmt doesn't exist, create it.
|
||||||
SSH_PUBKEY_PATH="$HOME/.ssh/id_rsa.pub"
|
SSH_PUBKEY_PATH="$HOME/.ssh/id_rsa.pub"
|
||||||
FROM_BUILT_IMAGE=false
|
|
||||||
if ! lxc list --format csv | grep -q ss-mgmt; then
|
if ! lxc list --format csv | grep -q ss-mgmt; then
|
||||||
|
|
||||||
# TODO check to see if there's an existing ss-mgmt image to spawn from, otherwise do this.
|
|
||||||
if lxc image list | grep -q ss-mgmt; then
|
|
||||||
FROM_BUILT_IMAGE=true
|
|
||||||
lxc init ss-mgmt ss-mgmt --vm -c limits.cpu=4 -c limits.memory=4GiB --profile=default
|
|
||||||
else
|
|
||||||
lxc init "images:$BASE_LXC_IMAGE" ss-mgmt --vm -c limits.cpu=4 -c limits.memory=4GiB --profile=default
|
lxc init "images:$BASE_LXC_IMAGE" ss-mgmt --vm -c limits.cpu=4 -c limits.memory=4GiB --profile=default
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# mount the pre-verified sovereign stack git repo into the new vm
|
# mount the pre-verified sovereign stack git repo into the new vm
|
||||||
if ! lxc config device show ss-mgmt | grep -q ss-code; then
|
|
||||||
lxc config device add ss-mgmt ss-code disk source="$(pwd)" path=/home/ubuntu/sovereign-stack
|
lxc config device add ss-mgmt ss-code disk source="$(pwd)" path=/home/ubuntu/sovereign-stack
|
||||||
fi
|
|
||||||
|
|
||||||
# create the ~/ss path and mount it into the vm.
|
# create the ~/.ss path and mount it into the vm.
|
||||||
mkdir -p "$SS_ROOT_PATH"
|
mkdir -p "$SS_ROOT_PATH"
|
||||||
|
lxc config device add ss-mgmt ss-root disk source="$SS_ROOT_PATH" path=/home/ubuntu/.ss
|
||||||
|
|
||||||
if ! lxc config device show ss-mgmt | grep -q ss-root; then
|
# if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in.
|
||||||
lxc config device add ss-mgmt ss-root disk source="$SS_ROOT_PATH" path=/home/ubuntu/ss
|
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=$REMOTE_BITCOIN_CACHE_PATH/testnet/blocks
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# # if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in.
|
# if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in.
|
||||||
# BITCOIN_DIR="$HOME/.bitcoin"
|
BITCOIN_TESTNET_CHAINSTATE_PATH="$BITCOIN_DIR/testnet3/chainstate"
|
||||||
# REMOTE_BITCOIN_CACHE_PATH="/home/ubuntu/ss/cache/bitcoin"
|
if [ -d "$BITCOIN_TESTNET_CHAINSTATE_PATH" ]; then
|
||||||
# BITCOIN_TESTNET_BLOCKS_PATH="$BITCOIN_DIR/testnet3/blocks"
|
lxc config device add ss-mgmt ss-testnet-chainstate disk source="$BITCOIN_TESTNET_CHAINSTATE_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/testnet/chainstate
|
||||||
# if [ -d "$BITCOIN_TESTNET_BLOCKS_PATH" ]; then
|
fi
|
||||||
# if ! lxc config device show ss-mgmt | grep -q ss-testnet-blocks; then
|
|
||||||
# lxc config device add ss-mgmt ss-testnet-blocks disk source="$BITCOIN_TESTNET_BLOCKS_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/testnet/blocks
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# # if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in.
|
# if a ~/.bitcoin/blocks dir exists, mount it in.
|
||||||
# BITCOIN_TESTNET_CHAINSTATE_PATH="$BITCOIN_DIR/testnet3/chainstate"
|
BITCOIN_MAINNET_BLOCKS_PATH="$BITCOIN_DIR/blocks"
|
||||||
# if [ -d "$BITCOIN_TESTNET_CHAINSTATE_PATH" ]; then
|
if [ -d "$BITCOIN_MAINNET_BLOCKS_PATH" ]; then
|
||||||
# if ! lxc config device show ss-mgmt | grep -q ss-testnet-chainstate; then
|
lxc config device add ss-mgmt ss-mainnet-blocks disk source="$BITCOIN_MAINNET_BLOCKS_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/blocks
|
||||||
# lxc config device add ss-mgmt ss-testnet-chainstate disk source="$BITCOIN_TESTNET_CHAINSTATE_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/testnet/chainstate
|
else
|
||||||
# fi
|
echo "INFO: the blocks directory was not found for mainnet. It will NOT be mounted into ss-mgmt."
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
# # if a ~/.bitcoin/blocks dir exists, mount it in.
|
# if a ~/.bitcoin/testnet3/blocks direrectory exists, mount it in.
|
||||||
# BITCOIN_MAINNET_BLOCKS_PATH="$BITCOIN_DIR/blocks"
|
BITCOIN_MAINNET_CHAINSTATE_PATH="$BITCOIN_DIR/chainstate"
|
||||||
# if [ -d "$BITCOIN_MAINNET_BLOCKS_PATH" ]; then
|
if [ -d "$BITCOIN_MAINNET_CHAINSTATE_PATH" ]; then
|
||||||
# if ! lxc config device show ss-mgmt | grep -q ss-mainnet-blocks; then
|
lxc config device add ss-mgmt ss-mainnet-chainstate disk source="$BITCOIN_MAINNET_CHAINSTATE_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/chainstate
|
||||||
# lxc config device add ss-mgmt ss-mainnet-blocks disk source="$BITCOIN_MAINNET_BLOCKS_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/blocks
|
else
|
||||||
# fi
|
echo "INFO: the chainstate directory was not found for mainnet. It will NOT be mounted into ss-mgmt."
|
||||||
# fi
|
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
|
|
||||||
# if ! lxc config device show ss-mgmt | grep -q ss-mainnet-blocks; then
|
|
||||||
# lxc config device add ss-mgmt ss-mainnet-chainstate disk source="$BITCOIN_MAINNET_CHAINSTATE_PATH" path=$REMOTE_BITCOIN_CACHE_PATH/mainnet/chainstate
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# mount the ssh directory in there.
|
# mount the ssh directory in there.
|
||||||
if [ -f "$SSH_PUBKEY_PATH" ]; then
|
if [ -f "$SSH_PUBKEY_PATH" ]; then
|
||||||
if ! lxc config device show ss-mgmt | grep -q ss-ssh; then
|
|
||||||
lxc config device add ss-mgmt ss-ssh disk source="$HOME/.ssh" path=/home/ubuntu/.ssh
|
lxc config device add ss-mgmt ss-ssh disk source="$HOME/.ssh" path=/home/ubuntu/.ssh
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -189,25 +176,15 @@ ssh-keyscan -H -t ecdsa "$IP_V4_ADDRESS" >> "$SSH_HOME/known_hosts"
|
|||||||
|
|
||||||
ssh "ubuntu@$IP_V4_ADDRESS" sudo chown -R ubuntu:ubuntu /home/ubuntu
|
ssh "ubuntu@$IP_V4_ADDRESS" sudo chown -R ubuntu:ubuntu /home/ubuntu
|
||||||
|
|
||||||
|
|
||||||
if [ "$FROM_BUILT_IMAGE" = false ]; then
|
|
||||||
ssh "ubuntu@$IP_V4_ADDRESS" /home/ubuntu/sovereign-stack/management/provision.sh
|
ssh "ubuntu@$IP_V4_ADDRESS" /home/ubuntu/sovereign-stack/management/provision.sh
|
||||||
|
|
||||||
lxc stop ss-mgmt
|
#lxc restart ss-mgmt
|
||||||
|
|
||||||
if ! lxc image list | grep -q "ss-mgmt"; then
|
|
||||||
lxc publish ss-mgmt --alias=ss-mgmt
|
|
||||||
fi
|
|
||||||
|
|
||||||
lxc start ss-mgmt
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$ADDED_COMMAND" = true ]; then
|
if [ "$ADDED_COMMAND" = true ]; then
|
||||||
echo "NOTICE! You need to run 'source ~/.bashrc' before continuing. After that, type 'ss-manage' to enter your management environment."
|
echo "NOTICE! You need to run 'source ~/.bashrc' before continuing. After that, type 'ss-manage' to enter your management environment."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. ./defaults.sh
|
. ./defaults.sh
|
||||||
|
|
||||||
# As part of the install script, we pull down any other sovereign-stack git repos
|
# As part of the install script, we pull down any other sovereign-stack git repos
|
||||||
PROJECTS_SCRIPTS_REPO_URL="https://git.sovereign-stack.org/ss/project"
|
PROJECTS_SCRIPTS_REPO_URL="https://git.sovereign-stack.org/ss/project"
|
||||||
PROJECTS_SCRIPTS_PATH="$(pwd)/deployment/project"
|
PROJECTS_SCRIPTS_PATH="$(pwd)/deployment/project"
|
||||||
|
@ -1,16 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# https://www.sovereign-stack.org/ss-manage/
|
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
# check to ensure dependencies are met.
|
|
||||||
if ! command -v lxc >/dev/null 2>&1; then
|
|
||||||
echo "This script requires 'lxd/lxc' to be installed. Please run 'install.sh'."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! lxc remote get-default | grep -q "local"; then
|
if ! lxc remote get-default | grep -q "local"; then
|
||||||
lxc remote switch "local"
|
lxc remote switch "local"
|
||||||
fi
|
fi
|
||||||
|
@ -5,7 +5,7 @@ alias ss-remote='/home/ubuntu/sovereign-stack/deployment/remote.sh $@'
|
|||||||
alias ss-show='/home/ubuntu/sovereign-stack/deployment/show.sh $@'
|
alias ss-show='/home/ubuntu/sovereign-stack/deployment/show.sh $@'
|
||||||
alias ss-reset='/home/ubuntu/sovereign-stack/deployment/reset.sh $@'
|
alias ss-reset='/home/ubuntu/sovereign-stack/deployment/reset.sh $@'
|
||||||
alias ss-update='/home/ubuntu/sovereign-stack/deployment/update.sh $@'
|
alias ss-update='/home/ubuntu/sovereign-stack/deployment/update.sh $@'
|
||||||
alias ss-down='/home/ubuntu/sovereign-stack/deployment/down.sh $@'
|
alias ss-destroy='/home/ubuntu/sovereign-stack/deployment/destroy.sh $@'
|
||||||
alias ss-help='cat /home/ubuntu/sovereign-stack/deployment/help.txt'
|
alias ss-help='cat /home/ubuntu/sovereign-stack/deployment/help.txt'
|
||||||
|
|
||||||
alias ll='ls -lah'
|
alias ll='ls -lah'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
set -exu
|
||||||
|
|
||||||
PURGE_LXD=false
|
PURGE_LXD=false
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ if [ "$PURGE_LXD" = true ]; then
|
|||||||
lxc profile device remove default enp5s0
|
lxc profile device remove default enp5s0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if lxc network list --project default | grep -q lxdbr0; then
|
if lxc network list | grep -q lxdbr0; then
|
||||||
lxc network delete lxdbr0
|
lxc network delete lxdbr0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user