Make LndHub upgradable

This commit is contained in:
Taylor Helsper 2020-01-26 13:59:38 -06:00
parent 4e26ed66e2
commit f210d8f634
9 changed files with 66 additions and 3 deletions

View File

@ -1,3 +1,8 @@
=== v0.1.84 ===
- Fix issue copying files after an upgrade
- Add button to reset Whirlpool config
- Enable LndHub upgrades
=== v0.1.83 ===
- Revert 0.1.82

View File

@ -157,6 +157,32 @@ if [ "$CURRENT" != "$LND_UPGRADE_URL" ]; then
fi
fi
# Install LndHub
LNDHUB_VERSION="v1.1.3"
LNDHUB_UPGRADE_URL=https://github.com/BlueWallet/LndHub/archive/${LNDHUB_VERSION}.tar.gz
LNDHUB_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lndhub_url
CURRENT=""
if [ -f $LNDHUB_UPGRADE_URL_FILE ]; then
CURRENT=$(cat $LNDHUB_UPGRADE_URL_FILE)
fi
if [ "$CURRENT" != "$LNDHUB_UPGRADE_URL" ]; then
cd /opt/mynode
rm -rf LndHub
wget $LNDHUB_UPGRADE_URL
tar -xzf ${LNDHUB_VERSION}.tar.gz
rm -f ${LNDHUB_VERSION}.tar.gz
mv LndHub-* LndHub
chown -R bitcoin:bitcoin LndHub
cd LndHub
sudo -u bitcoin npm install --only=production
sudo -u bitcoin ln -s /home/bitcoin/.lnd/tls.cert tls.cert
sudo -u bitcoin ln -s /home/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon admin.macaroon
echo $LNDHUB_UPGRADE_URL > $LNDHUB_UPGRADE_URL_FILE
fi
cd ~
# Install recent version of secp256k1
echo "Installing secp256k1..."
if [ ! -f /usr/include/secp256k1_ecdh.h ]; then

View File

@ -17,6 +17,8 @@ if [ "$APP" = "bitcoin" ]; then
rm -f /home/bitcoin/.mynode/.btc_url
elif [ "$APP" = "lnd" ]; then
rm -f /home/bitcoin/.mynode/.lnd_url
elif [ "$APP" = "lndhub" ]; then
rm -f /home/bitcoin/.mynode/.lndhub_url
elif [ "$APP" = "rtl" ]; then
rm -f /home/bitcoin/.mynode/.rtl_url
elif [ "$APP" = "mempoolspace" ]; then

View File

@ -207,7 +207,9 @@ fi
# Update files that need RPC password (needed if upgrades overwrite files)
PW=$(cat /mnt/hdd/mynode/settings/.btcrpcpw)
if [ -f /opt/mynode/LndHub/config.js ]; then
cp -f /usr/share/mynode/lndhub-config.js /opt/mynode/LndHub/config.js
sed -i "s/mynode:.*@/mynode:$PW@/g" /opt/mynode/LndHub/config.js
chown bitcoin:bitcoin /opt/mynode/LndHub/config.js
fi
if [ -f /opt/mynode/btc-rpc-explorer/.env ]; then
sed -i "s/BTCEXP_BITCOIND_PASS=.*/BTCEXP_BITCOIND_PASS=$PW/g" /opt/mynode/btc-rpc-explorer/.env

View File

@ -708,6 +708,7 @@
<br/>
<a href="/settings/reinstall-app?app=bitcoin" class="ui-button ui-widget ui-corner-all settings_button">Bitcoin</a>
<a href="/settings/reinstall-app?app=lnd" class="ui-button ui-widget ui-corner-all settings_button">LND</a>
<a href="/settings/reinstall-app?app=lndhub" class="ui-button ui-widget ui-corner-all settings_button">LndHub</a>
<a href="/settings/reinstall-app?app=rtl" class="ui-button ui-widget ui-corner-all settings_button">RTL</a>
<a href="/settings/reinstall-app?app=mempoolspace" class="ui-button ui-widget ui-corner-all settings_button">Mempool.Space</a>
<a href="/settings/reinstall-app?app=joinmarket" class="ui-button ui-widget ui-corner-all settings_button">JoinMarket</a>

View File

@ -20,6 +20,12 @@
<div class="info_tile_header">API Key for Whirlpool GUI</div>
<div class="info_tile_contents">{{whirlpool_api_key}}</div>
</div>
<div class="info_tile">
<div class="info_tile_header">Reset Config</div>
<div class="info_tile_contents">
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 70%;" href="/reset-whirlpool">Reset</a>
</div>
</div>
{% endif %}
{% if whirlpool_enabled %}
<div class="info_tile">

View File

@ -58,3 +58,10 @@ def page_toggle_whirlpool():
check_logged_in()
os.system("systemctl restart whirlpool --no-pager")
return redirect("/whirlpool")
@mynode_whirlpool.route("/reset-whirlpool")
def page_reset_whirlpool():
check_logged_in()
os.system("rm -f /opt/mynode/whirlpool/whirlpool-cli-config.properties")
os.system("systemctl restart whirlpool --no-pager")
return redirect("/whirlpool")

View File

@ -281,16 +281,30 @@ chown -R bitcoin:bitcoin /opt/mynode
# Install LND Hub
if [ ! -f /tmp/installed_lndhub ]; then
LNDHUB_VERSION="v1.1.3"
LNDHUB_UPGRADE_URL=https://github.com/BlueWallet/LndHub/archive/${LNDHUB_VERSION}.tar.gz
LNDHUB_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lndhub_url
CURRENT=""
if [ -f $LNDHUB_UPGRADE_URL_FILE ]; then
CURRENT=$(cat $LNDHUB_UPGRADE_URL_FILE)
fi
if [ "$CURRENT" != "$LNDHUB_UPGRADE_URL" ]; then
cd /opt/mynode
rm -rf LndHub
sudo -u bitcoin git clone https://github.com/BlueWallet/LndHub.git
wget $LNDHUB_UPGRADE_URL
tar -xzf ${LNDHUB_VERSION}.tar.gz
rm -f ${LNDHUB_VERSION}.tar.gz
mv LndHub-* LndHub
chown -R bitcoin:bitcoin LndHub
cd LndHub
sudo -u bitcoin npm install --only=production
sudo -u bitcoin ln -s /home/bitcoin/.lnd/tls.cert tls.cert
sudo -u bitcoin ln -s /home/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon admin.macaroon
touch /tmp/installed_lndhub
echo $LNDHUB_UPGRADE_URL > $LNDHUB_UPGRADE_URL_FILE
fi
cd ~
# Install electrs (only build to save new version, now included in overlay)
#cd /home/admin/download