1
1
sovereign-stack/deployment/project_env.sh

65 lines
1.9 KiB
Bash
Raw Normal View History

2023-03-05 16:45:27 +00:00
#!/bin/bash
set -eu
2023-04-04 15:32:54 +00:00
2023-09-22 23:46:07 +00:00
PROJECT_NAME="$(incus info | grep "project:" | awk '{print $2}')"
2023-04-04 20:25:58 +00:00
export PROJECT_NAME="$PROJECT_NAME"
2023-04-04 15:32:54 +00:00
if [ "$PROJECT_NAME" = default ]; then
2023-09-22 23:46:07 +00:00
echo "ERROR: You are on the default project. Use 'incus project list' and 'incus project switch <project>'."
2023-04-04 15:32:54 +00:00
exit 1
fi
export PROJECT_PATH="$PROJECTS_PATH/$PROJECT_NAME"
2023-03-05 16:45:27 +00:00
2023-03-13 17:40:47 +00:00
PROJECT_DEFINITION_PATH="$PROJECT_PATH/project.conf"
2023-03-05 16:45:27 +00:00
if [ ! -f "$PROJECT_DEFINITION_PATH" ]; then
2023-03-13 17:40:47 +00:00
echo "ERROR: 'project.conf' not found $PROJECT_DEFINITION_PATH not found."
2023-03-05 16:45:27 +00:00
exit 1
fi
source "$PROJECT_DEFINITION_PATH"
2023-03-13 17:54:29 +00:00
2023-04-07 14:41:18 +00:00
2023-03-13 17:54:29 +00:00
export PRIMARY_SITE_DEFINITION_PATH="$SITES_PATH/$PRIMARY_DOMAIN/site.conf"
2023-03-11 16:12:19 +00:00
2023-03-05 16:45:27 +00:00
if [ -z "$PRIMARY_DOMAIN" ]; then
2023-03-11 03:40:50 +00:00
echo "ERROR: The PRIMARY_DOMAIN is not specified. Check your remote definition at '$PRIMARY_SITE_DEFINITION_PATH'."
2023-03-05 16:45:27 +00:00
exit 1
fi
2023-03-11 16:12:19 +00:00
2023-03-30 15:10:42 +00:00
SHASUM_OF_PRIMARY_DOMAIN="$(echo -n "$PRIMARY_DOMAIN" | sha256sum | awk '{print $1;}' )"
export PRIMARY_DOMAIN_IDENTIFIER="${SHASUM_OF_PRIMARY_DOMAIN: -6}"
2023-12-14 17:51:52 +00:00
# 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
2023-12-14 21:19:42 +00:00
WWW_DOCKER_DISK_SIZE_GB=50
2023-12-14 17:51:52 +00:00
BTCPAYSERVER_SSDATA_DISK_SIZE_GB=30
BTCPAYSERVER_BACKUP_DISK_SIZE_GB=30
2023-12-14 21:19:42 +00:00
BTCPAYSERVER_DOCKER_DISK_SIZE_GB=300
2023-12-14 17:51:52 +00:00
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"
2023-12-14 17:51:52 +00:00
export BTCPAYSERVER_DOCKER_DISK_SIZE_GB="$BTCPAYSERVER_DOCKER_DISK_SIZE_GB"