update lnbits to 0.10.2 and use poetry instead of venv (#3703)

This commit is contained in:
dni ⚡ 2023-03-13 12:47:47 +01:00 committed by GitHub
parent 6a677a6baa
commit 1ae636b265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 43 deletions

View file

@ -1,4 +1,5 @@
# CHANGES between Releases
- Update: LNbits 0.10.2 [details](https://github.com/lnbits/lnbits/releases/tag/0.10.2)
## What's new in Version 1.9.0 of RaspiBlitz?

View file

@ -1,9 +1,9 @@
#!/bin/bash
# https://github.com/lnbits/lnbits-legend
# https://github.com/lnbits/lnbits
# https://github.com/lnbits/lnbits-legend/releases
tag="0.9.6"
# https://github.com/lnbits/lnbits/releases
tag="0.10.2"
VERSION="${tag}"
# command info
@ -579,16 +579,11 @@ if [ "$1" = "sync" ] || [ "$1" = "repo" ]; then
# pull latest code
sudo -u lnbits git pull
# install
sudo -u lnbits python3 -m venv venv
sudo -u lnbits ./venv/bin/pip install -r requirements.txt
sudo -u lnbits ./venv/bin/pip install pylightning
sudo -u lnbits ./venv/bin/pip install secp256k1
sudo -u lnbits ./venv/bin/pip install pyln-client
sudo -u lnbits ./venv/bin/pip install psycopg2 # conv.py postgres migration dependency
# check if poetry in installed, if not install it
sudo -u lnbits which poetry || sudo -u lnbits curl -sSL https://install.python-poetry.org | sudo -u lnbits python3 -
# do install like this
sudo -u lnbits poetry install
# build
sudo -u lnbits ./venv/bin/python build.py
# restart lnbits service
sudo systemctl restart lnbits
echo "# server is restarting ... maybe takes some seconds until available"
@ -627,7 +622,7 @@ if [ "$1" = "install" ]; then
echo "# get the github code user(${githubUser}) branch(${tag})"
sudo rm -r /home/lnbits/lnbits 2>/dev/null
cd /home/lnbits || exit 1
sudo -u lnbits git clone https://github.com/${githubUser}/lnbits-legend lnbits
sudo -u lnbits git clone https://github.com/${githubUser}/lnbits lnbits
cd /home/lnbits/lnbits || exit 1
sudo -u lnbits git checkout ${tag} || exit 1
@ -635,16 +630,14 @@ if [ "$1" = "install" ]; then
echo "# installing application dependencies"
cd /home/lnbits/lnbits || exit 1
# check if poetry in installed, if not install it
if ! sudo -u lnbits which poetry; then
echo "# install poetry"
sudo pip3 install --upgrade pip
sudo pip3 install poetry
fi
# do install like this
sudo -u lnbits python3 -m venv venv
sudo -u lnbits ./venv/bin/pip install -r requirements.txt
sudo -u lnbits ./venv/bin/pip install pylightning
sudo -u lnbits ./venv/bin/pip install secp256k1
sudo -u lnbits ./venv/bin/pip install pyln-client
sudo -u lnbits ./venv/bin/pip install psycopg2 # conv.py postgres migration dependency
# build
sudo -u lnbits ./venv/bin/python build.py
sudo -u lnbits poetry install
exit 0
fi
@ -739,7 +732,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# preparing env file"
sudo rm /home/lnbits/lnbits/.env 2>/dev/null
sudo -u lnbits touch /home/lnbits/lnbits/.env
sudo bash -c "echo 'LNBITS_FORCE_HTTPS=0' >> /home/lnbits/lnbits/.env"
if [ ! -e /mnt/hdd/app-data/LNBits/database.sqlite3 ]; then
echo "# install database: PostgreSQL"
@ -789,7 +781,7 @@ After=bitcoind.service
[Service]
WorkingDirectory=/home/lnbits/lnbits
ExecStartPre=/home/admin/config.scripts/bonus.lnbits.sh prestart
ExecStart=/home/lnbits/lnbits/venv/bin/uvicorn lnbits.__main__:app --port 5000
ExecStart=/bin/sh -c 'cd /home/lnbits/lnbits && poetry run lnbits --port 5000'
User=lnbits
Restart=always
TimeoutSec=120
@ -1192,7 +1184,7 @@ if [ "$1" = "migrate" ]; then
sudo systemctl stop lnbits
echo "# Start convert old SQLite to new PostgreSQL"
if ! sudo -u lnbits ./venv/bin/python tools/conv.py; then
if ! sudo -u lnbits poetry run python tools/conv.py; then
echo "FAIL - Convert failed, revert migration process"
revertMigration
exit 1