1
1

WWW updates.

This commit is contained in:
Derek Smith 2023-08-12 12:22:34 -04:00
parent 0ca1fdbea9
commit 5369016265
Signed by: farscapian
GPG Key ID: B443E530A14E1C90
3 changed files with 43 additions and 55 deletions

View File

@ -11,6 +11,7 @@ if lxc remote get-default -q | grep -q "local"; then
fi fi
KEEP_DOCKER_VOLUME=true KEEP_DOCKER_VOLUME=true
OTHER_SITES_LIST=
SKIP_BTCPAYSERVER=false SKIP_BTCPAYSERVER=false
SKIP_WWW=false SKIP_WWW=false
SKIP_CLAMSSERVER=false SKIP_CLAMSSERVER=false
@ -18,7 +19,7 @@ SKIP_CLAMSSERVER=false
# grab any modifications from the command line. # grab any modifications from the command line.
for i in "$@"; do for i in "$@"; do
case $i in case $i in
--destroy) --purge)
KEEP_DOCKER_VOLUME=false KEEP_DOCKER_VOLUME=false
shift shift
;; ;;
@ -109,6 +110,7 @@ for VIRTUAL_MACHINE in $SERVERS; do
fi fi
fi fi
done done
else
# we maintain the volumes # we maintain the volumes
# TODO make a snapshot on all the zfs storage volumes. # TODO make a snapshot on all the zfs storage volumes.
echo "TODO: create snapshot of ZFS volumes and pull them to mgmt machine." echo "TODO: create snapshot of ZFS volumes and pull them to mgmt machine."
@ -117,6 +119,4 @@ done
if lxc network list -q | grep -q ss-ovn; then if lxc network list -q | grep -q ss-ovn; then
lxc network delete ss-ovn lxc network delete ss-ovn
fi fi
# TODO make a snapshot on all the zfs storage volumes.

View File

