Adapt to new migration for umbrel 0.5.0 including core lightning data (#3160)

This commit is contained in:
/rootzoll 2022-06-09 17:51:42 +02:00 committed by GitHub
parent 19f5424315
commit dd9e81b6c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 99 additions and 33 deletions

View File

@ -21,6 +21,7 @@
- Update: Electrum Server in Rust (electrs) v0.9.7 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#097-apr-30-2022)
- Update: BTCPayServer v1.5.4 [details](https://github.com/btcpayserver/btcpayserver/releases/tag/v1.5.4)
- Update: Helipad (Podcasting 2.0 Boostagram reader) v0.1.10 [details](https://github.com/Podcastindex-org/helipad/releases/tag/v0.1.10)
- Update: Adapted Umbrel Migration for new 0.5.0 version with core lightning
- Info: Run RaspiBlitz on amd64 bare metal and virtual machines [details](https://github.com/rootzoll/raspiblitz/tree/dev/alternative.platforms)
## What's new in Version 1.7.2 of RaspiBlitz?

View File

@ -586,7 +586,7 @@ if [ ${isMounted} -eq 0 ]; then
clear
echo "Migrating Blockchain of ${hddGotMigrationData}'" >> ${logFile}
source <(sudo /home/admin/config.scripts/blitz.migration.sh migration-${hddGotMigrationData})
if [ "${err}" != "" ]; then
if [ "${error}" != "0" ]; then
echo "MIGRATION OF BLOCKHAIN FAILED: ${err}" >> ${logFile}
echo "Format data disk on laptop & recover funds with fresh sd card using seed words + static channel backup." >> ${logFile}
/home/admin/_cache.sh set state "errorHDD"

View File

@ -39,9 +39,9 @@ echo "**************************************************" >> ${logFile}
echo "MIGRATION FROM ${nodenameUpperCase} TO RASPIBLITZ" >> ${logFile}
echo "**************************************************" >> ${logFile}
echo "- started ..." >> ${logFile}
source <(/home/admin/config.scripts/blitz.migration.sh migration-${hddGotMigrationData})
if [ "${err}" != "" ]; then
/home/admin/config.scripts/blitz.error.sh _provision.migration.sh "migration-failed" "${err}" "Recover funds with fresh sd card using seed words + static channel backup." ${logFile}
/home/admin/config.scripts/blitz.migration.sh migration-${hddGotMigrationData} >> ${logFile}
if [ "$?" != "0" ]; then
/home/admin/config.scripts/blitz.error.sh _provision.migration.sh "migration-failed" "see provision migration logs" "Recover funds with fresh sd card using seed words + static channel backup." ${logFile}
exit 3
fi

View File

@ -308,7 +308,6 @@ if [ "$1" = "status" ]; then
echo "# ERROR: Was not able to determine hddDataFree space"
fi
# check if its another fullnode implementation data disk
hddGotMigrationData=""
hddGotMigrationDataExtra=""
@ -318,9 +317,18 @@ if [ "$1" = "status" ]; then
isCitadelHDD=$(ls /mnt/storage/citadel/info.json 2>/dev/null | grep -c '.json')
isMyNodeHDD=$(ls /mnt/storage/mynode/bitcoin/bitcoin.conf 2>/dev/null | grep -c '.conf')
if [ ${isUmbrelHDD} -gt 0 ]; then
# sudo cat /mnt/hdd/umbrel/app-data/bitcoin/umbrel-app.yml | grep "version:" | cut -d ":" -f2 | tr -d \" | xargs
hddGotMigrationData="umbrel"
lndVersion=$(grep "lightninglabs/lnd" /mnt/storage/umbrel/docker-compose.yml 2>/dev/null | sed 's/.*lnd://' | sed 's/@.*//')
echo "hddVersionLND='${lndVersion}'"
btcVersion=$(grep "lncm/bitcoind" /mnt/storage/umbrel/app-data/bitcoin/docker-compose.yml 2>/dev/null | sed 's/.*bitcoind://' | sed 's/@.*//')
clnVersion=$(grep "lncm/clightning" /mnt/storage/umbrel/app-data/core-lightning/docker-compose.yml 2>/dev/null | sed 's/.*clightning://' | sed 's/@.*//')
lndVersion=$(grep "lightninglabs/lnd" /mnt/storage/umbrel/app-data/lightning/docker-compose.yml 2>/dev/null | sed 's/.*lnd://' | sed 's/@.*//')
# umbrel <0.5.0 (old structure)
if [ "${lndVersion}" == "" ]; then
lndVersion=$(grep "lightninglabs/lnd" /mnt/storage/umbrel/docker-compose.yml 2>/dev/null | sed 's/.*lnd://' | sed 's/@.*//')
fi
echo "hddVersionBTC='${btcVersion}'"
echo "hddVersionLND='${clnVersion}'"
echo "hddVersionCLN='${lndVersion}'"
elif [ ${isMyNodeHDD} -gt 0 ]; then
hddGotMigrationData="mynode"
elif [ ${isCitadelHDD} -gt 0 ]; then

View File

@ -108,6 +108,10 @@ migrate_raspiblitz_conf () {
if [ "$1" = "migration-umbrel" ]; then
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
if [ "${isMounted}" == "1" ]; then
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh unmount)
fi
# make sure data drive is mounted
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
if [ "${isMounted}" != "1" ]; then
@ -116,15 +120,17 @@ if [ "$1" = "migration-umbrel" ]; then
if [ "${isMounted}" == "1" ]; then
echo "# mounted /mnt/hdd (hddFormat='${hddFormat}')"
else
echo "err='failed temp mounting disk'"
echo "error'failed temp mounting disk'"
exit 1
fi
# checking basic data disk layout
if [ -f /mnt/hdd/umbrel/bitcoin/bitcoin.conf ] && [ -f /mnt/hdd/umbrel/lnd/lnd.conf ]; then
echo "# found bitcoin & lnd data"
echo "# found bitcoin & lnd data <0.5.0"
elif [ "${hddVersionBTC}" != "" ] || [ "${hddVersionLND}" != "" ] || [ "${hddVersionCLN}" != "" ]; then
echo "# found umbrel data >=0.5.0"
else
echo "err='umbrel data layout changed'"
echo "error='umbrel data layout changed'"
exit 1
fi
@ -133,14 +139,14 @@ if [ "$1" = "migration-umbrel" ]; then
# determine version
version=$(sudo cat /mnt/hdd/umbrel/info.json | jq -r '.version')
if [ "${version}" == "" ]; then
echo "err='not able to get version'"
echo "error='not able to get version'"
exit 1
fi
versionMajor=$(echo "${version}" | cut -d "." -f1)
versionMiner=$(echo "${version}" | cut -d "." -f2)
versionPatch=$(echo "${version}" | cut -d "." -f3)
if [ "${versionMajor}" == "" ] || [ "${versionMiner}" == "" ] || [ "${versionPatch}" == "" ]; then
echo "err='not able processing version'"
echo "error='not able processing version'"
exit 1
fi
@ -159,25 +165,76 @@ if [ "$1" = "migration-umbrel" ]; then
# extract detailed data
nameNode=$(sudo jq -r '.name' /mnt/hdd/umbrel/db/user.json)
# move bitcoin/blockchain & call function to migrate config
sudo mv /mnt/hdd/bitcoin /mnt/hdd/backup_bitcoin 2>/dev/null
sudo mv /mnt/hdd/umbrel/bitcoin /mnt/hdd/
sudo rm /mnt/hdd/bitcoin/.walletlock 2>/dev/null
sudo chown bitcoin:bitcoin -R /mnt/hdd/bitcoin
migrate_btc_conf
# call function for final migration
migrate_raspiblitz_conf ${nameNode}
# move lnd & call function to migrate config
sudo mv /mnt/hdd/lnd /mnt/hdd/backup_lnd 2>/dev/null
sudo mv /mnt/hdd/umbrel/lnd /mnt/hdd/
sudo chown bitcoin:bitcoin -R /mnt/hdd/lnd
migrate_lnd_conf ${nameNode}
# move bitcoin/blockchain & call function to migrate config
echo "### BITCOIN ###"
if [ ${versionMajor} -eq 0 ] && [ ${versionMiner} -gt 4 ]; then
echo "# moving new bitcoin data >=0.5.0"
sudo rm -R /mnt/hdd/bitcoin 2>/dev/null
sudo mv /mnt/hdd/umbrel/app-data/bitcoin/data/bitcoin /mnt/hdd/
sudo rm /mnt/hdd/bitcoin/.walletlock 2>/dev/null
sudo chown bitcoin:bitcoin -R /mnt/hdd/bitcoin
migrate_btc_conf
/home/admin/config.scripts/blitz.conf.sh set lightning "none"
else
echo "# moving old bitcoin data <0.5.0"
sudo mv /mnt/hdd/bitcoin /mnt/hdd/backup_bitcoin 2>/dev/null
sudo mv /mnt/hdd/umbrel/bitcoin /mnt/hdd/
sudo rm /mnt/hdd/bitcoin/.walletlock 2>/dev/null
sudo chown bitcoin:bitcoin -R /mnt/hdd/bitcoin
migrate_btc_conf
fi
# CORE LIGHTNING since 0.5.0 umbrel has core lightning
echo "### CORE LIGHTNING ###"
if [ ${versionMajor} -eq 0 ] && [ ${versionMiner} -gt 4 ]; then
clnExists=$(sudo ls /mnt/hdd/umbrel/app-data/core-lightning/data/lightningd/bitcoin/hsm_secret | grep -c "hsm_secret")
if [ "${clnExists}" == "1" ]; then
echo "# moving cln data >=0.5.0"
sudo mv /mnt/hdd/app-data/.lightning /mnt/hdd/app-data/backup_lightning 2>/dev/null
sudo mkdir /mnt/hdd/app-data/.lightning 2>/dev/null
sudo mv /mnt/hdd/umbrel/app-data/core-lightning/data/lightningd/bitcoin /mnt/hdd/app-data/.lightning/
sudo chown bitcoin:bitcoin -R /mnt/hdd/app-data/.lightning
/home/admin/config.scripts/blitz.conf.sh set cl on
/home/admin/config.scripts/blitz.conf.sh set lightning "cl"
else
echo "# no cln data found >=0.5.0"
fi
else
echo "# no core lightning <0.5.0"
fi
# LND since 0.5.0 umbrel uses a different data structure
echo "### LND ###"
if [ ${versionMajor} -eq 0 ] && [ ${versionMiner} -gt 4 ]; then
# new way - lnd might even not exist because its optional
lndExists=$(sudo ls /mnt/hdd/umbrel/app-data/lightning/data/lnd/lnd.conf | grep -c "lnd.conf")
if [ "${lndExists}" == "1" ]; then
echo "# moving lnd data >=0.5.0"
sudo mv /mnt/hdd/lnd /mnt/hdd/backup_lnd 2>/dev/null
sudo mv /mnt/hdd/umbrel/app-data/lightning/data/lnd /mnt/hdd/
sudo chown bitcoin:bitcoin -R /mnt/hdd/lnd
migrate_lnd_conf ${nameNode}
/home/admin/config.scripts/blitz.conf.sh set lnd on
/home/admin/config.scripts/blitz.conf.sh set lightning "lnd"
else
echo "# no lnd data found >=0.5.0"
fi
else
echo "# moving old lnd data <0.5.0"
sudo mv /mnt/hdd/lnd /mnt/hdd/backup_lnd 2>/dev/null
sudo mv /mnt/hdd/umbrel/lnd /mnt/hdd/
sudo chown bitcoin:bitcoin -R /mnt/hdd/lnd
migrate_lnd_conf ${nameNode}
/home/admin/config.scripts/blitz.conf.sh set lnd on
/home/admin/config.scripts/blitz.conf.sh set lightning "lnd"
fi
# backup & rename the rest of the data
sudo mv /mnt/hdd/umbrel /mnt/hdd/backup_migration
# call function for final migration
migrate_raspiblitz_conf ${nameNode}
echo "# OK ... data disk converted to RaspiBlitz"
exit 0
fi
@ -196,7 +253,7 @@ if [ "$1" = "migration-citadel" ]; then
if [ "${isMounted}" == "1" ]; then
echo "# mounted /mnt/hdd (hddFormat='${hddFormat}')"
else
echo "err='failed temp mounting disk'"
echo "error='failed temp mounting disk'"
exit 1
fi
@ -204,7 +261,7 @@ if [ "$1" = "migration-citadel" ]; then
if [ -f /mnt/hdd/citadel/bitcoin/bitcoin.conf ] && [ -f /mnt/hdd/citadel/lnd/lnd.conf ]; then
echo "# found bitcoin & lnd data"
else
echo "err='citadel data layout changed'"
echo "error='citadel data layout changed'"
exit 1
fi
@ -213,14 +270,14 @@ if [ "$1" = "migration-citadel" ]; then
# determine version
version=$(sudo cat /mnt/hdd/citadel/info.json | jq -r '.version')
if [ "${version}" == "" ]; then
echo "err='not able to get version'"
echo "error='not able to get version'"
exit 1
fi
versionMajor=$(echo "${version}" | cut -d "." -f1)
versionMiner=$(echo "${version}" | cut -d "." -f2)
versionPatch=$(echo "${version}" | cut -d "." -f3)
if [ "${versionMajor}" == "" ] || [ "${versionMiner}" == "" ] || [ "${versionPatch}" == "" ]; then
echo "err='not able processing version'"
echo "error='not able processing version'"
exit 1
fi
@ -271,7 +328,7 @@ if [ "$1" = "migration-mynode" ]; then
if [ "${isMounted}" == "1" ]; then
echo "# mounted /mnt/hdd (hddFormat='${hddFormat}')"
else
echo "err='failed temp mounting disk'"
echo "error='failed temp mounting disk'"
exit 1
fi
@ -279,7 +336,7 @@ if [ "$1" = "migration-mynode" ]; then
if [ -f /mnt/hdd/mynode/bitcoin/bitcoin.conf ] && [ -f /mnt/hdd/mynode/lnd/lnd.conf ]; then
echo "# found bitcoin & lnd data"
else
echo "err='mynode data layout changed'"
echo "error='mynode data layout changed'"
exit 1
fi

View File

@ -139,7 +139,7 @@ if [ "${migrationOS}" == "umbrel" ]; then
# infodialog
whiptail --title " UMBREL --> RASPIBLITZ " --yes-button "Start Migration" --no-button "Cancel Migration" --yesno "RaspiBlitz found data from UMBREL
You can migrate your blockchain & LND data (funds & channels) over to RaspiBlitz.
You can migrate your blockchain & lightning data (funds & channels) over to RaspiBlitz.
Please make sure to have your UMBREL seed words & static channel backup file (just in case). Also any data of additional apps you had installed on UMBREL might get lost.