mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-23 18:02:13 +02:00
lnbits: update branding and installation script
This commit is contained in:
2
FAQ.md
2
FAQ.md
@@ -17,7 +17,7 @@ Beside many small improvements and changes, these are most important changes:
|
||||
- New: LNDmanage (Advanced Channel Management CLI) [details](https://github.com/bitromortac/lndmanage)
|
||||
- New: BTC-RPC-Explorer (Bitcoin Blockchain Explorer) [details](https://github.com/janoside/btc-rpc-explorer)
|
||||
- New: Loop (Submarine Swaps Service) [details](https://github.com/lightninglabs/loop)
|
||||
- New: LNBits (Lightning wallet/accounts System) [details](https://github.com/arcbtc/lnbits)
|
||||
- New: LNbits (Lightning wallet/accounts System) [details](https://github.com/arcbtc/lnbits)
|
||||
- New: Fully Noded (iOS) [details](https://apps.apple.com/us/app/fully-noded/id1436425586)
|
||||
- New: TOR Support to connect mobile Apps
|
||||
- New: Migration Export/Import (e.g. HDD -> SSD) [details](README.md#import-a-migration-file)
|
||||
|
@@ -26,7 +26,7 @@ There are further Services that can be switched on:
|
||||
* **ElectRS** (Electrum Server in Rust) [details](https://github.com/romanz/electrs)
|
||||
* **BTCPayServer** (Cryptocurrency Payment Processor) [details](https://btcpayserver.org)
|
||||
* **BTC-RPC-Explorer** (Bitcoin Blockchain Explorer) [details](https://github.com/janoside/btc-rpc-explorer)
|
||||
* **LNBits** (Lightning wallet/accounts System) [details](https://github.com/arcbtc/lnbits)
|
||||
* **LNbits** (Lightning wallet/accounts System) [details](https://github.com/arcbtc/lnbits)
|
||||
* **LNDmanage** (Advanced Channel Management CLI) [details](https://github.com/bitromortac/lndmanage)
|
||||
* **Loop** (Submarine Swaps Service) [details](https://github.com/lightninglabs/loop)
|
||||
|
||||
@@ -652,7 +652,7 @@ To run it change to the RaspiBlitz terminal and type 'manage'. This starts the L
|
||||
|
||||
[Details on Service](https://github.com/bitromortac/lndmanage/blob/master/README.md)
|
||||
|
||||
##### LNBits
|
||||
##### LNbits
|
||||
|
||||
LNbits is a very simple server that sits on top of your Lightning Wallet
|
||||
|
||||
|
@@ -48,8 +48,8 @@ fi
|
||||
if [ "${BTCRPCexplorer}" == "on" ]; then
|
||||
OPTIONS+=(EXPLORE "BTC RPC Explorer")
|
||||
fi
|
||||
if [ "${LNBits}" == "on" ]; then
|
||||
OPTIONS+=(LNBITS "LNBits Server")
|
||||
if [ "${LNbits}" == "on" ]; then
|
||||
OPTIONS+=(LNBITS "LNbits Server")
|
||||
fi
|
||||
if [ "${lndmanage}" == "on" ]; then
|
||||
OPTIONS+=(LNDMANAGE "LND Manage Script")
|
||||
|
@@ -20,7 +20,7 @@ if [ ${#lcdrotate} -eq 0 ]; then lcdrotate=0; fi
|
||||
if [ ${#BTCPayServer} -eq 0 ]; then BTCPayServer="off"; fi
|
||||
if [ ${#ElectRS} -eq 0 ]; then ElectRS="off"; fi
|
||||
if [ ${#lndmanage} -eq 0 ]; then lndmanage="off"; fi
|
||||
if [ ${#LNBits} -eq 0 ]; then LNBits="off"; fi
|
||||
if [ ${#LNbits} -eq 0 ]; then LNbits="off"; fi
|
||||
|
||||
echo "map chain to on/off"
|
||||
chainValue="off"
|
||||
@@ -72,7 +72,7 @@ r 'LCD Rotate' ${lcdrotateMenu} \
|
||||
e 'Electrum Rust Server' ${ElectRS} \
|
||||
p 'BTCPayServer' ${BTCPayServer} \
|
||||
m 'lndmanage' ${lndmanage} \
|
||||
i 'LNBits' ${LNBits} \
|
||||
i 'LNbits' ${LNbits} \
|
||||
2>&1 >/dev/tty)
|
||||
else
|
||||
CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 \
|
||||
@@ -91,7 +91,7 @@ r 'LCD Rotate' ${lcdrotateMenu} \
|
||||
e 'Electrum Rust Server' ${ElectRS} \
|
||||
p 'BTCPayServer' ${BTCPayServer} \
|
||||
m 'lndmanage' ${lndmanage} \
|
||||
i 'LNBits' ${LNBits} \
|
||||
i 'LNbits' ${LNbits} \
|
||||
2>&1 >/dev/tty)
|
||||
fi
|
||||
|
||||
@@ -495,11 +495,11 @@ else
|
||||
echo "lndmanage setting unchanged."
|
||||
fi
|
||||
|
||||
# LNBits process choice
|
||||
# LNbits process choice
|
||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "i")
|
||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||
if [ "${LNBits}" != "${choice}" ]; then
|
||||
echo "LNBits Setting changed .."
|
||||
if [ "${LNbits}" != "${choice}" ]; then
|
||||
echo "LNbits Setting changed .."
|
||||
anychange=1
|
||||
sudo -u admin /home/admin/config.scripts/bonus.lnbits.sh ${choice}
|
||||
if [ "${choice}" = "on" ]; then
|
||||
|
@@ -124,13 +124,13 @@ else
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ "${LNBits}" = "on" ]; then
|
||||
echo "*** LAST 20 LNBits LOGS ***"
|
||||
if [ "${LNbits}" = "on" ]; then
|
||||
echo "*** LAST 20 LNbits LOGS ***"
|
||||
echo "sudo journalctl -u lnbits -b --no-pager -n20"
|
||||
sudo journalctl -u lnbits -b --no-pager -n20
|
||||
echo ""
|
||||
else
|
||||
echo "- LNBits is OFF by config"
|
||||
echo "- LNbits is OFF by config"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
|
@@ -350,13 +350,13 @@ else
|
||||
echo "Provisioning UPS - not active" >> ${logFile}
|
||||
fi
|
||||
|
||||
# LNBits
|
||||
if [ "${LNBits}" = "on" ]; then
|
||||
echo "Provisioning LNBits - run config script" >> ${logFile}
|
||||
sudo sed -i "s/^message=.*/message='Setup LNBits '/g" ${infoFile}
|
||||
# LNbits
|
||||
if [ "${LNbits}" = "on" ]; then
|
||||
echo "Provisioning LNbits - run config script" >> ${logFile}
|
||||
sudo sed -i "s/^message=.*/message='Setup LNbits '/g" ${infoFile}
|
||||
sudo -u admin /home/admin/config.scripts/bonus.lnbits.sh on >> ${logFile} 2>&1
|
||||
else
|
||||
echo "Provisioning LNBits - keep default" >> ${logFile}
|
||||
echo "Provisioning LNbits - keep default" >> ${logFile}
|
||||
fi
|
||||
|
||||
# replay backup LND conf & tlscerts
|
||||
|
@@ -431,10 +431,10 @@ if [ ${#network} -gt 0 ] && [ ${#chain} -gt 0 ]; then
|
||||
sudo sh -c "cat /mnt/hdd/lnd/data/chain/${network}/${chain}net/invoice.macaroon > /home/pi/.lnd/data/chain/${network}/${chain}net/invoice.macaroon" 2>> $logFile
|
||||
sudo chown pi:pi -R /home/pi/.lnd 2>> $logFile
|
||||
|
||||
if [ "${LNBits}" = "on" ]; then
|
||||
echo "updating macaroons for LNBits fresh on start" >> $logFile
|
||||
if [ "${LNbits}" = "on" ]; then
|
||||
echo "updating macaroons for LNbits fresh on start" >> $logFile
|
||||
sudo -u admin /home/admin/config.scripts/bonus.lnbits.sh write-macaroons >> $logFile
|
||||
sudo chown admin:admin -R /mnt/hdd/app-data/LNBits
|
||||
sudo chown admin:admin -R /mnt/hdd/app-data/lnbits
|
||||
fi
|
||||
|
||||
else
|
||||
|
@@ -4,9 +4,9 @@
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "small config script to switch LNBits on or off"
|
||||
echo "bonus.lnbits.sh [on|off|status|menu|write-macaroons]"
|
||||
exit 1
|
||||
echo "small config script to switch LNbits on or off"
|
||||
echo "bonus.lnbits.sh [on|off|status|menu|write-macaroons]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
@@ -26,7 +26,7 @@ if [ "$1" = "menu" ]; then
|
||||
|
||||
# TOR
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr "${toraddress}"
|
||||
whiptail --title " LNBits " --msgbox "Open the following URL in your local web browser:
|
||||
whiptail --title " LNbits " --msgbox "Open the following URL in your local web browser:
|
||||
http://${localip}:5000\n
|
||||
Hidden Service address for TOR Browser (QR see LCD):
|
||||
${toraddress}
|
||||
@@ -35,7 +35,7 @@ ${toraddress}
|
||||
else
|
||||
|
||||
# IP + Domain
|
||||
whiptail --title " LNBits " --msgbox "Open the following URL in your local web browser:
|
||||
whiptail --title " LNbits " --msgbox "Open the following URL in your local web browser:
|
||||
http://${localip}:5000\n
|
||||
Activate TOR to access from outside your local network.
|
||||
" 12 54
|
||||
@@ -46,14 +46,14 @@ Activate TOR to access from outside your local network.
|
||||
fi
|
||||
|
||||
# add default value to raspi config if needed
|
||||
if ! grep -Eq "^LNBits=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "LNBits=off" >> /mnt/hdd/raspiblitz.conf
|
||||
if ! grep -Eq "^LNbits=" /mnt/hdd/raspiblitz.conf; then
|
||||
echo "LNbits=off" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
|
||||
# status
|
||||
if [ "$1" = "status" ]; then
|
||||
|
||||
if [ "${LNBits}" = "on" ]; then
|
||||
if [ "${LNbits}" = "on" ]; then
|
||||
echo "installed=1"
|
||||
|
||||
# check for error
|
||||
@@ -83,7 +83,7 @@ if [ "$1" = "write-macaroons" ]; then
|
||||
macaroonAdminHex=$(sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/${network}/${chain}net/admin.macaroon)
|
||||
macaroonInvoiceHex=$(sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/${network}/${chain}net/invoice.macaroon)
|
||||
macaroonReadHex=$(sudo xxd -ps -u -c 1000 /mnt/hdd/lnd/data/chain/${network}/${chain}net/readonly.macaroon)
|
||||
sudo sed -i "s/^LND_API_ENDPOINT=.*/LND_API_ENDPOINT=https:\/\/127.0.0.1:8080/g" /home/admin/lnbits/.env
|
||||
sudo sed -i "s/^LND_CERT=.*/LND_CERT=_____TO-DO_____/g" /home/admin/lnbits/.env
|
||||
sudo sed -i "s/^LND_ADMIN_MACAROON=.*/LND_ADMIN_MACAROON=${macaroonAdminHex}/g" /home/admin/lnbits/.env
|
||||
sudo sed -i "s/^LND_INVOICE_MACAROON=.*/LND_INVOICE_MACAROON=${macaroonInvoiceHex}/g" /home/admin/lnbits/.env
|
||||
sudo sed -i "s/^LND_READ_MACAROON=.*/LND_READ_MACAROON=${macaroonReadHex}/g" /home/admin/lnbits/.env
|
||||
@@ -97,7 +97,7 @@ sudo systemctl stop lnbits 2>/dev/null
|
||||
|
||||
# switch on
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "*** INSTALL LNBits ***"
|
||||
echo "*** INSTALL LNbits ***"
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/lnbits.service 2>/dev/null | grep -c 'lnbits.service')
|
||||
if [ ${isInstalled} -eq 0 ]; then
|
||||
@@ -106,40 +106,33 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "# installing needed packages"
|
||||
sudo apt-get install -y pipenv 2>/dev/null
|
||||
|
||||
# prepare .env file
|
||||
# install from GitHub
|
||||
echo "# get the github code"
|
||||
sudo rm -r /home/admin/lnbits 2>/dev/null
|
||||
cd /home/admin
|
||||
sudo -u admin git clone https://github.com/arcbtc/lnbits.git
|
||||
#sudo -u admin git reset --hard e3fd6b4ff1f19b750b852a0bb0814cd259db948c
|
||||
cd /home/admin/lnbits
|
||||
sudo -u admin git checkout tags/0.1.0
|
||||
|
||||
# write macarroons to .env file
|
||||
# prepare .env file
|
||||
echo "# preparing env file"
|
||||
sudo rm /home/admin/lnbits/.env 2>/dev/null
|
||||
sudo -u admin mv /home/admin/lnbits/.env.example /home/admin/lnbits/.env
|
||||
echo "FLASK_APP=lnbits" >> /home/admin/lnbits/.env
|
||||
echo "FLASK_ENV=production" >> /home/admin/lnbits/.env
|
||||
echo "LNBITS_BACKEND_WALLET_CLASS=LndWallet" >> /home/admin/lnbits/.env
|
||||
echo "LND_GRPC_ENDPOINT=127.0.0.1" >> /home/admin/lnbits/.env
|
||||
echo "LND_GRPC_PORT=10009" >> /home/admin/lnbits/.env
|
||||
sudo -u admin /home/admin/config.scripts/bonus.lnbits.sh write-macaroons
|
||||
|
||||
# set database path to HDD data so that its survives updates and migrations
|
||||
sudo mkdir /mnt/hdd/app-data/LNBits 2>/dev/null
|
||||
sudo chown admin:admin -R /mnt/hdd/app-data/LNBits
|
||||
echo "LNBITS_DATA_FOLDER=/mnt/hdd/app-data/LNBits" >> /home/admin/lnbits/.env
|
||||
|
||||
# make sure in settings file LND is set as funding source
|
||||
cat > /home/admin/lnbits/lnbits/settings.py <<EOF
|
||||
import os
|
||||
from .wallets import LndWallet
|
||||
WALLET = LndWallet(endpoint=os.getenv("LND_API_ENDPOINT"),admin_macaroon=os.getenv("LND_ADMIN_MACAROON"),invoice_macaroon=os.getenv("LND_INVOICE_MACAROON"),read_macaroon=os.getenv("LND_READ_MACAROON"))
|
||||
LNBITS_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
LNBITS_DATA_FOLDER = os.getenv("LNBITS_DATA_FOLDER", os.path.join(LNBITS_PATH, "data"))
|
||||
DEFAULT_USER_WALLET_NAME = os.getenv("DEFAULT_USER_WALLET_NAME", "Bitcoin LN Wallet")
|
||||
FEE_RESERVE = float(os.getenv("FEE_RESERVE", 0))
|
||||
EOF
|
||||
sudo mkdir /mnt/hdd/app-data/lnbits 2>/dev/null
|
||||
sudo chown admin:admin -R /mnt/hdd/app-data/lnbits
|
||||
echo "LNBITS_DATA_FOLDER=/mnt/hdd/app-data/lnbits" >> /home/admin/lnbits/.env
|
||||
|
||||
# to the install
|
||||
cd /home/admin/lnbits
|
||||
sudo -u admin pipenv install --dev
|
||||
sudo -u admin pipenv install
|
||||
sudo -u admin /usr/bin/pipenv run pip install python-dotenv
|
||||
sudo -u admin /usr/bin/pipenv run pip install gunicorn
|
||||
|
||||
# open firewall
|
||||
echo
|
||||
@@ -160,7 +153,7 @@ After=lnd.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/home/admin/lnbits
|
||||
ExecStart=/bin/sh -c 'cd /home/admin/lnbits && pipenv run gunicorn -b :5000 lnbits:app'
|
||||
ExecStart=/bin/sh -c 'cd /home/admin/lnbits && pipenv run gunicorn -b :5000 lnbits:app -k gevent'
|
||||
User=admin
|
||||
Restart=always
|
||||
TimeoutSec=120
|
||||
@@ -177,11 +170,11 @@ EOF
|
||||
echo "# OK - service needs starting: sudo systemctl start lnbits"
|
||||
|
||||
else
|
||||
echo "LNBits already installed."
|
||||
echo "LNbits already installed."
|
||||
fi
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^LNBits=.*/LNBits=on/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i "s/^LNbits=.*/LNbits=on/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
# Hidden Service if Tor is active
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
@@ -195,18 +188,18 @@ fi
|
||||
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||
|
||||
# setting value in raspi blitz config
|
||||
sudo sed -i "s/^LNBits=.*/LNBits=off/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i "s/^LNbits=.*/LNbits=off/g" /mnt/hdd/raspiblitz.conf
|
||||
|
||||
isInstalled=$(sudo ls /etc/systemd/system/lnbits.service 2>/dev/null | grep -c 'lnbits.service')
|
||||
if [ ${isInstalled} -eq 1 ] || [ "${LNBits}" == "on" ]; then
|
||||
echo "*** REMOVING LNBits ***"
|
||||
if [ ${isInstalled} -eq 1 ] || [ "${LNbits}" == "on" ]; then
|
||||
echo "*** REMOVING LNbits ***"
|
||||
sudo systemctl stop lnbits
|
||||
sudo systemctl disable lnbits
|
||||
sudo rm /etc/systemd/system/lnbits.service
|
||||
sudo rm -r /home/admin/lnbits
|
||||
echo "OK LNBits removed."
|
||||
echo "OK LNbits removed."
|
||||
else
|
||||
echo "LNBits is not installed."
|
||||
echo "LNbits is not installed."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
@@ -381,7 +381,7 @@ EOF
|
||||
if [ "${ElectRS}" = "on" ]; then
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh electrs 50002 50002 50001 50001
|
||||
fi
|
||||
if [ "${LNBits}" = "on" ]; then
|
||||
if [ "${LNbits}" = "on" ]; then
|
||||
/home/admin/config.scripts/internet.hiddenservice.sh lnbits 80 5000
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user