Compare commits
6 Commits
8caae387b6
...
299446b7e8
Author | SHA1 | Date | |
---|---|---|---|
299446b7e8 | |||
a19bbec9c1 | |||
ecd6b3a77d | |||
9b8a2403eb | |||
1de414dfc9 | |||
7ce1f0adbe |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
publish.sh
|
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
||||||
export DEPLOY_GHOST=true
|
export DEPLOY_GHOST=true
|
||||||
export DEPLOY_CLAMS=true
|
export DEPLOY_CLAMS=true
|
||||||
|
|
||||||
@ -16,7 +15,6 @@ export NEXTCLOUD_HOSTNAME="nextcloud"
|
|||||||
export GITEA_HOSTNAME="git"
|
export GITEA_HOSTNAME="git"
|
||||||
export NOSTR_HOSTNAME="relay"
|
export NOSTR_HOSTNAME="relay"
|
||||||
export CLAMS_HOSTNAME="clams"
|
export CLAMS_HOSTNAME="clams"
|
||||||
export CLAMS_GIT_REPO="https://github.com/farscapian/clams-app-docker.git"
|
|
||||||
|
|
||||||
export SITE_LANGUAGE_CODES="en"
|
export SITE_LANGUAGE_CODES="en"
|
||||||
export LANGUAGE_CODE="en"
|
export LANGUAGE_CODE="en"
|
||||||
@ -53,7 +51,7 @@ DEFAULT_DB_IMAGE="mariadb:10.9.3-jammy"
|
|||||||
|
|
||||||
|
|
||||||
# run the docker stack.
|
# run the docker stack.
|
||||||
export GHOST_IMAGE="ghost:5.26.2"
|
export GHOST_IMAGE="ghost:5.37.0"
|
||||||
|
|
||||||
# TODO switch to mysql. May require intricate export work for existing sites.
|
# TODO switch to mysql. May require intricate export work for existing sites.
|
||||||
# THIS MUST BE COMPLETED BEFORE v1 RELEASE
|
# THIS MUST BE COMPLETED BEFORE v1 RELEASE
|
||||||
@ -61,10 +59,10 @@ export GHOST_IMAGE="ghost:5.26.2"
|
|||||||
export GHOST_DB_IMAGE="$DEFAULT_DB_IMAGE"
|
export GHOST_DB_IMAGE="$DEFAULT_DB_IMAGE"
|
||||||
|
|
||||||
|
|
||||||
export NGINX_IMAGE="nginx:1.23.2"
|
export NGINX_IMAGE="nginx:1.23.3"
|
||||||
|
|
||||||
# version of backup is 24.0.3
|
# version of backup is 24.0.3
|
||||||
export NEXTCLOUD_IMAGE="nextcloud:25.0.2"
|
export NEXTCLOUD_IMAGE="nextcloud:25.0.4"
|
||||||
export NEXTCLOUD_DB_IMAGE="$DEFAULT_DB_IMAGE"
|
export NEXTCLOUD_DB_IMAGE="$DEFAULT_DB_IMAGE"
|
||||||
|
|
||||||
# TODO PIN the gitea version number.
|
# TODO PIN the gitea version number.
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
|
|
||||||
|
|
||||||
check_dependencies () {
|
|
||||||
for cmd in "$@"; do
|
|
||||||
if ! command -v "$cmd" >/dev/null 2>&1; then
|
|
||||||
echo "This script requires \"${cmd}\" to be installed. Please run 'install.sh'."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check system's dependencies
|
|
||||||
check_dependencies wait-for-it dig rsync sshfs lxc
|
|
||||||
|
|
||||||
# let's check to ensure the management machine is on the Baseline ubuntu 21.04
|
|
||||||
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
|
|
@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
if lxc remote get-default | grep -q "production"; then
|
|
||||||
echo "WARNING: You are running command against a production system!"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# check if there are any uncommited changes. It's dangerous to
|
|
||||||
# alter production systems when you have commits to make or changes to stash.
|
|
||||||
if git update-index --refresh | grep -q "needs update"; then
|
|
||||||
echo "ERROR: You have uncommited changes! You MUST commit or stash all changes to continue."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
RESPONSE=
|
|
||||||
read -r -p " Are you sure you want to continue (y) ": RESPONSE
|
|
||||||
if [ "$RESPONSE" != "y" ]; then
|
|
||||||
echo "STOPPING."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
@ -36,7 +36,7 @@ if [ ! -f "$CLUSTER_DEFINITION" ]; then
|
|||||||
export LXD_CLUSTER_PASSWORD="$(gpg --gen-random --armor 1 14)"
|
export LXD_CLUSTER_PASSWORD="$(gpg --gen-random --armor 1 14)"
|
||||||
export BITCOIN_CHAIN="regtest"
|
export BITCOIN_CHAIN="regtest"
|
||||||
export PROJECT_PREFIX="dev"
|
export PROJECT_PREFIX="dev"
|
||||||
#export REGISTRY_URL="https://index.docker.io/v1/"
|
#export REGISTRY_URL=http://registry.domain.tld:5000
|
||||||
|
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ fi
|
|||||||
|
|
||||||
. ../defaults.sh
|
. ../defaults.sh
|
||||||
|
|
||||||
|
|
||||||
. ./cluster_env.sh
|
. ./cluster_env.sh
|
||||||
|
|
||||||
. ./project_env.sh
|
. ./project_env.sh
|
||||||
|
@ -44,10 +44,10 @@ echo "INFO: The BTCPAY_RESTORE_ARCHIVE_PATH for this migration will be: $BTCPAY_
|
|||||||
# by default, we grab a backup.
|
# by default, we grab a backup.
|
||||||
|
|
||||||
# run deploy which backups up everything, but doesnt restart any services.
|
# run deploy which backups up everything, but doesnt restart any services.
|
||||||
bash -c "./deploy.sh --stop --no-cert-renew --backup-archive-path=$BTCPAY_RESTORE_ARCHIVE_PATH"
|
bash -c "./project/deploy.sh --stop --no-cert-renew --backup-archive-path=$BTCPAY_RESTORE_ARCHIVE_PATH"
|
||||||
|
|
||||||
# call the destroy script. If user proceed, then user data is DESTROYED!
|
# call the destroy script. If user proceed, then user data is DESTROYED!
|
||||||
USER_SAYS_YES="$USER_SAYS_YES" ./destroy.sh
|
USER_SAYS_YES="$USER_SAYS_YES" ./destroy.sh
|
||||||
|
|
||||||
# Then we can run a restore operation and specify the backup archive at the CLI.
|
# Then we can run a restore operation and specify the backup archive at the CLI.
|
||||||
bash -c "./deploy.sh -y --restore-www --restore-btcpay --backup-archive-path=$BTCPAY_RESTORE_ARCHIVE_PATH"
|
bash -c "./project/deploy.sh -y --restore-www --restore-btcpay --backup-archive-path=$BTCPAY_RESTORE_ARCHIVE_PATH"
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
set -exu
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
export DOCKER_HOST="ssh://ubuntu@$BTCPAY_FQDN"
|
export DOCKER_HOST="ssh://ubuntu@$BTCPAY_FQDN"
|
||||||
|
|
||||||
docker pull btcpayserver/lightning:v22.11.1
|
|
||||||
docker build -t clightning:latest ./core-lightning
|
|
||||||
|
|
||||||
# run the btcpay setup script if it hasn't been done before.
|
# run the btcpay setup script if it hasn't been done before.
|
||||||
if [ "$(ssh "$BTCPAY_FQDN" [[ ! -f "$REMOTE_HOME/btcpay.complete" ]]; echo $?)" -eq 0 ]; then
|
if [ "$(ssh "$BTCPAY_FQDN" [[ ! -f "$REMOTE_HOME/btcpay.complete" ]]; echo $?)" -eq 0 ]; then
|
||||||
./stub_btcpay_setup.sh
|
./stub_btcpay_setup.sh
|
@ -20,8 +20,7 @@ export CLIGHTNING_WEBSOCKET_PORT="$CLIGHTNING_WEBSOCKET_PORT"
|
|||||||
# It also supports modern TLS, so SSL certs must be available.
|
# It also supports modern TLS, so SSL certs must be available.
|
||||||
#opt-add-nostr-relay;
|
#opt-add-nostr-relay;
|
||||||
|
|
||||||
export BTCPAYSERVER_GITREPO="https://github.com/farscapian/btcpayserver-docker"
|
export BTCPAYSERVER_GITREPO="https://github.com/btcpayserver/btcpayserver-docker"
|
||||||
#https://github.com/btcpayserver/btcpayserver-docker
|
|
||||||
|
|
||||||
cat > "$SITE_PATH/btcpay.sh" <<EOL
|
cat > "$SITE_PATH/btcpay.sh" <<EOL
|
||||||
#!/bin/bash
|
#!/bin/bash
|
@ -5,7 +5,6 @@ cd "$(dirname "$0")"
|
|||||||
|
|
||||||
./stub_lxc_profile.sh "$BASE_IMAGE_VM_NAME"
|
./stub_lxc_profile.sh "$BASE_IMAGE_VM_NAME"
|
||||||
|
|
||||||
|
|
||||||
# let's download our base image.
|
# let's download our base image.
|
||||||
if ! lxc image list --format csv --columns l | grep -q "$UBUNTU_BASE_IMAGE_NAME"; then
|
if ! lxc image list --format csv --columns l | grep -q "$UBUNTU_BASE_IMAGE_NAME"; then
|
||||||
# if the image doesn't exist, download it from Ubuntu's image server
|
# if the image doesn't exist, download it from Ubuntu's image server
|
@ -3,18 +3,44 @@
|
|||||||
set -ex
|
set -ex
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
LATEST_GIT_COMMIT="$(cat ../.git/refs/heads/master)"
|
LATEST_GIT_COMMIT="$(cat ../../.git/refs/heads/master)"
|
||||||
export LATEST_GIT_COMMIT="$LATEST_GIT_COMMIT"
|
export LATEST_GIT_COMMIT="$LATEST_GIT_COMMIT"
|
||||||
|
|
||||||
./check_dependencies.sh
|
# check to ensure dependencies are met.
|
||||||
./check_environment.sh
|
for cmd in wait-for-it dig rsync sshfs lxc; do
|
||||||
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
||||||
|
echo "This script requires \"${cmd}\" to be installed. Please run 'install.sh'."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# do a spot check; if we are on production warn.
|
||||||
|
if lxc remote get-default | grep -q "production"; then
|
||||||
|
echo "WARNING: You are running command against a production system!"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# check if there are any uncommited changes. It's dangerous to
|
||||||
|
# alter production systems when you have commits to make or changes to stash.
|
||||||
|
if git update-index --refresh | grep -q "needs update"; then
|
||||||
|
echo "ERROR: You have uncommited changes! You MUST commit or stash all changes to continue."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
RESPONSE=
|
||||||
|
read -r -p " Are you sure you want to continue (y) ": RESPONSE
|
||||||
|
if [ "$RESPONSE" != "y" ]; then
|
||||||
|
echo "STOPPING."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
DOMAIN_NAME=
|
DOMAIN_NAME=
|
||||||
RUN_CERT_RENEWAL=true
|
RUN_CERT_RENEWAL=true
|
||||||
SKIP_WWW=false
|
SKIP_WWW=false
|
||||||
RESTORE_WWW=false
|
RESTORE_WWW=false
|
||||||
BACKUP_CERTS=false
|
BACKUP_CERTS=true
|
||||||
BACKUP_APPS=false
|
BACKUP_APPS=true
|
||||||
BACKUP_BTCPAY=true
|
BACKUP_BTCPAY=true
|
||||||
BACKUP_BTCPAY_ARCHIVE_PATH=
|
BACKUP_BTCPAY_ARCHIVE_PATH=
|
||||||
RESTORE_BTCPAY=false
|
RESTORE_BTCPAY=false
|
||||||
@ -109,7 +135,7 @@ if [ "$RESTORE_BTCPAY" = true ] && [ -z "$BACKUP_BTCPAY_ARCHIVE_PATH" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# set up our default paths.
|
# set up our default paths.
|
||||||
source ../defaults.sh
|
source ../../defaults.sh
|
||||||
|
|
||||||
export DOMAIN_NAME="$DOMAIN_NAME"
|
export DOMAIN_NAME="$DOMAIN_NAME"
|
||||||
export REGISTRY_DOCKER_IMAGE="registry:2"
|
export REGISTRY_DOCKER_IMAGE="registry:2"
|
||||||
@ -153,122 +179,6 @@ function new_pass {
|
|||||||
gpg --gen-random --armor 1 25
|
gpg --gen-random --armor 1 25
|
||||||
}
|
}
|
||||||
|
|
||||||
function instantiate_vms {
|
|
||||||
|
|
||||||
export UPDATE_BTCPAY="$UPDATE_BTCPAY"
|
|
||||||
export RECONFIGURE_BTCPAY_SERVER="$RECONFIGURE_BTCPAY_SERVER"
|
|
||||||
|
|
||||||
# iterate over all our server endpoints and provision them if needed.
|
|
||||||
# www
|
|
||||||
VPS_HOSTNAME=
|
|
||||||
|
|
||||||
for VIRTUAL_MACHINE in www btcpayserver; do
|
|
||||||
export VIRTUAL_MACHINE="$VIRTUAL_MACHINE"
|
|
||||||
FQDN=
|
|
||||||
|
|
||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
|
||||||
|
|
||||||
source "$SITE_PATH/site_definition"
|
|
||||||
source ./domain_env.sh
|
|
||||||
|
|
||||||
# VALIDATE THE INPUT from the ENVFILE
|
|
||||||
if [ -z "$DOMAIN_NAME" ]; then
|
|
||||||
echo "ERROR: DOMAIN_NAME not specified. Use the --domain-name= option."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# # switch to the default project
|
|
||||||
# if ! lxc project list --format csv | grep -a "default (current)"; then
|
|
||||||
# lxc project switch default
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# Goal is to get the macvlan interface.
|
|
||||||
LXD_SS_CONFIG_LINE=
|
|
||||||
if lxc network list --format csv | grep lxdbr0 | grep -q ss-config; then
|
|
||||||
LXD_SS_CONFIG_LINE="$(lxc network list --format csv | grep lxdbr0 | grep ss-config)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$LXD_SS_CONFIG_LINE" ]; then
|
|
||||||
echo "ERROR: the MACVLAN interface has not been specified. You may need to run ss-cluster again."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
CONFIG_ITEMS="$(echo "$LXD_SS_CONFIG_LINE" | awk -F'"' '{print $2}')"
|
|
||||||
DATA_PLANE_MACVLAN_INTERFACE="$(echo "$CONFIG_ITEMS" | cut -d ',' -f2)"
|
|
||||||
export DATA_PLANE_MACVLAN_INTERFACE="$DATA_PLANE_MACVLAN_INTERFACE"
|
|
||||||
|
|
||||||
|
|
||||||
# # switch to the default project to ensure the base image is created.
|
|
||||||
# if ! lxc project list --format csv | grep -a "default (current)"; then
|
|
||||||
# lxc project switch default
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# create the lxd base image.
|
|
||||||
./create_lxc_base.sh
|
|
||||||
|
|
||||||
# # now switch to the current chain project.
|
|
||||||
# if ! lxc project list --format csv | grep -a "$BITCOIN_CHAIN"; then
|
|
||||||
# lxc project switch "$BITCOIN_CHAIN"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
export MAC_ADDRESS_TO_PROVISION=
|
|
||||||
export VPS_HOSTNAME="$VPS_HOSTNAME"
|
|
||||||
export FQDN="$VPS_HOSTNAME.$DOMAIN_NAME"
|
|
||||||
|
|
||||||
DDNS_HOST=
|
|
||||||
|
|
||||||
if [ "$VIRTUAL_MACHINE" = www ]; then
|
|
||||||
if [ "$SKIP_WWW" = true ]; then
|
|
||||||
echo "INFO: Skipping WWW due to command line argument."
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
VPS_HOSTNAME="$WWW_HOSTNAME"
|
|
||||||
MAC_ADDRESS_TO_PROVISION="$WWW_SERVER_MAC_ADDRESS"
|
|
||||||
DDNS_HOST="$WWW_HOSTNAME"
|
|
||||||
ROOT_DISK_SIZE_GB="$((ROOT_DISK_SIZE_GB + NEXTCLOUD_SPACE_GB))"
|
|
||||||
elif [ "$VIRTUAL_MACHINE" = btcpayserver ] || [ "$SKIP_BTCPAY" = true ]; then
|
|
||||||
|
|
||||||
|
|
||||||
DDNS_HOST="$BTCPAY_HOSTNAME"
|
|
||||||
VPS_HOSTNAME="$BTCPAY_HOSTNAME"
|
|
||||||
MAC_ADDRESS_TO_PROVISION="$BTCPAYSERVER_MAC_ADDRESS"
|
|
||||||
if [ "$BITCOIN_CHAIN" = mainnet ]; then
|
|
||||||
ROOT_DISK_SIZE_GB=150
|
|
||||||
elif [ "$BITCOIN_CHAIN" = testnet ]; then
|
|
||||||
ROOT_DISK_SIZE_GB=70
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ "$VIRTUAL_MACHINE" = "$BASE_IMAGE_VM_NAME" ]; then
|
|
||||||
DDNS_HOST="$BASE_IMAGE_VM_NAME"
|
|
||||||
ROOT_DISK_SIZE_GB=8
|
|
||||||
else
|
|
||||||
echo "ERROR: VIRTUAL_MACHINE not within allowable bounds."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
export DDNS_HOST="$DDNS_HOST"
|
|
||||||
export FQDN="$DDNS_HOST.$DOMAIN_NAME"
|
|
||||||
export LXD_VM_NAME="${FQDN//./-}"
|
|
||||||
export VIRTUAL_MACHINE="$VIRTUAL_MACHINE"
|
|
||||||
export REMOTE_CERT_DIR="$REMOTE_CERT_BASE_DIR/$FQDN"
|
|
||||||
export MAC_ADDRESS_TO_PROVISION="$MAC_ADDRESS_TO_PROVISION"
|
|
||||||
|
|
||||||
./deploy_vms.sh
|
|
||||||
|
|
||||||
if [ "$VIRTUAL_MACHINE" = www ]; then
|
|
||||||
# this tells our local docker client to target the remote endpoint via SSH
|
|
||||||
export DOCKER_HOST="ssh://ubuntu@$PRIMARY_WWW_FQDN"
|
|
||||||
|
|
||||||
# enable docker swarm mode so we can support docker stacks.
|
|
||||||
if docker info | grep -q "Swarm: inactive"; then
|
|
||||||
docker swarm init --advertise-addr enp6s0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function stub_site_definition {
|
function stub_site_definition {
|
||||||
mkdir -p "$SITE_PATH" "$PROJECT_PATH/sites"
|
mkdir -p "$SITE_PATH" "$PROJECT_PATH/sites"
|
||||||
@ -403,7 +313,118 @@ export PRIMARY_WWW_FQDN="$WWW_HOSTNAME.$DOMAIN_NAME"
|
|||||||
stub_site_definition
|
stub_site_definition
|
||||||
|
|
||||||
# bring the VMs up under the primary domain name.
|
# bring the VMs up under the primary domain name.
|
||||||
instantiate_vms
|
|
||||||
|
export UPDATE_BTCPAY="$UPDATE_BTCPAY"
|
||||||
|
export RECONFIGURE_BTCPAY_SERVER="$RECONFIGURE_BTCPAY_SERVER"
|
||||||
|
|
||||||
|
# iterate over all our server endpoints and provision them if needed.
|
||||||
|
# www
|
||||||
|
VPS_HOSTNAME=
|
||||||
|
|
||||||
|
for VIRTUAL_MACHINE in www btcpayserver; do
|
||||||
|
export VIRTUAL_MACHINE="$VIRTUAL_MACHINE"
|
||||||
|
FQDN=
|
||||||
|
|
||||||
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
|
source "$SITE_PATH/site_definition"
|
||||||
|
source ./domain_env.sh
|
||||||
|
|
||||||
|
# VALIDATE THE INPUT from the ENVFILE
|
||||||
|
if [ -z "$DOMAIN_NAME" ]; then
|
||||||
|
echo "ERROR: DOMAIN_NAME not specified. Use the --domain-name= option."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# # switch to the default project
|
||||||
|
# if ! lxc project list --format csv | grep -a "default (current)"; then
|
||||||
|
# lxc project switch default
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# Goal is to get the macvlan interface.
|
||||||
|
LXD_SS_CONFIG_LINE=
|
||||||
|
if lxc network list --format csv | grep lxdbr0 | grep -q ss-config; then
|
||||||
|
LXD_SS_CONFIG_LINE="$(lxc network list --format csv | grep lxdbr0 | grep ss-config)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$LXD_SS_CONFIG_LINE" ]; then
|
||||||
|
echo "ERROR: the MACVLAN interface has not been specified. You may need to run ss-cluster again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONFIG_ITEMS="$(echo "$LXD_SS_CONFIG_LINE" | awk -F'"' '{print $2}')"
|
||||||
|
DATA_PLANE_MACVLAN_INTERFACE="$(echo "$CONFIG_ITEMS" | cut -d ',' -f2)"
|
||||||
|
export DATA_PLANE_MACVLAN_INTERFACE="$DATA_PLANE_MACVLAN_INTERFACE"
|
||||||
|
|
||||||
|
|
||||||
|
# # switch to the default project to ensure the base image is created.
|
||||||
|
# if ! lxc project list --format csv | grep -a "default (current)"; then
|
||||||
|
# lxc project switch default
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# create the lxd base image.
|
||||||
|
./create_lxc_base.sh
|
||||||
|
|
||||||
|
# # now switch to the current chain project.
|
||||||
|
# if ! lxc project list --format csv | grep -a "$BITCOIN_CHAIN"; then
|
||||||
|
# lxc project switch "$BITCOIN_CHAIN"
|
||||||
|
# fi
|
||||||
|
|
||||||
|
export MAC_ADDRESS_TO_PROVISION=
|
||||||
|
export VPS_HOSTNAME="$VPS_HOSTNAME"
|
||||||
|
export FQDN="$VPS_HOSTNAME.$DOMAIN_NAME"
|
||||||
|
|
||||||
|
DDNS_HOST=
|
||||||
|
|
||||||
|
if [ "$VIRTUAL_MACHINE" = www ]; then
|
||||||
|
if [ "$SKIP_WWW" = true ]; then
|
||||||
|
echo "INFO: Skipping WWW due to command line argument."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
VPS_HOSTNAME="$WWW_HOSTNAME"
|
||||||
|
MAC_ADDRESS_TO_PROVISION="$WWW_SERVER_MAC_ADDRESS"
|
||||||
|
DDNS_HOST="$WWW_HOSTNAME"
|
||||||
|
ROOT_DISK_SIZE_GB="$((ROOT_DISK_SIZE_GB + NEXTCLOUD_SPACE_GB))"
|
||||||
|
elif [ "$VIRTUAL_MACHINE" = btcpayserver ] || [ "$SKIP_BTCPAY" = true ]; then
|
||||||
|
|
||||||
|
|
||||||
|
DDNS_HOST="$BTCPAY_HOSTNAME"
|
||||||
|
VPS_HOSTNAME="$BTCPAY_HOSTNAME"
|
||||||
|
MAC_ADDRESS_TO_PROVISION="$BTCPAYSERVER_MAC_ADDRESS"
|
||||||
|
if [ "$BITCOIN_CHAIN" = mainnet ]; then
|
||||||
|
ROOT_DISK_SIZE_GB=150
|
||||||
|
elif [ "$BITCOIN_CHAIN" = testnet ]; then
|
||||||
|
ROOT_DISK_SIZE_GB=70
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ "$VIRTUAL_MACHINE" = "$BASE_IMAGE_VM_NAME" ]; then
|
||||||
|
DDNS_HOST="$BASE_IMAGE_VM_NAME"
|
||||||
|
ROOT_DISK_SIZE_GB=8
|
||||||
|
else
|
||||||
|
echo "ERROR: VIRTUAL_MACHINE not within allowable bounds."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DDNS_HOST="$DDNS_HOST"
|
||||||
|
export FQDN="$DDNS_HOST.$DOMAIN_NAME"
|
||||||
|
export LXD_VM_NAME="${FQDN//./-}"
|
||||||
|
export VIRTUAL_MACHINE="$VIRTUAL_MACHINE"
|
||||||
|
export REMOTE_CERT_DIR="$REMOTE_CERT_BASE_DIR/$FQDN"
|
||||||
|
export MAC_ADDRESS_TO_PROVISION="$MAC_ADDRESS_TO_PROVISION"
|
||||||
|
|
||||||
|
./deploy_vms.sh
|
||||||
|
|
||||||
|
if [ "$VIRTUAL_MACHINE" = www ]; then
|
||||||
|
# this tells our local docker client to target the remote endpoint via SSH
|
||||||
|
export DOCKER_HOST="ssh://ubuntu@$PRIMARY_WWW_FQDN"
|
||||||
|
|
||||||
|
# enable docker swarm mode so we can support docker stacks.
|
||||||
|
if docker info | grep -q "Swarm: inactive"; then
|
||||||
|
docker swarm init --advertise-addr enp6s0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# let's stub out the rest of our site definitions, if any.
|
# let's stub out the rest of our site definitions, if any.
|
||||||
for DOMAIN_NAME in ${OTHER_SITES_LIST//,/ }; do
|
for DOMAIN_NAME in ${OTHER_SITES_LIST//,/ }; do
|
||||||
@ -417,7 +438,7 @@ done
|
|||||||
|
|
||||||
# now let's run the www and btcpay-specific provisioning scripts.
|
# now let's run the www and btcpay-specific provisioning scripts.
|
||||||
if [ "$SKIP_WWW" = false ]; then
|
if [ "$SKIP_WWW" = false ]; then
|
||||||
bash -c "./www/go.sh"
|
./www/go.sh
|
||||||
ssh ubuntu@"$PRIMARY_WWW_FQDN" "echo $LATEST_GIT_COMMIT > /home/ubuntu/.ss-githead"
|
ssh ubuntu@"$PRIMARY_WWW_FQDN" "echo $LATEST_GIT_COMMIT > /home/ubuntu/.ss-githead"
|
||||||
fi
|
fi
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -ex
|
||||||
|
|
||||||
export NEXTCLOUD_FQDN="$NEXTCLOUD_HOSTNAME.$DOMAIN_NAME"
|
export NEXTCLOUD_FQDN="$NEXTCLOUD_HOSTNAME.$DOMAIN_NAME"
|
||||||
export BTCPAY_FQDN="$BTCPAY_HOSTNAME.$DOMAIN_NAME"
|
export BTCPAY_FQDN="$BTCPAY_HOSTNAME.$DOMAIN_NAME"
|
@ -94,6 +94,12 @@ if [ "$LXD_HOSTNAME" = "$BASE_IMAGE_VM_NAME" ]; then
|
|||||||
UsePAM no
|
UsePAM no
|
||||||
LogLevel INFO
|
LogLevel INFO
|
||||||
|
|
||||||
|
- path: /etc/docker/daemon.json
|
||||||
|
content: |
|
||||||
|
{
|
||||||
|
"registry-mirrors": ["${REGISTRY_URL}"]
|
||||||
|
}
|
||||||
|
|
||||||
runcmd:
|
runcmd:
|
||||||
- sudo mkdir -m 0755 -p /etc/apt/keyrings
|
- sudo mkdir -m 0755 -p /etc/apt/keyrings
|
||||||
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||||
@ -104,6 +110,13 @@ if [ "$LXD_HOSTNAME" = "$BASE_IMAGE_VM_NAME" ]; then
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# - path: /etc/docker/daemon.json
|
||||||
|
# content: |
|
||||||
|
# {
|
||||||
|
# "registry-mirrors": "${REGISTRY_URL}",
|
||||||
|
# "labels": "githead=${LATEST_GIT_COMMIT}"
|
||||||
|
# }
|
||||||
|
#"labels": [githead="${LATEST_GIT_COMMIT}"]
|
||||||
|
|
||||||
# apt:
|
# apt:
|
||||||
# sources:
|
# sources:
|
||||||
@ -111,12 +124,7 @@ EOF
|
|||||||
# source: "deb [arch=amd64] https://download.docker.com/linux/ubuntu ${LXD_UBUNTU_BASE_VERSION} stable"
|
# source: "deb [arch=amd64] https://download.docker.com/linux/ubuntu ${LXD_UBUNTU_BASE_VERSION} stable"
|
||||||
# keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
# keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
||||||
|
|
||||||
# - path: /etc/docker/daemon.json
|
|
||||||
# content: |
|
|
||||||
# {
|
|
||||||
# "registry-mirrors": ["${REGISTRY_URL}"],
|
|
||||||
# "labels": [ "githead=${LATEST_GIT_COMMIT}" ]
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
# - sudo apt-get update
|
# - sudo apt-get update
|
@ -11,7 +11,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../defaults.sh
|
source ../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../domain_env.sh
|
source ../domain_env.sh
|
||||||
|
|
@ -3,21 +3,22 @@
|
|||||||
set -eu
|
set -eu
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
# redirect all docker commands to the remote host.
|
||||||
|
DOCKER_HOST="ssh://ubuntu@$PRIMARY_WWW_FQDN"
|
||||||
|
export DOCKER_HOST="$DOCKER_HOST"
|
||||||
|
|
||||||
# prepare clams images and such
|
# prepare clams images and such
|
||||||
./prepare_clams.sh
|
./prepare_clams.sh
|
||||||
|
|
||||||
# Create the nginx config file which covers all domains.
|
# Create the nginx config file which covers all domains.
|
||||||
bash -c ./stub/nginx_config.sh
|
bash -c ./stub/nginx_config.sh
|
||||||
|
|
||||||
# redirect all docker commands to the remote host.
|
|
||||||
export DOCKER_HOST="ssh://ubuntu@$PRIMARY_WWW_FQDN"
|
|
||||||
|
|
||||||
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
||||||
export DOMAIN_NAME="$DOMAIN_NAME"
|
export DOMAIN_NAME="$DOMAIN_NAME"
|
||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../defaults.sh
|
source ../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../domain_env.sh
|
source ../domain_env.sh
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ if [ "$RESTART_FRONT_END" = true ]; then
|
|||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../defaults.sh
|
source ../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../domain_env.sh
|
source ../domain_env.sh
|
||||||
|
|
@ -5,9 +5,10 @@ cd "$(dirname "$0")"
|
|||||||
|
|
||||||
# deploy clams wallet.
|
# deploy clams wallet.
|
||||||
LOCAL_CLAMS_REPO_PATH="$(pwd)/clams"
|
LOCAL_CLAMS_REPO_PATH="$(pwd)/clams"
|
||||||
|
BROWSER_APP_GIT_TAG="1.5.0"
|
||||||
|
BROWSER_APP_GIT_REPO_URL="https://github.com/clams-tech/browser-app"
|
||||||
if [ ! -d "$LOCAL_CLAMS_REPO_PATH" ]; then
|
if [ ! -d "$LOCAL_CLAMS_REPO_PATH" ]; then
|
||||||
git clone "$CLAMS_GIT_REPO" "$LOCAL_CLAMS_REPO_PATH"
|
git clone "$BROWSER_APP_GIT_REPO_URL" "$LOCAL_CLAMS_REPO_PATH"
|
||||||
else
|
else
|
||||||
cd "$LOCAL_CLAMS_REPO_PATH"
|
cd "$LOCAL_CLAMS_REPO_PATH"
|
||||||
git config --global pull.rebase false
|
git config --global pull.rebase false
|
||||||
@ -15,28 +16,14 @@ else
|
|||||||
cd -
|
cd -
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# # overwrite the clams/.env file with Sovereign Stack specific parameters.
|
|
||||||
# CLAMS_CONFIG_PATH="$LOCAL_CLAMS_REPO_PATH/.env"
|
|
||||||
# cat > "$CLAMS_CONFIG_PATH" <<EOF
|
|
||||||
# CLAMS_FQDN=${CLAMS_FQDN}
|
|
||||||
# BTC_CHAIN=${BITCOIN_CHAIN}
|
|
||||||
# DEPLOY_BTC_BACKEND=false
|
|
||||||
# EOF
|
|
||||||
|
|
||||||
# lxc file push -r -p "$LOCAL_CLAMS_REPO_PATH" "${PRIMARY_WWW_FQDN//./-}$REMOTE_HOME"
|
# lxc file push -r -p "$LOCAL_CLAMS_REPO_PATH" "${PRIMARY_WWW_FQDN//./-}$REMOTE_HOME"
|
||||||
|
|
||||||
|
|
||||||
BROWSER_APP_GIT_TAG="1.5.0"
|
|
||||||
BROWSER_APP_GIT_REPO_URL="https://github.com/clams-tech/browser-app"
|
|
||||||
BROWSER_APP_IMAGE_NAME="browser-app:$BROWSER_APP_GIT_TAG"
|
BROWSER_APP_IMAGE_NAME="browser-app:$BROWSER_APP_GIT_TAG"
|
||||||
|
|
||||||
# build the browser-app image.
|
# build the browser-app image.
|
||||||
if ! docker image list --format "{{.Repository}}:{{.Tag}}" | grep -q "$BROWSER_APP_IMAGE_NAME"; then
|
if ! docker image list --format "{{.Repository}}:{{.Tag}}" | grep -q "$BROWSER_APP_IMAGE_NAME"; then
|
||||||
docker build --build-arg GIT_REPO_URL="$BROWSER_APP_GIT_REPO_URL" \
|
docker build --build-arg GIT_REPO_URL="$BROWSER_APP_GIT_REPO_URL" \
|
||||||
--build-arg VERSION="$BROWSER_APP_GIT_TAG" \
|
--build-arg VERSION="$BROWSER_APP_GIT_TAG" \
|
||||||
-t "$BROWSER_APP_IMAGE_NAME" \
|
-t "$BROWSER_APP_IMAGE_NAME" \
|
||||||
./clams/frontend/browser-app/
|
$(pwd)/clams/frontend/browser-app/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the clams-root volume doesn't exist, we create and seed it.
|
# If the clams-root volume doesn't exist, we create and seed it.
|
@ -9,7 +9,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../defaults.sh
|
source ../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../domain_env.sh
|
source ../domain_env.sh
|
||||||
|
|
@ -8,7 +8,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../../defaults.sh
|
source ../../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../../domain_env.sh
|
source ../../domain_env.sh
|
||||||
|
|
@ -8,7 +8,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../../defaults.sh
|
source ../../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../../domain_env.sh
|
source ../../domain_env.sh
|
||||||
|
|
@ -8,7 +8,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../../defaults.sh
|
source ../../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../../domain_env.sh
|
source ../../domain_env.sh
|
||||||
|
|
@ -18,8 +18,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
export CONTAINER_TLS_PATH="/etc/letsencrypt/${DOMAIN_NAME}/live/${DOMAIN_NAME}"
|
export CONTAINER_TLS_PATH="/etc/letsencrypt/${DOMAIN_NAME}/live/${DOMAIN_NAME}"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
echo "BEFORE"
|
source ../../../../defaults.sh
|
||||||
source ../../../defaults.sh
|
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../../domain_env.sh
|
source ../../domain_env.sh
|
||||||
echo "after"
|
echo "after"
|
@ -23,7 +23,7 @@ EOL
|
|||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../../defaults.sh
|
source ../../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../../domain_env.sh
|
source ../../domain_env.sh
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ EOL
|
|||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../../defaults.sh
|
source ../../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../../domain_env.sh
|
source ../../domain_env.sh
|
||||||
|
|
@ -10,7 +10,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
|
|||||||
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
|
||||||
|
|
||||||
# source the site path so we know what features it has.
|
# source the site path so we know what features it has.
|
||||||
source ../../../defaults.sh
|
source ../../../../defaults.sh
|
||||||
source "$SITE_PATH/site_definition"
|
source "$SITE_PATH/site_definition"
|
||||||
source ../../domain_env.sh
|
source ../../domain_env.sh
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
alias ss-deploy='/home/ubuntu/sovereign-stack/deployment/deploy.sh $@'
|
alias ss-deploy='/home/ubuntu/sovereign-stack/deployment/project/deploy.sh $@'
|
||||||
alias ss-cluster='/home/ubuntu/sovereign-stack/deployment/cluster.sh $@'
|
alias ss-cluster='/home/ubuntu/sovereign-stack/deployment/cluster.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 $@'
|
||||||
|
@ -13,10 +13,9 @@ git tag -a "$TAG_NAME" -m "$TAG_MESSAGE" -s
|
|||||||
git push --set-upstream origin --all
|
git push --set-upstream origin --all
|
||||||
git push --set-upstream origin --tags
|
git push --set-upstream origin --tags
|
||||||
|
|
||||||
|
|
||||||
## note this will only work if you have permissions to update HEAD on https://git.sovereign-stack.org/ss/sovereign-stack.git
|
## note this will only work if you have permissions to update HEAD on https://git.sovereign-stack.org/ss/sovereign-stack.git
|
||||||
RESPONSE=
|
RESPONSE=
|
||||||
read -r -p " Would you like to push this to the main ss repo? (y) ": RESPONSE
|
read -r -p " Would you like to push this to the main Sovereign Stack repo? (y) ": RESPONSE
|
||||||
if [ "$RESPONSE" != "y" ]; then
|
if [ "$RESPONSE" != "y" ]; then
|
||||||
# optional; push to remote
|
# optional; push to remote
|
||||||
git push --set-upstream ss-upstream --all
|
git push --set-upstream ss-upstream --all
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
FROM btcpayserver/lightning:v22.11.1
|
|
||||||
|
|
||||||
EXPOSE 9736
|
|
@ -1 +1 @@
|
|||||||
v0.0.23
|
v0.0.24
|
Loading…
Reference in New Issue
Block a user