Fix electrs data dir user at update, update electrs to v0.10.4 (#4480)

* Fix electrs data dir user at update
* check and create, fix persmissions of storage dir when on
the data disk is not always available yet when the install option is running
* apply formatting
* fix storage dir before code install check
* electrs update v0.10.4
* update in changes
---------
Co-authored-by: openoms <oms@tuta.io>
This commit is contained in:
Stephan Oeste 2024-03-17 08:52:22 +01:00 committed by GitHub
parent 7426a3a287
commit 9e64abc9d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 61 additions and 53 deletions

View file

@ -10,7 +10,7 @@
- Update: LND v0.17.3-beta [details](https://github.com/lightningnetwork/lnd/releases/tag/v0.17.3-beta) - Update: LND v0.17.3-beta [details](https://github.com/lightningnetwork/lnd/releases/tag/v0.17.3-beta)
- Update: Core Lightning v23.11.2 [details](https://github.com/ElementsProject/lightning/releases/tag/v23.11.2) - Update: Core Lightning v23.11.2 [details](https://github.com/ElementsProject/lightning/releases/tag/v23.11.2)
- Update: C-lightningREST v0.10.7 [details](https://github.com/Ride-The-Lightning/c-lightning-REST/releases/tag/v0.10.7) - Update: C-lightningREST v0.10.7 [details](https://github.com/Ride-The-Lightning/c-lightning-REST/releases/tag/v0.10.7)
- Update: Electrum Server in Rust (electrs) v0.10.2 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#0102-dec-31-2023) - Update: Electrum Server in Rust (electrs) v0.10.4 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#0104-mar-15-2024)
- Update: Fulcrum Electrum server v1.10.0 (CLI install script) [details](https://github.com/cculianu/Fulcrum/releases/tag/v1.10.0) - Update: Fulcrum Electrum server v1.10.0 (CLI install script) [details](https://github.com/cculianu/Fulcrum/releases/tag/v1.10.0)
- Update: BTC-RPC-Explorer v3.4.0 [details](https://github.com/janoside/btc-rpc-explorer/blob/master/CHANGELOG.md#v340) - Update: BTC-RPC-Explorer v3.4.0 [details](https://github.com/janoside/btc-rpc-explorer/blob/master/CHANGELOG.md#v340)
- Update: JoinMarket v0.9.11 [details](https://github.com/JoinMarket-Org/joinmarket-clientserver/releases/tag/v0.9.11) - Update: JoinMarket v0.9.11 [details](https://github.com/JoinMarket-Org/joinmarket-clientserver/releases/tag/v0.9.11)

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# https://github.com/romanz/electrs/releases # https://github.com/romanz/electrs/releases
ELECTRSVERSION="v0.10.2" ELECTRSVERSION="v0.10.4"
# command info # command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
@ -55,7 +55,10 @@ if [ "$1" = "status" ]; then
localPortRunning=$(sudo netstat -an | grep -c '0.0.0.0:50001') localPortRunning=$(sudo netstat -an | grep -c '0.0.0.0:50001')
echo "localTCPPortActive=${localPortRunning}" echo "localTCPPortActive=${localPortRunning}"
publicPortRunning=$(nc -z -w6 ${publicip} 50001 2>/dev/null; echo $?) publicPortRunning=$(
nc -z -w6 ${publicip} 50001 2>/dev/null
echo $?
)
if [ "${publicPortRunning}" == "0" ]; then if [ "${publicPortRunning}" == "0" ]; then
# OK looks good - but just means that something is answering on that port # OK looks good - but just means that something is answering on that port
echo "publicTCPPortAnswering=1" echo "publicTCPPortAnswering=1"
@ -66,7 +69,10 @@ if [ "$1" = "status" ]; then
echo "portSSL='50002'" echo "portSSL='50002'"
localPortRunning=$(sudo netstat -an | grep -c '0.0.0.0:50002') localPortRunning=$(sudo netstat -an | grep -c '0.0.0.0:50002')
echo "localHTTPPortActive=${localPortRunning}" echo "localHTTPPortActive=${localPortRunning}"
publicPortRunning=$(nc -z -w6 ${publicip} 50002 2>/dev/null; echo $?) publicPortRunning=$(
nc -z -w6 ${publicip} 50002 2>/dev/null
echo $?
)
if [ "${publicPortRunning}" == "0" ]; then if [ "${publicPortRunning}" == "0" ]; then
# OK looks good - but just means that something is answering on that port # OK looks good - but just means that something is answering on that port
echo "publicHTTPPortAnswering=1" echo "publicHTTPPortAnswering=1"
@ -194,9 +200,9 @@ Check 'sudo nginx -t' for a detailed error message.
fi fi
# Options (available without TOR) # Options (available without TOR)
OPTIONS=( \ OPTIONS=(
CONNECT "How to Connect" \ CONNECT "How to Connect"
REINDEX "Delete&Rebuild Index" \ REINDEX "Delete&Rebuild Index"
STATUS "ElectRS Status Info" STATUS "ElectRS Status Info"
) )
@ -264,7 +270,7 @@ fi
echo "# Making sure services are not running" echo "# Making sure services are not running"
sudo systemctl stop electrs 2>/dev/null sudo systemctl stop electrs 2>/dev/null
# uninstall # install
if [ "$1" = "install" ]; then if [ "$1" = "install" ]; then
echo "# INSTALL ELECTRS" echo "# INSTALL ELECTRS"
@ -300,14 +306,7 @@ if [ "$1" = "install" ]; then
# build # build
sudo -u electrs /home/electrs/.cargo/bin/cargo build --locked --release || exit 1 sudo -u electrs /home/electrs/.cargo/bin/cargo build --locked --release || exit 1
echo
echo "# The electrs database will be built in /mnt/hdd/app-storage/electrs/db. Takes ~18 hours and ~50Gb diskspace"
echo
sudo mkdir /mnt/hdd/app-storage/electrs 2>/dev/null
sudo chown -R electrs:electrs /mnt/hdd/app-storage/electrs
fi fi
exit 0 exit 0
fi fi
@ -315,6 +314,16 @@ fi
if [ "$1" = "1" ] || [ "$1" = "on" ]; then if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# ACTIVATING ELECTRS" echo "# ACTIVATING ELECTRS"
# check and create storage dir
if ! sudo ls /mnt/hdd/app-storage/electrs 2>/dev/null; then
sudo mkdir /mnt/hdd/app-storage/electrs
echo
echo "# The electrs database will be built in /mnt/hdd/app-storage/electrs/db. Takes ~18 hours and ~50Gb diskspace"
echo
fi
# always fix user id
sudo chown -R electrs:electrs /mnt/hdd/app-storage/electrs
isInstalled=$(sudo ls /etc/systemd/system/electrs.service 2>/dev/null | grep -c 'electrs.service') isInstalled=$(sudo ls /etc/systemd/system/electrs.service 2>/dev/null | grep -c 'electrs.service')
if [ ${isInstalled} -eq 0 ]; then if [ ${isInstalled} -eq 0 ]; then
@ -365,8 +374,7 @@ server_banner = \"Welcome to electrs $ELECTRSVERSION - the Electrum Rust Server
echo echo
echo "# Checking for config.toml" echo "# Checking for config.toml"
echo echo
if [ ! -f "/home/electrs/.electrs/config.toml" ] if [ ! -f "/home/electrs/.electrs/config.toml" ]; then
then
echo "Failed to create config.toml" echo "Failed to create config.toml"
exit 1 exit 1
else else