1
1
sovereign-stack/deployment/project_env.sh

52 lines
1.6 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-04-04 20:25:58 +00:00
PROJECT_NAME="$(lxc info | grep "project:" | awk '{print $2}')"
export PROJECT_NAME="$PROJECT_NAME"
2023-04-04 15:32:54 +00:00
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"
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
if [ ! -f "$PRIMARY_SITE_DEFINITION_PATH" ]; then
echo "ERROR: the site definition does not exist."
exit 1
fi
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
source "$PRIMARY_SITE_DEFINITION_PATH"
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}"
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"