Scope to correct project.
This commit is contained in:
parent
69ab9d0a42
commit
5a54400831
@ -1,7 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
cd "$(dirname "$0")"
|
|
||||||
|
export PROJECT_NAME="$(lxc info | grep "project:" | awk '{print $2}')"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
PROJECT_PREFIX=$(echo "$PROJECT_NAME" | cut -d'-' -f1)
|
||||||
|
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"
|
||||||
|
|
||||||
@ -26,12 +38,6 @@ fi
|
|||||||
|
|
||||||
source "$PRIMARY_SITE_DEFINITION_PATH"
|
source "$PRIMARY_SITE_DEFINITION_PATH"
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
SHASUM_OF_PRIMARY_DOMAIN="$(echo -n "$PRIMARY_DOMAIN" | sha256sum | awk '{print $1;}' )"
|
SHASUM_OF_PRIMARY_DOMAIN="$(echo -n "$PRIMARY_DOMAIN" | sha256sum | awk '{print $1;}' )"
|
||||||
export PRIMARY_DOMAIN_IDENTIFIER="${SHASUM_OF_PRIMARY_DOMAIN: -6}"
|
export PRIMARY_DOMAIN_IDENTIFIER="${SHASUM_OF_PRIMARY_DOMAIN: -6}"
|
||||||
|
|
||||||
|
@ -129,14 +129,14 @@ if ! command -v lxc >/dev/null 2>&1; then
|
|||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if lxc network list --format csv | grep -q lxdbr0; then
|
if lxc network list --format csv -q --project default | grep -q lxdbr0; then
|
||||||
lxc network delete lxdbr0
|
lxc network delete lxdbr0 --project default
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if lxc network list --format csv | grep -q lxdbr1; then
|
if lxc network list --format csv -q project default | grep -q lxdbr1; then
|
||||||
lxc network delete lxdbr1
|
lxc network delete lxdbr1 --project default
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -38,3 +38,50 @@ 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=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# default values are already at regtest mode.
|
||||||
|
if [ "$BITCOIN_CHAIN" = testnet ]; then
|
||||||
|
|
||||||
|
WWW_SSDATA_DISK_SIZE_GB=30
|
||||||
|
WWW_BACKUP_DISK_SIZE_GB=80
|
||||||
|
WWW_DOCKER_DISK_SIZE_GB=50
|
||||||
|
|
||||||
|
BTCPAYSERVER_SSDATA_DISK_SIZE_GB=30
|
||||||
|
BTCPAYSERVER_BACKUP_DISK_SIZE_GB=5
|
||||||
|
BTCPAYSERVER_DOCKER_DISK_SIZE_GB=50
|
||||||
|
|
||||||
|
elif [ "$BITCOIN_CHAIN" = mainnet ]; then
|
||||||
|
|
||||||
|
WWW_SSDATA_DISK_SIZE_GB=40
|
||||||
|
WWW_BACKUP_DISK_SIZE_GB=80
|
||||||
|
WWW_DOCKER_DISK_SIZE_GB=40
|
||||||
|
|
||||||
|
BTCPAYSERVER_SSDATA_DISK_SIZE_GB=30
|
||||||
|
BTCPAYSERVER_BACKUP_DISK_SIZE_GB=10
|
||||||
|
BTCPAYSERVER_DOCKER_DISK_SIZE_GB=300
|
||||||
|
|
||||||
|
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
|
@ -55,12 +55,12 @@ 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 | grep -q lxdbr0; then
|
if lxc network list --format csv -q --project default | grep -q lxdbr0; then
|
||||||
lxc network delete lxdbr0
|
lxc network delete lxdbr0 --project default
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if lxc network list --format csv | grep -q lxdbr1; then
|
if lxc network list --format csv -q --project default | grep -q lxdbr1; then
|
||||||
lxc network delete lxdbr1
|
lxc network delete lxdbr1 --project default
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create the testnet/mainnet blocks/chainstate subvolumes.
|
# create the testnet/mainnet blocks/chainstate subvolumes.
|
||||||
|
Loading…
Reference in New Issue
Block a user