Upgrade LNBits to v0.9.4

This commit is contained in:
Taylor Helsper 2022-09-29 22:05:44 -05:00
parent 3915a8ff96
commit 4947593cce
7 changed files with 89 additions and 94 deletions

View File

@ -8,9 +8,9 @@ server {
access_log /var/log/nginx/access_lnbits.log;
error_log /var/log/nginx/error_lnbits.log;
location /static {
root /opt/mynode/lnbits/lnbits;
}
# location /static {
# root /opt/mynode/lnbits/lnbits;
# }
location / {
proxy_pass http://127.0.0.1:5000;

View File

@ -11,13 +11,10 @@ ExecStartPre=/usr/bin/is_not_shutting_down.sh
ExecStartPre=/usr/bin/is_mainnet.sh
ExecStartPre=/usr/bin/wait_on_lnd.sh
ExecStartPre=/usr/bin/service_scripts/pre_lnbits.sh
#ExecStartPre=/bin/sh -c 'cd /opt/mynode/lnbits && /usr/local/bin/pipenv run flask migrate'
ExecStartPre=/bin/sh -c 'cd /opt/mynode/lnbits && ./lnbits_venv/bin/quart migrate'
#Environment=FLASK_ENV=development
WorkingDirectory=/opt/mynode/lnbits
ExecStart=/bin/sh -c 'cd /opt/mynode/lnbits && ./lnbits_venv/bin/hypercorn -k trio --bind 0.0.0.0:5000 "lnbits.app:create_app()"'
ExecStart=/usr/bin/docker run --rm --name lnbits-legend -p 5000:5000 --volume /opt/mynode/lnbits/.env:/app/.env --volume /mnt/hdd/mynode/lnbits/:/app/data --volume /mnt/hdd/mynode/lnd/tls.cert:/app/tls.cert lnbits-legend
ExecStop=/usr/bin/docker stop -t 2 lnbits-legend
User=bitcoin
Group=bitcoin

View File

@ -183,6 +183,36 @@ while true; do
touch /tmp/need_application_refresh
# Upgrade LNBits
if should_install_app "lnbits" ; then
LNBITS_UPGRADE_URL=https://github.com/lnbits/lnbits/archive/$LNBITS_VERSION.tar.gz
CURRENT=""
if [ -f $LNBITS_VERSION_FILE ]; then
CURRENT=$(cat $LNBITS_VERSION_FILE)
fi
if [ "$CURRENT" != "$LNBITS_VERSION" ]; then
docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep 'lnbits') || true
cd /opt/mynode
rm -rf lnbits
sudo -u bitcoin wget $LNBITS_UPGRADE_URL -O lnbits.tar.gz
sudo -u bitcoin tar -xvf lnbits.tar.gz
sudo -u bitcoin rm lnbits.tar.gz
sudo -u bitcoin mv lnbits-* lnbits
cd lnbits
# Copy over config file
cp /usr/share/mynode/lnbits.env /opt/mynode/lnbits/.env
chown bitcoin:bitcoin /opt/mynode/lnbits/.env
# Build lnbits docker container
docker build -t lnbits-legend .
echo $LNBITS_VERSION > $LNBITS_VERSION_FILE
fi
fi
# Install Dojo
DOJO_UPGRADE_URL=https://code.samourai.io/dojo/samourai-dojo/-/archive/$DOJO_VERSION/samourai-dojo-$DOJO_VERSION.tar.gz
DOJO_UPGRADE_URL_FILE=/mnt/hdd/mynode/settings/dojo_url

View File

@ -102,8 +102,7 @@ if ! skip_base_upgrades ; then
curl https://samouraiwallet.com/pgp.txt | gpg --import # two keys from Samourai team
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys DE23E73BFA8A0AD5587D2FCDE80D2F3F311FD87E #loopd
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 26984CB69EB8C4A26196F7A4D7D916376026F177 # Lightning Terminal
$TORIFY curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import || true # tor
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add - # tor
$TORIFY wget -q https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc -O- | apt-key add - # Tor
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 # Debian Backports
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 # Debian Backports
set -e
@ -214,7 +213,6 @@ if ! skip_base_upgrades ; then
# Mark apps using python as needing re-install
rm -f /home/bitcoin/.mynode/specter_version
rm -f /home/bitcoin/.mynode/lnbits_version
rm -f /home/bitcoin/.mynode/pyblock_version
rm -f /home/bitcoin/.mynode/ckbunker_version
rm -f /home/bitcoin/.mynode/joininbox_version_latest
@ -744,38 +742,6 @@ if should_install_app "btcrpcexplorer" ; then
fi
# Upgrade LNBits
if should_install_app "lnbits" ; then
# Find URL by going to https://github.com/lnbits/lnbits/releases and finding the exact commit for the mynode tag
LNBITS_UPGRADE_URL=https://github.com/lnbits/lnbits/archive/$LNBITS_VERSION.tar.gz
CURRENT=""
if [ -f $LNBITS_VERSION_FILE ]; then
CURRENT=$(cat $LNBITS_VERSION_FILE)
fi
if [ "$CURRENT" != "$LNBITS_VERSION" ]; then
cd /opt/mynode
rm -rf lnbits
sudo -u bitcoin wget $LNBITS_UPGRADE_URL -O lnbits.tar.gz
sudo -u bitcoin tar -xvf lnbits.tar.gz
sudo -u bitcoin rm lnbits.tar.gz
sudo -u bitcoin mv lnbits-* lnbits
cd lnbits
# Copy over config file
cp /usr/share/mynode/lnbits.env /opt/mynode/lnbits/.env
chown bitcoin:bitcoin /opt/mynode/lnbits/.env
# Install lnbits
sudo -u bitcoin python3 -m venv lnbits_venv
sudo -u bitcoin ./lnbits_venv/bin/pip install -r requirements.txt
sudo -u bitcoin ./lnbits_venv/bin/quart assets
sudo -u bitcoin ./lnbits_venv/bin/quart migrate
echo $LNBITS_VERSION > $LNBITS_VERSION_FILE
fi
fi
# Upgrade Specter Desktop
if should_install_app "specter" ; then
CURRENT=""

View File

@ -4,12 +4,13 @@ source /usr/share/mynode/mynode_config.sh
set -x
# Generate hex macaroons
# Copy TLS cert
cp -f /mnt/hdd/mynode/lnd/tls.cert /opt/mynode/lnbits/
# Generate hex macaroons
macaroonAdminHex=$(xxd -ps -u -c 1000 /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon)
macaroonInvoiceHex=$(xxd -ps -u -c 1000 /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/invoice.macaroon)
macaroonReadHex=$(xxd -ps -u -c 1000 /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/readonly.macaroon)
# Update env file
sed -i "s/^LND_REST_ADMIN_MACAROON=.*/LND_REST_ADMIN_MACAROON=${macaroonAdminHex}/g" /opt/mynode/lnbits/.env
sed -i "s/^LND_REST_INVOICE_MACAROON=.*/LND_REST_INVOICE_MACAROON=${macaroonInvoiceHex}/g" /opt/mynode/lnbits/.env
sed -i "s/^LND_REST_READ_MACAROON=.*/LND_REST_READ_MACAROON=${macaroonReadHex}/g" /opt/mynode/lnbits/.env
sed -i "s/^LND_REST_MACAROON=.*/LND_REST_MACAROON=${macaroonAdminHex}/g" /opt/mynode/lnbits/.env
#sed -i "s/^LND_REST_INVOICE_MACAROON=.*/LND_REST_INVOICE_MACAROON=${macaroonInvoiceHex}/g" /opt/mynode/lnbits/.env
#sed -i "s/^LND_REST_READ_MACAROON=.*/LND_REST_READ_MACAROON=${macaroonReadHex}/g" /opt/mynode/lnbits/.env

View File

@ -1,52 +1,53 @@
QUART_APP=lnbits.app:create_app()
QUART_ENV=development
QUART_DEBUG=true
HOST=0.0.0.0
HOST=127.0.0.1
PORT=5000
QUART_APP=lnbits.app:create_app()
DEBUG=false
LNBITS_SITE_TITLE=LNbits
LNBITS_ALLOWED_USERS=""
LNBITS_ADMIN_USERS=""
# Extensions only admin can access
LNBITS_ADMIN_EXTENSIONS=""
LNBITS_DEFAULT_WALLET_NAME="LNbits wallet"
LNBITS_DATA_FOLDER="/mnt/hdd/mynode/lnbits"
LNBITS_DISABLED_EXTENSIONS="amilk"
LNBITS_FORCE_HTTPS=0
LNBITS_SERVICE_FEE="0.0"
# Choose from LNPayWallet, OpenNodeWallet, LntxbotWallet, LndWallet, CLightningWallet, LnbitsWallet
# csv ad image filepaths or urls, extensions can choose to honor
LNBITS_AD_SPACE="ADSPACE TEST"
# Hides wallet api, extensions can choose to honor
LNBITS_HIDE_API=false
# Disable extensions for all users, use "all" to disable all extensions
LNBITS_DISABLED_EXTENSIONS="amilk"
# Database: to use SQLite, specify LNBITS_DATA_FOLDER
# to use PostgreSQL, specify LNBITS_DATABASE_URL=postgres://...
# to use CockroachDB, specify LNBITS_DATABASE_URL=cockroachdb://...
# for both PostgreSQL and CockroachDB, you'll need to install
# psycopg2 as an additional dependency
LNBITS_DATA_FOLDER="./data"
# LNBITS_DATABASE_URL="postgres://user:password@host:port/databasename"
LNBITS_FORCE_HTTPS=false
LNBITS_SERVICE_FEE="0.0"
# value in millisats
LNBITS_RESERVE_FEE_MIN=2000
# value in percent
LNBITS_RESERVE_FEE_PERCENT=1.0
# Change theme
LNBITS_SITE_TITLE="LNbits"
LNBITS_SITE_TAGLINE="free and open-source lightning wallet"
LNBITS_SITE_DESCRIPTION="Some description about your service, will display if title is not 'LNbits'"
# Choose from mint, flamingo, freedom, salvador, autumn, monochrome, classic
LNBITS_THEME_OPTIONS="classic, bitcoin, freedom, mint, autumn, monochrome, salvador"
# LNBITS_CUSTOM_LOGO="https://lnbits.com/assets/images/logo/logo.svg"
# Choose from LNPayWallet, OpenNodeWallet, LntxbotWallet, ClicheWallet
# LndRestWallet, CoreLightningWallet, LNbitsWallet, SparkWallet, FakeWallet, EclairWallet
LNBITS_BACKEND_WALLET_CLASS=LndRestWallet
#CLIGHTNING_RPC="/home/bob/.lightning/bitcoin/lightning-rpc"
#LNBITS_ENDPOINT=127.0.0.1:5000
#LNBITS_INVOICE_MACAROON=LNBITS_INVOICE_MACAROON
#LNBITS_ADMIN_MACAROON=LNBITS_ADMIN_MACAROON
#LND_GRPC_ENDPOINT=127.0.0.1
#LND_GRPC_PORT=10009
#LND_CERT="/mnt/hdd/mynode/lnd/tls.cert"
#LND_ADMIN_MACAROON="/mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon"
#LND_INVOICE_MACAROON="/mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/invoice.macaroon"
#LND_READ_MACAROON="/mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/read.macaroon"
LND_REST_ENDPOINT=https://localhost:10080/
LND_REST_CERT="/mnt/hdd/mynode/lnd/tls.cert"
LND_REST_ADMIN_MACAROON="/mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon"
LND_REST_INVOICE_MACAROON="/mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/invoice.macaroon"
LND_REST_READ_MACAROON="/mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/read.macaroon"
#LNPAY_API_ENDPOINT=https://lnpay.co/v1/
#LNPAY_API_KEY=LNPAY_API_KEY
#LNPAY_ADMIN_KEY=LNPAY_ADMIN_KEY
#LNPAY_INVOICE_KEY=LNPAY_INVOICE_KEY
#LNPAY_READ_KEY=LNPAY_READ_KEY
#LNTXBOT_API_ENDPOINT=https://lntxbot.bigsun.xyz/
#LNTXBOT_ADMIN_KEY=LNTXBOT_ADMIN_KEY
#LNTXBOT_INVOICE_KEY=LNTXBOT_INVOICE_KEY
#OPENNODE_API_ENDPOINT=https://api.opennode.com/
#OPENNODE_ADMIN_KEY=OPENNODE_ADMIN_KEY
#OPENNODE_INVOICE_KEY=OPENNODE_INVOICE_KEY
# LndRestWallet
LND_REST_ENDPOINT=https://172.17.0.1:10080/
LND_REST_CERT="/app/tls.cert"
LND_REST_MACAROON=FILL_IN_HEXSTRING
# To use an AES-encrypted macaroon, set
# LND_REST_MACAROON_ENCRYPTED="eNcRyPtEdMaCaRoOn"

View File

@ -122,7 +122,7 @@ BTCRPCEXPLORER_VERSION=$(get_app_version "$BTCRPCEXPLORER_VERSION" "btcrpcexplor
BTCRPCEXPLORER_VERSION_FILE=/home/bitcoin/.mynode/btcrpcexplorer_version
BTCRPCEXPLORER_LATEST_VERSION_FILE=/home/bitcoin/.mynode/btcrpcexplorer_version_latest
LNBITS_VERSION=bcecf6d43111199302d9f7152ecb7e7a4735662a # Github hash to download
LNBITS_VERSION=0.9.4 # Github hash to download
LNBITS_VERSION=$(get_app_version "$LNBITS_VERSION" "lnbits")
LNBITS_VERSION_FILE=/home/bitcoin/.mynode/lnbits_version
LNBITS_LATEST_VERSION_FILE=/home/bitcoin/.mynode/lnbits_version_latest