From 0c28ca41020e0214c4ec74287131d06bcd87fe5a Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Sun, 2 Apr 2023 09:24:59 -0400 Subject: [PATCH] BTCPay updates. --- btcpayserver/go.sh | 2 +- btcpayserver/stub_btcpay_setup.sh | 14 +++++--------- deploy_vm.sh | 20 +++++++++++++++----- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/btcpayserver/go.sh b/btcpayserver/go.sh index 22c5194..5e9d9ca 100755 --- a/btcpayserver/go.sh +++ b/btcpayserver/go.sh @@ -6,7 +6,7 @@ cd "$(dirname "$0")" export DOCKER_HOST="ssh://ubuntu@$BTCPAY_FQDN" # 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_DATA_PATH/btcpay.complete" ]"; then ./stub_btcpay_setup.sh BACKUP_BTCPAY=false fi diff --git a/btcpayserver/stub_btcpay_setup.sh b/btcpayserver/stub_btcpay_setup.sh index 9e71d7a..ad88d49 100755 --- a/btcpayserver/stub_btcpay_setup.sh +++ b/btcpayserver/stub_btcpay_setup.sh @@ -59,15 +59,11 @@ export BTCPAY_BASE_DIRECTORY=${REMOTE_HOME} export BTCPAYGEN_EXCLUDE_FRAGMENTS="nginx-https;" export REVERSEPROXY_DEFAULT_HOST="$BTCPAY_USER_FQDN" -if [ "\$NBITCOIN_NETWORK" != regtest ]; then - # run fast_sync if it's not been done before. - if [ ! -f /home/ubuntu/fast_sync_completed ]; then - cd ./contrib/FastSync - ./load-utxo-set.sh - touch /home/ubuntu/fast_sync_completed - cd - - fi -fi +# if [ "\$NBITCOIN_NETWORK" != regtest ]; then +# cd ./contrib/FastSync +# ./load-utxo-set.sh +# cd - +# fi # next we create fragments to customize various aspects of the system # this block customizes clightning to ensure the correct endpoints are being advertised diff --git a/deploy_vm.sh b/deploy_vm.sh index ac1c99c..4e01a09 100755 --- a/deploy_vm.sh +++ b/deploy_vm.sh @@ -78,10 +78,20 @@ if ! lxc list --format csv | grep -q "$LXD_VM_NAME"; then sleep 10 bash -c "./wait_for_lxc_ip.sh --lxd-name=$LXD_VM_NAME" -fi -# scan the remote machine and install it's identity in our SSH known_hosts file. -ssh-keyscan -H -t ecdsa "$FQDN" >> "$SSH_HOME/known_hosts" + # scan the remote machine and install it's identity in our SSH known_hosts file. + ssh-keyscan -H -t ecdsa "$FQDN" >> "$SSH_HOME/known_hosts" -# create a directory to store backup archives. This is on all new vms. -ssh "$FQDN" mkdir -p "$REMOTE_HOME/backups" + + # create a directory to store backup archives. This is on all new vms. + ssh "$FQDN" "mkdir -p $REMOTE_HOME/backups" + + ssh "$FQDN" "sudo chown -R ubuntu:ubuntu $REMOTE_DATA_PATH" + + if [ "$VIRTUAL_MACHINE" = btcpayserver ]; then + # send an updated ~/.bashrc so we have quicker access to cli tools + scp ./btcpayserver/bashrc.txt "ubuntu@$FQDN:$REMOTE_HOME/.bashrc" + ssh "$BTCPAY_FQDN" "chown ubuntu:ubuntu $REMOTE_HOME/.bashrc" + ssh "$BTCPAY_FQDN" "chmod 0664 $REMOTE_HOME/.bashrc" + fi +fi \ No newline at end of file