1
1
sovereign-stack/deployment/btcpayserver/go.sh

46 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
2022-06-22 17:29:52 +00:00
set -eux
cd "$(dirname "$0")"
2022-07-27 16:38:33 +00:00
# we will re-run the btcpayserver provisioning scripts if directed to do so.
# if an update does occur, we grab another backup.
if [ "$UPDATE_BTCPAY" = true ]; then
# run the update.
2022-07-27 16:38:33 +00:00
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-down.sh"
2022-07-27 16:38:33 +00:00
# btcpay-update.sh brings services back up, but does not take them down.
ssh "$FQDN" "sudo bash -c $BTCPAY_SERVER_APPPATH/btcpay-update.sh"
2022-07-27 16:38:33 +00:00
elif [ "$RESTORE_BTCPAY" = true ]; then
./restore.sh
2022-07-27 16:38:33 +00:00
RUN_BACKUP=false
elif [ "$RECONFIGURE_BTCPAY_SERVER" == true ]; then
# the administrator may have indicated a reconfig;
# if so, we re-run setup script.
2022-06-22 17:29:52 +00:00
./run_setup.sh
2022-07-27 16:38:33 +00:00
exit
fi
# if the script gets this far, then we grab a regular backup.
if [ "$RUN_BACKUP" = true ]; then
# we just grab a regular backup
./backup.sh "$UNIX_BACKUP_TIMESTAMP"
fi
2022-07-27 16:38:33 +00:00
if [ "$RUN_SERVICES" = true ]; then
# 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.
2022-07-27 16:38:33 +00:00
ssh "$FQDN" "bash -c $BTCPAY_SERVER_APPPATH/btcpay-up.sh"
# we wait for lightning to comone line too.
2022-07-27 16:38:33 +00:00
wait-for-it -t 60 "$FQDN:443"
xdg-open "https://$FQDN"
else
2022-07-27 16:38:33 +00:00
echo "WARNING: BTCPAY Server services NOT started. This is probably on purpose."
fi