BTCPayserver networking updates.
This commit is contained in:
parent
96f5931ffa
commit
7a1aa38b02
@ -7,11 +7,11 @@ cd "$(dirname "$0")"
|
|||||||
# the script executed here from the BTCPAY repo will automatically take services down
|
# the script executed here from the BTCPAY repo will automatically take services down
|
||||||
# and bring them back up.
|
# and bring them back up.
|
||||||
|
|
||||||
echo "INFO: Starting BTCPAY Backup script for host '$BTCPAY_FQDN'."
|
echo "INFO: Starting BTCPAY Backup script for host '$BTCPAY_SERVER_FQDN'."
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
ssh "$BTCPAY_FQDN" "mkdir -p $REMOTE_BACKUP_PATH; cd $REMOTE_DATA_PATH/; sudo BTCPAY_BASE_DIRECTORY=$REMOTE_DATA_PATH bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
|
ssh "$BTCPAY_SERVER_FQDN" "mkdir -p $REMOTE_BACKUP_PATH; cd $REMOTE_DATA_PATH/; sudo BTCPAY_BASE_DIRECTORY=$REMOTE_DATA_PATH bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
|
||||||
|
|
||||||
# TODO; not sure if this is necessary, but we want to give the VM additional time to take down all services
|
# TODO; not sure if this is necessary, but we want to give the VM additional time to take down all services
|
||||||
# that way processes can run shutdown procedures and leave files in the correct state.
|
# that way processes can run shutdown procedures and leave files in the correct state.
|
||||||
@ -19,13 +19,13 @@ sleep 10
|
|||||||
|
|
||||||
# TODO enable encrypted archives
|
# TODO enable encrypted archives
|
||||||
# TODO switch to btcpay-backup.sh when on LXD fully.
|
# TODO switch to btcpay-backup.sh when on LXD fully.
|
||||||
scp ./remote_scripts/btcpay-backup.sh "$BTCPAY_FQDN:$REMOTE_DATA_PATH/btcpay-backup.sh"
|
scp ./remote_scripts/btcpay-backup.sh "$BTCPAY_SERVER_FQDN:$REMOTE_DATA_PATH/btcpay-backup.sh"
|
||||||
ssh "$BTCPAY_FQDN" "sudo cp $REMOTE_DATA_PATH/btcpay-backup.sh $BTCPAY_SERVER_APPPATH/btcpay-backup.sh && sudo chmod 0755 $BTCPAY_SERVER_APPPATH/btcpay-backup.sh"
|
ssh "$BTCPAY_SERVER_FQDN" "sudo cp $REMOTE_DATA_PATH/btcpay-backup.sh $BTCPAY_SERVER_APPPATH/btcpay-backup.sh && sudo chmod 0755 $BTCPAY_SERVER_APPPATH/btcpay-backup.sh"
|
||||||
ssh "$BTCPAY_FQDN" "cd $REMOTE_DATA_PATH/; sudo BTCPAY_BASE_DIRECTORY=$REMOTE_DATA_PATH BTCPAY_DOCKER_COMPOSE=$REMOTE_DATA_PATH/btcpayserver-docker/Generated/docker-compose.generated.yml bash -c $BTCPAY_SERVER_APPPATH/btcpay-backup.sh"
|
ssh "$BTCPAY_SERVER_FQDN" "cd $REMOTE_DATA_PATH/; sudo BTCPAY_BASE_DIRECTORY=$REMOTE_DATA_PATH BTCPAY_DOCKER_COMPOSE=$REMOTE_DATA_PATH/btcpayserver-docker/Generated/docker-compose.generated.yml bash -c $BTCPAY_SERVER_APPPATH/btcpay-backup.sh"
|
||||||
|
|
||||||
# next we pull the resulting backup archive down to our management machine.
|
# next we pull the resulting backup archive down to our management machine.
|
||||||
ssh "$BTCPAY_FQDN" "sudo cp /var/lib/docker/volumes/backup_datadir/_data/backup.tar.gz $REMOTE_BACKUP_PATH/btcpay.tar.gz"
|
ssh "$BTCPAY_SERVER_FQDN" "sudo cp /var/lib/docker/volumes/backup_datadir/_data/backup.tar.gz $REMOTE_BACKUP_PATH/btcpay.tar.gz"
|
||||||
ssh "$BTCPAY_FQDN" "sudo chown ubuntu:ubuntu $REMOTE_BACKUP_PATH/btcpay.tar.gz"
|
ssh "$BTCPAY_SERVER_FQDN" "sudo chown ubuntu:ubuntu $REMOTE_BACKUP_PATH/btcpay.tar.gz"
|
||||||
|
|
||||||
# if the backup archive path is not set, then we set it. It is usually set only when we are running a migration script.
|
# if the backup archive path is not set, then we set it. It is usually set only when we are running a migration script.
|
||||||
BTCPAY_LOCAL_BACKUP_PATH="$SITES_PATH/$PRIMARY_DOMAIN/backups/btcpayserver"
|
BTCPAY_LOCAL_BACKUP_PATH="$SITES_PATH/$PRIMARY_DOMAIN/backups/btcpayserver"
|
||||||
@ -34,6 +34,6 @@ if [ -z "$BACKUP_BTCPAY_ARCHIVE_PATH" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$BTCPAY_LOCAL_BACKUP_PATH"
|
mkdir -p "$BTCPAY_LOCAL_BACKUP_PATH"
|
||||||
scp "$BTCPAY_FQDN:$REMOTE_BACKUP_PATH/btcpay.tar.gz" "$BACKUP_BTCPAY_ARCHIVE_PATH"
|
scp "$BTCPAY_SERVER_FQDN:$REMOTE_BACKUP_PATH/btcpay.tar.gz" "$BACKUP_BTCPAY_ARCHIVE_PATH"
|
||||||
|
|
||||||
echo "INFO: Created backup archive '$BACKUP_BTCPAY_ARCHIVE_PATH' for host '$BTCPAY_FQDN'."
|
echo "INFO: Created backup archive '$BACKUP_BTCPAY_ARCHIVE_PATH' for host '$BTCPAY_SERVER_FQDN'."
|
||||||
|
@ -5,34 +5,27 @@ cd "$(dirname "$0")"
|
|||||||
|
|
||||||
if [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
|
if [ "$VIRTUAL_MACHINE" = btcpayserver ]; then
|
||||||
# send an updated ~/.bashrc so we have quicker access to cli tools
|
# send an updated ~/.bashrc so we have quicker access to cli tools
|
||||||
scp ./bashrc.txt "ubuntu@$BTCPAY_FQDN:$REMOTE_HOME/.bashrc"
|
scp ./bashrc.txt "ubuntu@$BTCPAY_SERVER_FQDN:$REMOTE_HOME/.bashrc"
|
||||||
ssh "$BTCPAY_FQDN" "chown ubuntu:ubuntu $REMOTE_HOME/.bashrc"
|
ssh "$BTCPAY_SERVER_FQDN" "chown ubuntu:ubuntu $REMOTE_HOME/.bashrc"
|
||||||
ssh "$BTCPAY_FQDN" "chmod 0664 $REMOTE_HOME/.bashrc"
|
ssh "$BTCPAY_SERVER_FQDN" "chmod 0664 $REMOTE_HOME/.bashrc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export DOCKER_HOST="ssh://ubuntu@$BTCPAY_FQDN"
|
|
||||||
|
|
||||||
if [ "$STOP_SERVICES" = true ]; then
|
|
||||||
# run the update.
|
|
||||||
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
|
|
||||||
else
|
|
||||||
./stub_btcpay_setup.sh
|
./stub_btcpay_setup.sh
|
||||||
fi
|
|
||||||
|
|
||||||
# we will re-run the btcpayserver provisioning scripts if directed to do so.
|
# we will re-run the btcpayserver provisioning scripts if directed to do so.
|
||||||
# if an update does occur, we grab another backup.
|
# if an update does occur, we grab another backup.
|
||||||
if [ "$UPDATE_BTCPAY" = true ]; then
|
if [ "$UPDATE_BTCPAY" = true ]; then
|
||||||
# run the update.
|
# run the update.
|
||||||
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
|
ssh "$BTCPAY_SERVER_FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
|
||||||
|
|
||||||
# btcpay-update.sh brings services back up, but does not take them down.
|
# btcpay-update.sh brings services back up, but does not take them down.
|
||||||
ssh "$FQDN" "sudo bash -c $BTCPAY_SERVER_APPPATH/btcpay-update.sh"
|
ssh "$BTCPAY_SERVER_FQDN" "sudo bash -c $BTCPAY_SERVER_APPPATH/btcpay-update.sh"
|
||||||
|
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
elif [ "$RESTORE_BTCPAY" = true ]; then
|
elif [ "$RESTORE_BTCPAY" = true ]; then
|
||||||
# run the update.
|
# run the update.
|
||||||
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
|
ssh "$BTCPAY_SERVER_FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
|
||||||
sleep 15
|
sleep 15
|
||||||
|
|
||||||
./restore.sh
|
./restore.sh
|
||||||
@ -46,8 +39,7 @@ if [ "$BACKUP_BTCPAY" = true ]; then
|
|||||||
./backup_btcpay.sh
|
./backup_btcpay.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$STOP_SERVICES" = false ]; then
|
|
||||||
# The default is to resume services, though admin may want to keep services off (eg., for a migration)
|
# The default is to resume services, though admin may want to keep services off (eg., for a migration)
|
||||||
# we bring the services back up by default.
|
# we bring the services back up by default.
|
||||||
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-up.sh"
|
ssh "$BTCPAY_SERVER_FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-up.sh"
|
||||||
fi
|
|
||||||
|
@ -39,7 +39,7 @@ done
|
|||||||
if [ ! -d "btcpayserver-docker" ]; then
|
if [ ! -d "btcpayserver-docker" ]; then
|
||||||
echo "cloning btcpayserver-docker";
|
echo "cloning btcpayserver-docker";
|
||||||
git clone -b master ${BTCPAYSERVER_GITREPO} btcpayserver-docker;
|
git clone -b master ${BTCPAYSERVER_GITREPO} btcpayserver-docker;
|
||||||
git config --global --add safe.directory /home/ubuntu/btcpayserver-docker
|
git config --global --add safe.directory /home/ubuntu/ss-data/btcpayserver-docker
|
||||||
else
|
else
|
||||||
cd ./btcpayserver-docker
|
cd ./btcpayserver-docker
|
||||||
git pull
|
git pull
|
||||||
@ -77,8 +77,13 @@ services:
|
|||||||
clightning_bitcoin:
|
clightning_bitcoin:
|
||||||
environment:
|
environment:
|
||||||
LIGHTNINGD_OPT: |
|
LIGHTNINGD_OPT: |
|
||||||
announce-addr-dns=true
|
#announce-addr=${BTCPAY_USER_FQDN}
|
||||||
|
#announce-addr-dns=true
|
||||||
experimental-websocket-port=9736
|
experimental-websocket-port=9736
|
||||||
|
experimental-peer-storage
|
||||||
|
experimental-offers
|
||||||
|
#experimental-dual-fund
|
||||||
|
#experimental-onion-messages
|
||||||
ports:
|
ports:
|
||||||
- "${CLIGHTNING_WEBSOCKET_PORT}:9736"
|
- "${CLIGHTNING_WEBSOCKET_PORT}:9736"
|
||||||
expose:
|
expose:
|
||||||
@ -86,6 +91,7 @@ services:
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# run the setup script.
|
# run the setup script.
|
||||||
. ./btcpay-setup.sh -i
|
. ./btcpay-setup.sh -i
|
||||||
|
|
||||||
@ -95,11 +101,11 @@ EOL
|
|||||||
|
|
||||||
|
|
||||||
# send the setup script to the remote machine.
|
# send the setup script to the remote machine.
|
||||||
scp "$SITE_PATH/btcpay.sh" "ubuntu@$FQDN:$REMOTE_DATA_PATH/btcpay_setup.sh"
|
scp "$SITE_PATH/btcpay.sh" "ubuntu@$BTCPAY_SERVER_FQDN:$REMOTE_DATA_PATH/btcpay_setup.sh"
|
||||||
ssh "$BTCPAY_FQDN" "chmod 0744 $REMOTE_DATA_PATH/btcpay_setup.sh"
|
ssh "$BTCPAY_SERVER_FQDN" "chmod 0744 $REMOTE_DATA_PATH/btcpay_setup.sh"
|
||||||
|
|
||||||
# script is executed under sudo
|
# script is executed under sudo
|
||||||
ssh "$BTCPAY_FQDN" "sudo bash -c $REMOTE_DATA_PATH/btcpay_setup.sh"
|
ssh "$BTCPAY_SERVER_FQDN" "sudo bash -c $REMOTE_DATA_PATH/btcpay_setup.sh"
|
||||||
|
|
||||||
# lets give time for the containers to spin up
|
# lets give time for the containers to spin up
|
||||||
sleep 10
|
sleep 10
|
@ -3,7 +3,6 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
export NEXTCLOUD_FQDN="$NEXTCLOUD_HOSTNAME.$DOMAIN_NAME"
|
export NEXTCLOUD_FQDN="$NEXTCLOUD_HOSTNAME.$DOMAIN_NAME"
|
||||||
export BTCPAY_FQDN="$BTCPAY_HOSTNAME.$DOMAIN_NAME"
|
|
||||||
export BTCPAY_USER_FQDN="$BTCPAY_HOSTNAME_IN_CERT.$DOMAIN_NAME"
|
export BTCPAY_USER_FQDN="$BTCPAY_HOSTNAME_IN_CERT.$DOMAIN_NAME"
|
||||||
export WWW_FQDN="$WWW_HOSTNAME.$DOMAIN_NAME"
|
export WWW_FQDN="$WWW_HOSTNAME.$DOMAIN_NAME"
|
||||||
export GITEA_FQDN="$GITEA_HOSTNAME.$DOMAIN_NAME"
|
export GITEA_FQDN="$GITEA_HOSTNAME.$DOMAIN_NAME"
|
||||||
|
@ -54,7 +54,7 @@ export GITEA_DB_IMAGE="$DEFAULT_DB_IMAGE"
|
|||||||
export NOSTR_RELAY_IMAGE="scsibug/nostr-rs-relay"
|
export NOSTR_RELAY_IMAGE="scsibug/nostr-rs-relay"
|
||||||
|
|
||||||
export WWW_SERVER_MAC_ADDRESS=
|
export WWW_SERVER_MAC_ADDRESS=
|
||||||
export BTCPAYSERVER_MAC_ADDRESS=
|
export BTCPAY_SERVER_MAC_ADDRESS=
|
||||||
|
|
||||||
export OTHER_SITES_LIST=
|
export OTHER_SITES_LIST=
|
||||||
export BTCPAY_ALT_NAMES=
|
export BTCPAY_ALT_NAMES=
|
||||||
|
@ -251,8 +251,8 @@ EOL
|
|||||||
|
|
||||||
# Route everything to the real BTCPay server
|
# Route everything to the real BTCPay server
|
||||||
location / {
|
location / {
|
||||||
# URL of BTCPay Server on the ss-ovn logical network
|
#proxy_pass http://${BTCPAY_SERVER_FQDN//./-}.lxd:80;
|
||||||
proxy_pass http://${BTCPAY_HOSTNAME}-${PRIMARY_DOMAIN//./-}.lxd:80;
|
proxy_pass http://10.10.10.66:80;
|
||||||
proxy_set_header Host \$http_host;
|
proxy_set_header Host \$http_host;
|
||||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
|
Loading…
Reference in New Issue
Block a user