diff --git a/deploy/setup b/deploy/setup index 86dfe216c6..b32ac5d891 100755 --- a/deploy/setup +++ b/deploy/setup @@ -10,35 +10,8 @@ BRANCH=$3 COMMIT=$4 REVISION="ord-$BRANCH-$COMMIT" -case $CHAIN in - main) - CSP_ORIGIN=ordinals.com - ;; - regtest) - CSP_ORIGIN=regtest.ordinals.com - ;; - signet) - CSP_ORIGIN=signet.ordinals.com - ;; - test) - CSP_ORIGIN=testnet.ordinals.com - ;; - *) - echo "Unknown chain: $CHAIN" - exit 1 - ;; -esac - touch ~/.hushlogin -mkdir -p \ - /etc/systemd/system/bitcoind.service.d \ - /etc/systemd/system/ord.service.d - -printf "[Service]\nEnvironment=CHAIN=%s\nEnvironment=CSP_ORIGIN=%s\n" $CHAIN $CSP_ORIGIN \ - | tee /etc/systemd/system/bitcoind.service.d/override.conf \ - > /etc/systemd/system/ord.service.d/override.conf - hostnamectl set-hostname $DOMAIN apt-get install --yes \ @@ -60,21 +33,25 @@ ufw allow http ufw allow https ufw allow ssh -sed -i -E 's/#?PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config -sshd -t -systemctl restart sshd - case $CHAIN in main) + COOKIE_FILE_DIR=/var/lib/bitcoind + CSP_ORIGIN=ordinals.com ufw allow 8333 ;; regtest) + COOKIE_FILE_DIR=/var/lib/bitcoind/regtest + CSP_ORIGIN=regtest.ordinals.com ufw allow 18444 ;; signet) + COOKIE_FILE_DIR=/var/lib/bitcoind/signet + CSP_ORIGIN=signet.ordinals.com ufw allow 38333 ;; test) + COOKIE_FILE_DIR=/var/lib/bitcoind/testnet3 + CSP_ORIGIN=testnet.ordinals.com ufw allow 18333 ;; *) @@ -83,6 +60,18 @@ case $CHAIN in ;; esac +mkdir -p \ + /etc/systemd/system/bitcoind.service.d \ + /etc/systemd/system/ord.service.d + +printf "[Service]\nEnvironment=CHAIN=%s\nEnvironment=CSP_ORIGIN=%s\n" $CHAIN $CSP_ORIGIN \ + | tee /etc/systemd/system/bitcoind.service.d/override.conf \ + > /etc/systemd/system/ord.service.d/override.conf + +sed -i -E 's/#?PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config +sshd -t +systemctl restart sshd + ufw --force enable if ! which bitcoind; then @@ -119,25 +108,6 @@ systemctl daemon-reload systemctl enable bitcoind systemctl restart bitcoind -case $CHAIN in - main) - COOKIE_FILE_DIR=/var/lib/bitcoind - ;; - regtest) - COOKIE_FILE_DIR=/var/lib/bitcoind/regtest - ;; - signet) - COOKIE_FILE_DIR=/var/lib/bitcoind/signet - ;; - test) - COOKIE_FILE_DIR=/var/lib/bitcoind/testnet3 - ;; - *) - echo "Unknown chain: $CHAIN" - exit 1 - ;; -esac - while [[ ! -f $COOKIE_FILE_DIR/.cookie ]]; do echo "Waiting for bitcoind…" sleep 1