@ -227,9 +227,18 @@ if [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
- 10.10.10.66/24 - 10.10.10.66/24
EOF EOF
fi fi
if [ "$VIRTUAL_MACHINE" = www ]; then
cat >> "$YAML_PATH" <<EOF
enp6s0:
addresses:
- 10.10.10.65/24
EOF
fi
# All profiles get a root disk and cloud-init config. # All profiles get a root disk and cloud-init config.
cat >> "$YAML_PATH" <<EOF cat >> "$YAML_PATH" <<EOF
description: Default LXD profile for ${FILENAME} description: Default LXD profile for ${FILENAME}
@ -275,11 +284,18 @@ else
nictype: macvlan nictype: macvlan
parent: ${DATA_PLANE_MACVLAN_INTERFACE} parent: ${DATA_PLANE_MACVLAN_INTERFACE}
type: nic type: nic
EOF
if [ "$VIRTUAL_MACHINE" = www ] || [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
cat >> "$YAML_PATH" <<EOF
enp6s0: enp6s0:
name: enp6s0 name: enp6s0
network: ss-ovn network: ss-ovn
type: nic type: nic
EOF
fi
cat >> "$YAML_PATH" <<EOF
name: ${PRIMARY_DOMAIN} name: ${PRIMARY_DOMAIN}
EOF EOF

View File

@ -38,19 +38,20 @@ OTHER_SITES_LIST=
PRIMARY_DOMAIN= PRIMARY_DOMAIN=
RUN_CERT_RENEWAL=true RUN_CERT_RENEWAL=true
SKIP_BASE_IMAGE_CREATION=false SKIP_BASE_IMAGE_CREATION=false
SKIP_WWW=false
RESTORE_WWW=false
RESTORE_CERTS=false RESTORE_CERTS=false
BACKUP_CERTS=true
BACKUP_BTCPAY=true BACKUP_BTCPAY=true
SKIP_BTCPAYSERVER=false SKIP_BTCPAYSERVER=false
SKIP_WWW=false
SKIP_CLAMSSERVER=false SKIP_CLAMSSERVER=false
BACKUP_WWW_APPS=true
BACKUP_BTCPAY_ARCHIVE_PATH= BACKUP_BTCPAY_ARCHIVE_PATH=
RESTORE_BTCPAY=false RESTORE_BTCPAY=false
SKIP_BTCPAY=false
UPDATE_BTCPAY=false UPDATE_BTCPAY=false
REMOTE_NAME="$(lxc remote get-default)" REMOTE_NAME="$(lxc remote get-default)"
STOP_SERVICES=false
USER_SAYS_YES=false USER_SAYS_YES=false
WWW_SERVER_MAC_ADDRESS=
BTCPAY_SERVER_MAC_ADDRESS= BTCPAY_SERVER_MAC_ADDRESS=
CLAMS_SERVER_MAC_ADDRESS= CLAMS_SERVER_MAC_ADDRESS=
@ -61,12 +62,6 @@ for i in "$@"; do
RESTORE_CERTS=true RESTORE_CERTS=true
shift shift
;; ;;
--restore-www)
RESTORE_WWW=true
RESTORE_CERTS=true
shift
;;
--restore-btcpay) --restore-btcpay)
RESTORE_BTCPAY=true RESTORE_BTCPAY=true
shift shift
@ -75,17 +70,18 @@ for i in "$@"; do
SKIP_BTCPAYSERVER=true SKIP_BTCPAYSERVER=true
shift shift
;; ;;
--skip-wwwserver)
SKIP_WWW=true
shift
;;
--skip-clamsserver)
SKIP_CLAMSSERVER=true
shift shift
;; ;;
--backup-btcpayserver) --backup-btcpayserver)
BACKUP_BTCPAY=true BACKUP_BTCPAY=true
shift shift
;; ;;
--stop)
STOP_SERVICES=true
RESTART_FRONT_END=false
shift
;;
--backup-archive-path=*) --backup-archive-path=*)
BACKUP_BTCPAY_ARCHIVE_PATH="${i#*=}" BACKUP_BTCPAY_ARCHIVE_PATH="${i#*=}"
shift shift
@ -94,14 +90,6 @@ for i in "$@"; do
UPDATE_BTCPAY=true UPDATE_BTCPAY=true
shift shift
;; ;;
--skip-www)
SKIP_WWW=true
shift
;;
--skip-btcpayserver)
SKIP_BTCPAY=true
shift
;;
--skip-base-image) --skip-base-image)
SKIP_BASE_IMAGE_CREATION=true SKIP_BASE_IMAGE_CREATION=true
shift shift
@ -134,10 +122,7 @@ fi
. ./remote_env.sh . ./remote_env.sh
export REGISTRY_DOCKER_IMAGE="registry:2" export REGISTRY_DOCKER_IMAGE="registry:2"
export RESTORE_WWW="$RESTORE_WWW"
export STOP_SERVICES="$STOP_SERVICES"
export BACKUP_CERTS="$BACKUP_CERTS" export BACKUP_CERTS="$BACKUP_CERTS"
export BACKUP_APPS="$BACKUP_APPS"
export RESTORE_BTCPAY="$RESTORE_BTCPAY" export RESTORE_BTCPAY="$RESTORE_BTCPAY"
export BACKUP_BTCPAY="$BACKUP_BTCPAY" export BACKUP_BTCPAY="$BACKUP_BTCPAY"
export RUN_CERT_RENEWAL="$RUN_CERT_RENEWAL" export RUN_CERT_RENEWAL="$RUN_CERT_RENEWAL"
@ -145,8 +130,8 @@ export REMOTE_NAME="$REMOTE_NAME"
export REMOTE_PATH="$REMOTES_PATH/$REMOTE_NAME" export REMOTE_PATH="$REMOTES_PATH/$REMOTE_NAME"
export USER_SAYS_YES="$USER_SAYS_YES" export USER_SAYS_YES="$USER_SAYS_YES"
export BACKUP_BTCPAY_ARCHIVE_PATH="$BACKUP_BTCPAY_ARCHIVE_PATH" export BACKUP_BTCPAY_ARCHIVE_PATH="$BACKUP_BTCPAY_ARCHIVE_PATH"
export RESTART_FRONT_END="$RESTART_FRONT_END"
export RESTORE_CERTS="$RESTORE_CERTS" export RESTORE_CERTS="$RESTORE_CERTS"
export BACKUP_WWW_APPS="$BACKUP_WWW_APPS"
# todo convert this to Trezor-T # todo convert this to Trezor-T
SSH_PUBKEY_PATH="$SSH_HOME/id_rsa.pub" SSH_PUBKEY_PATH="$SSH_HOME/id_rsa.pub"
@ -171,7 +156,6 @@ function new_pass {
gpg --gen-random --armor 1 25 gpg --gen-random --armor 1 25
} }
function stub_site_definition { function stub_site_definition {
mkdir -p "$SITE_PATH" "$PROJECT_PATH/sites" mkdir -p "$SITE_PATH" "$PROJECT_PATH/sites"
@ -207,6 +191,12 @@ NEXTCLOUD_MYSQL_ROOT_PASSWORD="$(new_pass)"
GITEA_MYSQL_PASSWORD="$(new_pass)" GITEA_MYSQL_PASSWORD="$(new_pass)"
GITEA_MYSQL_ROOT_PASSWORD="$(new_pass)" GITEA_MYSQL_ROOT_PASSWORD="$(new_pass)"
#GHOST_DEPLOY_SMTP=true
#MAILGUN_FROM_ADDRESS=false
#MAILGUN_SMTP_USERNAME=
#MAILGUN_SMTP_PASSWORD=
EOL EOL
chmod 0744 "$SITE_DEFINITION_PATH" chmod 0744 "$SITE_DEFINITION_PATH"
@ -276,8 +266,7 @@ if [ -z "$PRIMARY_DOMAIN" ]; then
fi fi
if [ -z "$WWW_SERVER_MAC_ADDRESS" ]; then if [ -z "$WWW_SERVER_MAC_ADDRESS" ]; then
echo "ERROR: the WWW_SERVER_MAC_ADDRESS is not specified. Check your project.conf." echo "WARNING: the WWW_SERVER_MAC_ADDRESS is not specified. Check your project.conf."
exit 1
fi fi
@ -290,14 +279,12 @@ if [ -z "$CLAMS_SERVER_MAC_ADDRESS" ]; then
echo "WARNING: the CLAMS_SERVER_MAC_ADDRESS is not specified. Check your project.conf." echo "WARNING: the CLAMS_SERVER_MAC_ADDRESS is not specified. Check your project.conf."
fi fi
export DOMAIN_LIST="$DOMAIN_LIST" source ./domain_list.sh
export DOMAIN_COUNT=$(("$(echo "$DOMAIN_LIST" | tr -cd , | wc -c)"+1))
# let's provision our primary domain first. # let's provision our primary domain first.
export DOMAIN_NAME="$PRIMARY_DOMAIN" export DOMAIN_NAME="$PRIMARY_DOMAIN"
export PRIMARY_DOMAIN="$PRIMARY_DOMAIN" export PRIMARY_DOMAIN="$PRIMARY_DOMAIN"
export SITE_PATH="$SITES_PATH/$DOMAIN_NAME" export SITE_PATH="$SITES_PATH/$DOMAIN_NAME"
export PRIMARY_WWW_FQDN="$WWW_HOSTNAME.$DOMAIN_NAME"
stub_site_definition stub_site_definition
@ -327,7 +314,7 @@ for VIRTUAL_MACHINE in www btcpayserver clamsserver; do
continue continue
fi fi
if [ "$VIRTUAL_MACHINE" = www ] && [ "$SKIP_WWW" = true ]; then if [ "$VIRTUAL_MACHINE" = www ] && [ -z "$WWW_SERVER_MAC_ADDRESS" ]; then
continue continue
fi fi
@ -376,12 +363,7 @@ for VIRTUAL_MACHINE in www btcpayserver clamsserver; do
export VPS_HOSTNAME="$VPS_HOSTNAME" export VPS_HOSTNAME="$VPS_HOSTNAME"
export FQDN="$VPS_HOSTNAME.$DOMAIN_NAME" export FQDN="$VPS_HOSTNAME.$DOMAIN_NAME"
if [ "$VIRTUAL_MACHINE" = www ]; then if [ "$VIRTUAL_MACHINE" = www ] && [ -n "$WWW_SERVER_MAC_ADDRESS" ]; then
if [ "$SKIP_WWW" = true ]; then
echo "INFO: Skipping WWW due to command line argument."
continue
fi
FQDN="$WWW_HOSTNAME.$DOMAIN_NAME" FQDN="$WWW_HOSTNAME.$DOMAIN_NAME"
VPS_HOSTNAME="$WWW_HOSTNAME" VPS_HOSTNAME="$WWW_HOSTNAME"
MAC_ADDRESS_TO_PROVISION="$WWW_SERVER_MAC_ADDRESS" MAC_ADDRESS_TO_PROVISION="$WWW_SERVER_MAC_ADDRESS"
@ -410,16 +392,6 @@ for VIRTUAL_MACHINE in www btcpayserver clamsserver; do
./deploy_vm.sh ./deploy_vm.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 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.