Compare commits

..

No commits in common. "fbc6e2b6e50fa2f1a6cbc75d44f1a1e92917a792" and "a6dcf6c2329cc3ff60411ddeffe98c47cec049f7" have entirely different histories.

6 changed files with 47 additions and 61 deletions

View File

@ -1,9 +1,9 @@
#!/bin/bash
set -exu
set -eu
cd "$(dirname "$0")"
bash -c "./stub_lxc_profile.sh --lxd-hostname=$BASE_IMAGE_VM_NAME"
./stub_lxc_profile.sh "$BASE_IMAGE_VM_NAME"
# let's download our base image.
if ! lxc image list --format csv --columns l | grep -q "$UBUNTU_BASE_IMAGE_NAME"; then

View File

@ -371,19 +371,22 @@ for VIRTUAL_MACHINE in www btcpayserver; do
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
FQDN="$WWW_HOSTNAME.$DOMAIN_NAME"
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
FQDN="$BTCPAY_HOSTNAME.$DOMAIN_NAME"
DDNS_HOST="$BTCPAY_HOSTNAME"
VPS_HOSTNAME="$BTCPAY_HOSTNAME"
MAC_ADDRESS_TO_PROVISION="$BTCPAYSERVER_MAC_ADDRESS"
if [ "$BITCOIN_CHAIN" = mainnet ]; then
@ -393,19 +396,21 @@ for VIRTUAL_MACHINE in www btcpayserver; do
fi
elif [ "$VIRTUAL_MACHINE" = "$BASE_IMAGE_VM_NAME" ]; then
export FQDN="$BASE_IMAGE_VM_NAME"
DDNS_HOST="$BASE_IMAGE_VM_NAME"
ROOT_DISK_SIZE_GB=8
else
echo "ERROR: VIRTUAL_MACHINE not within allowable bounds."
exit
fi
export FQDN="$FQDN"
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_vm.sh
./deploy_vms.sh
if [ "$VIRTUAL_MACHINE" = www ]; then
# this tells our local docker client to target the remote endpoint via SSH
@ -416,8 +421,7 @@ for VIRTUAL_MACHINE in www btcpayserver; do
docker swarm init --advertise-addr enp6s0
fi
fi
done
done
# let's stub out the rest of our site definitions, if any.
for DOMAIN_NAME in ${OTHER_SITES_LIST//,/ }; do

View File

@ -30,7 +30,7 @@ if ! lxc list --format csv | grep -q "$LXD_VM_NAME"; then
exit 1
fi
bash -c "./stub_lxc_profile.sh --vm=$VIRTUAL_MACHINE --lxd-hostname=$LXD_VM_NAME"
./stub_lxc_profile.sh "$LXD_VM_NAME"
# now let's create a new VM to work with.
#lxc init --profile="$LXD_VM_NAME" "$BASE_IMAGE_VM_NAME" "$LXD_VM_NAME" --vm
@ -43,7 +43,7 @@ if ! lxc list --format csv | grep -q "$LXD_VM_NAME"; then
lxc start "$LXD_VM_NAME"
bash -c "./wait_for_lxc_ip.sh --lxd-name=$LXD_VM_NAME"
bash -c "./wait_for_lxc_ip.sh --lxc-name=$LXD_VM_NAME"
fi
# scan the remote machine and install it's identity in our SSH known_hosts file.

View File

@ -1,28 +1,9 @@
#!/bin/bash
set -exu
set -eu
cd "$(dirname "$0")"
VIRTUAL_MACHINE=
LXD_HOSTNAME=
# grab any modifications from the command line.
for i in "$@"; do
case $i in
--lxd-hostname=*)
LXD_HOSTNAME="${i#*=}"
shift
;;
--vm=*)
VIRTUAL_MACHINE="${i#*=}"
shift
;;
*)
echo "Unexpected option: $1"
exit 1
;;
esac
done
LXD_HOSTNAME="${1:-}"
# generate the custom cloud-init file. Cloud init installs and configures sshd
SSH_AUTHORIZED_KEY=$(<"$SSH_PUBKEY_PATH")
@ -56,8 +37,7 @@ EOF
fi
# if VIRTUAL_MACHINE is undefined, then we doing the base image.
if [ -z "$VIRTUAL_MACHINE" ]; then
if [ "$LXD_HOSTNAME" = "$BASE_IMAGE_VM_NAME" ]; then
# this is for the base image only...
cat >> "$YAML_PATH" <<EOF
user.vendor-data: |
@ -152,7 +132,7 @@ EOF
#- sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
else
# all other machines that are not the base image
# all other machines.
cat >> "$YAML_PATH" <<EOF
user.vendor-data: |
#cloud-config
@ -183,7 +163,7 @@ EOF
fi
# All profiles get a root disk and cloud-init config.
# If we are deploying the www, we attach the vm to the underlay via macvlan.
cat >> "$YAML_PATH" <<EOF
description: Default LXD profile for ${FILENAME}
devices:
@ -197,8 +177,10 @@ devices:
EOF
# Stub out the network piece for the base image.
if [ -z "$VIRTUAL_MACHINE" ]; then
cat >> "$YAML_PATH" <<EOF
if [ "$LXD_HOSTNAME" = "$BASE_IMAGE_VM_NAME" ] ; then
#
cat >> "$YAML_PATH" <<EOF
enp6s0:
name: enp6s0
network: lxdbr0
@ -208,7 +190,7 @@ EOF
else
# If we are deploying a VM that attaches to the network underlay.
cat >> "$YAML_PATH" <<EOF
cat >> "$YAML_PATH" <<EOF
enp5s0:
nictype: macvlan
parent: ${DATA_PLANE_MACVLAN_INTERFACE}

View File

@ -7,7 +7,7 @@ LXC_INSTANCE_NAME=
# grab any modifications from the command line.
for i in "$@"; do
case $i in
--lxd-name=*)
--lxc-name=*)
LXC_INSTANCE_NAME="${i#*=}"
shift
;;

View File

@ -21,7 +21,7 @@ for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do
source ../../../../defaults.sh
source "$SITE_PATH/site_definition"
source ../../domain_env.sh
echo "after"
if [ $iteration = 0 ]; then
cat >>"$NGINX_CONF_PATH" <<EOL
events {
@ -250,7 +250,7 @@ EOL
# Route everything to the real BTCPay server
location / {
# URL of BTCPay Server
proxy_pass http://$LXD_VM_NAME.lxd:80;
proxy_pass http://10.139.144.10:80;
proxy_set_header Host \$http_host;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Real-IP \$remote_addr;