From f80fc78d27feb8cb49fec8b0adad652733b74877 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Sat, 27 Jun 2020 21:12:54 -0500 Subject: [PATCH] Add LNbits --- .../etc/systemd/system/lnbits.service | 3 +- .../standard/usr/bin/mynode_post_upgrade.sh | 54 ++++++++++-------- rootfs/standard/usr/bin/mynode_startup.sh | 4 ++ rootfs/standard/usr/share/mynode/lnbits.env | 46 +++++++++++++++ .../www/mynode/enable_disable_functions.py | 10 ++++ rootfs/standard/var/www/mynode/mynode.py | 23 ++++++++ rootfs/standard/var/www/mynode/settings.py | 4 ++ .../var/www/mynode/static/images/lnbits.png | Bin 0 -> 6540 bytes .../www/mynode/templates/includes/apps.html | 20 +++++++ .../var/www/mynode/templates/main.html | 9 +++ .../var/www/mynode/templates/status.html | 14 +++++ setup/setup_device.sh | 33 +++++++++++ 12 files changed, 193 insertions(+), 27 deletions(-) create mode 100644 rootfs/standard/usr/share/mynode/lnbits.env create mode 100644 rootfs/standard/var/www/mynode/static/images/lnbits.png diff --git a/rootfs/standard/etc/systemd/system/lnbits.service b/rootfs/standard/etc/systemd/system/lnbits.service index f55100d4..5f114c28 100644 --- a/rootfs/standard/etc/systemd/system/lnbits.service +++ b/rootfs/standard/etc/systemd/system/lnbits.service @@ -12,8 +12,7 @@ ExecStartPre=/usr/bin/wait_on_lnd.sh Environment=FLASK_ENV=development WorkingDirectory=/opt/mynode/lnbits -#ExecStart=/usr/local/bin/pipenv run flask run --host 0.0.0.0 -ExecStart=/bin/sh -c 'cd /opt/mynode/lnbits && /usr/local/bin/pipenv --python 3.7 run flask run --host 0.0.0.0' +ExecStart=/bin/sh -c 'cd /opt/mynode/lnbits && /usr/local/bin/pipenv run flask run --host 0.0.0.0' #ExecStart=/bin/sh -c 'cd /opt/mynode/lnbits && python3 /usr/local/bin/pipenv --python 3.7 run gunicorn -b :5000 lnbits:app -k gevent' User=bitcoin diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index 747a0821..79da6b1b 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -15,7 +15,7 @@ date rm -rf /var/log/* # Create any necessary users -sudo adduser --disabled-password --gecos "" lnbits || true + # Check if upgrades use tor TORIFY="" @@ -450,32 +450,36 @@ fi # Upgrade LNBits -# LNBITS_UPGRADE_URL=https://github.com/lnbits/lnbits/archive/raspiblitz.tar.gz -# LNBITS_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lnbits_url -# CURRENT="" -# if [ -f $LNBITS_UPGRADE_URL_FILE ]; then -# CURRENT=$(cat $LNBITS_UPGRADE_URL_FILE) -# fi -# if [ "$CURRENT" != "$LNBITS_UPGRADE_URL" ]; 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 +LNBITS_UPGRADE_URL=https://github.com/lnbits/lnbits/archive/raspiblitz.tar.gz +LNBITS_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lnbits_url +CURRENT="" +if [ -f $LNBITS_UPGRADE_URL_FILE ]; then + CURRENT=$(cat $LNBITS_UPGRADE_URL_FILE) +fi +if [ "$CURRENT" != "$LNBITS_UPGRADE_URL" ]; 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 -# # Install with python 3.7 (Only use "pipenv install --python 3.7" once or it will rebuild the venv!) -# sudo -u bitcoin pipenv --python 3.7 install --dev -# sudo -u bitcoin pipenv run pip install python-dotenv -# sudo -u bitcoin pipenv run pip install -r requirements.txt -# sudo -u bitcoin pipenv run pip install lnd-grpc -# sudo -u bitcoin pipenv run flask migrate || true + # Copy over config file + cp /usr/share/mynode/lnbits.env /opt/mynode/lnbits/.env + chown bitcoin:bitcoin /opt/mynode/lnbits/.env -# mkdir -p /home/bitcoin/.mynode/ -# chown -R bitcoin:bitcoin /home/bitcoin/.mynode/ -# echo $LNBITS_UPGRADE_URL > $LNBITS_UPGRADE_URL_FILE -# fi + # Install with python 3.7 (Only use "pipenv install --python 3.7" once or it will rebuild the venv!) + sudo -u bitcoin pipenv --python 3.7 install + sudo -u bitcoin pipenv run pip install python-dotenv + sudo -u bitcoin pipenv run pip install -r requirements.txt + sudo -u bitcoin pipenv run pip install lnd-grpc + sudo -u bitcoin pipenv run flask migrate + + mkdir -p /home/bitcoin/.mynode/ + chown -R bitcoin:bitcoin /home/bitcoin/.mynode/ + echo $LNBITS_UPGRADE_URL > $LNBITS_UPGRADE_URL_FILE +fi # Install LND Connect diff --git a/rootfs/standard/usr/bin/mynode_startup.sh b/rootfs/standard/usr/bin/mynode_startup.sh index dbba1b48..bf037a38 100755 --- a/rootfs/standard/usr/bin/mynode_startup.sh +++ b/rootfs/standard/usr/bin/mynode_startup.sh @@ -251,6 +251,10 @@ chown bitcoin:bitcoin /opt/mynode/RTL/RTL-Config.json cp /usr/share/mynode/btc_rpc_explorer_env /opt/mynode/btc-rpc-explorer/.env chown bitcoin:bitcoin /opt/mynode/btc-rpc-explorer/.env +# LNBits Config +cp /usr/share/mynode/lnbits.env /opt/mynode/lnbits/.env +chown bitcoin:bitcoin /opt/mynode/lnbits/.env + # Update files that need RPC password (needed if upgrades overwrite files) PW=$(cat /mnt/hdd/mynode/settings/.btcrpcpw) diff --git a/rootfs/standard/usr/share/mynode/lnbits.env b/rootfs/standard/usr/share/mynode/lnbits.env new file mode 100644 index 00000000..432d10ee --- /dev/null +++ b/rootfs/standard/usr/share/mynode/lnbits.env @@ -0,0 +1,46 @@ +FLASK_APP=lnbits +FLASK_ENV=production + +LNBITS_SITE_TITLE=LNbits +LNBITS_ALLOWED_USERS="all" +LNBITS_DEFAULT_WALLET_NAME="LNbits wallet" +LNBITS_DATA_FOLDER="/mnt/hdd/mynode/lnbits" +LNBITS_DISABLED_EXTENSIONS="amilk,events" +LNBITS_FORCE_HTTPS=0 +LNBITS_SERVICE_FEE="0.0" + +# Choose from LNPayWallet, OpenNodeWallet, LntxbotWallet, LndWallet, CLightningWallet, LnbitsWallet +LNBITS_BACKEND_WALLET_CLASS=LndWallet + +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="HEXSTRING" +LND_REST_INVOICE_MACAROON="HEXSTRING" +LND_REST_READ_MACAROON="HEXSTRING" + +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 \ No newline at end of file diff --git a/rootfs/standard/var/www/mynode/enable_disable_functions.py b/rootfs/standard/var/www/mynode/enable_disable_functions.py index 9a13414a..d03a1121 100644 --- a/rootfs/standard/var/www/mynode/enable_disable_functions.py +++ b/rootfs/standard/var/www/mynode/enable_disable_functions.py @@ -53,6 +53,16 @@ def disable_rtl(): os.system("systemctl disable rtl --no-pager") +def is_lnbits_enabled(): + return is_service_enabled("lnbits") +def enable_lnbits(): + os.system("systemctl enable lnbits --no-pager") + os.system("systemctl start lnbits --no-pager") +def disable_lnbits(): + os.system("systemctl stop lnbits --no-pager") + os.system("systemctl disable lnbits --no-pager") + + def is_btcrpcexplorer_enabled(): if os.path.isfile(BTCRPCEXPLORER_ENABLED_FILE): return True diff --git a/rootfs/standard/var/www/mynode/mynode.py b/rootfs/standard/var/www/mynode/mynode.py index 435706b0..aeddc6d6 100644 --- a/rootfs/standard/var/www/mynode/mynode.py +++ b/rootfs/standard/var/www/mynode/mynode.py @@ -266,6 +266,8 @@ def index(): lnd_ready = is_lnd_ready() rtl_status_color = "gray" rtl_status = "Lightning Wallet" + lnbits_status_color = "gray" + lnbits_status = "Lightning Wallet" electrs_status_color = "gray" electrs_active = is_electrs_active() lndhub_status_color = "gray" @@ -378,6 +380,15 @@ def index(): else: rtl_status_color = "green" + # Find LNbits status + if lnd_ready: + if is_lnbits_enabled(): + status_code = get_service_status_code("lnbits") + if status_code != 0: + lnbits_status_color = "red" + else: + lnbits_status_color = "green" + # Find electrs status if is_electrs_enabled(): status_code = get_service_status_code("electrs") @@ -489,6 +500,9 @@ def index(): "rtl_status_color": rtl_status_color, "rtl_status": rtl_status, "rtl_enabled": is_rtl_enabled(), + "lnbits_status_color": lnbits_status_color, + "lnbits_status": lnbits_status, + "lnbits_enabled": is_lnbits_enabled(), "lndhub_status_color": lndhub_status_color, "lndhub_enabled": is_lndhub_enabled(), "explorer_ready": explorer_ready, @@ -610,6 +624,15 @@ def page_toggle_rtl(): enable_rtl() return redirect("/") +@app.route("/toggle-lnbits") +def page_toggle_lnbits(): + check_logged_in() + if is_lnbits_enabled(): + disable_lnbits() + else: + enable_lnbits() + return redirect("/") + @app.route("/toggle-btcrpcexplorer") def page_toggle_btcrpcexplorer(): check_logged_in() diff --git a/rootfs/standard/var/www/mynode/settings.py b/rootfs/standard/var/www/mynode/settings.py index 1d0c46b0..fd1ff61a 100644 --- a/rootfs/standard/var/www/mynode/settings.py +++ b/rootfs/standard/var/www/mynode/settings.py @@ -217,6 +217,7 @@ def page_status(): electrs_status_log = get_journalctl_log("electrs") netdata_status_log = get_journalctl_log("netdata") rtl_status_log = get_journalctl_log("rtl") + lnbits_status_log = get_journalctl_log("lnbits") docker_status_log = get_journalctl_log("docker") docker_image_build_status_log = get_journalctl_log("docker_images") @@ -273,6 +274,9 @@ def page_status(): "rtl_status_log": rtl_status_log, "rtl_status": get_service_status_basic_text("rtl"), "rtl_status_color": get_service_status_color("rtl"), + "lnbits_status_log": lnbits_status_log, + "lnbits_status": get_service_status_basic_text("lnbits"), + "lnbits_status_color": get_service_status_color("lnbits"), "docker_status_log": docker_status_log, "docker_status": get_service_status_basic_text("docker"), "docker_status_color": get_service_status_color("docker"), diff --git a/rootfs/standard/var/www/mynode/static/images/lnbits.png b/rootfs/standard/var/www/mynode/static/images/lnbits.png new file mode 100644 index 0000000000000000000000000000000000000000..0f28714c65fd364f97f92e044be2208cb243c9d7 GIT binary patch literal 6540 zcmX|GWmr_-*QFUjWI#fY7+_Fo1eA_}K~hQSZbT$y9AIdqVE})0sURsGLwA=*cQ*`5 z49&db|HJ#?-uv8j_Otdr=bp39+51LlzEPqeV@Ek8#fR{PgdjuSC#u)>AEY80kBAuG1n^cZ_+UMr zwvLKtB&!RZ`<=Oj^ zRW5xQ*pW1B^3gzQ_K?q5V^=D9u>7-VAQ>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SoAp0~73jO`aJSJuJD%XXJ2 zIr3!)O21Uup$C07t%iry4=BN+iB-YPOfv5 zb#h&HA+;;TbWM7&Mk!HTn+-qqYOD+U+h1;getJ&y^NvNSb0nj>TTRh7o$vPyFIO5z@J3FuFXJwr1lW!Mo3}{MLk8UB5woAtQyKP|s581o-Yk+1 z#v&)1-m7T{N6$*`rd6`Uh428b&TqkoTV+eQy5A-)ado}^Ks|0;Y(6u7aX|Ummyk-D zI>zyyA<)zEBbi2l+e+0UQ_yr$rjZc@s2nZ%Fy{?uW0G~ewWhRay=Gd$W=)1Vh*ngH z3%n`LV<&x9p_^k8f~yEEBViWUyPo9*ms2nBO)%p_3_vLD>96hg&sjd1w+&+oa^X=c z-1KVkeOfLvC*Pa5MWvt9JhJI#d{-hC6s?!x*LjfF&?`f8ti2MfNasePZqD-VuJcwp zR=62e1r4TELXPp8-LA~GD7XON^7%q}pQr)>Y-n{0-#}zt*;kkC&xqFo(zfS&ho}>1 z)JL58M1o&Vkj~{6~wUuzUzLEUOT=_~a1h zQ%_^PTF)pK3=0xOh#A=EooGGW(SA@|3im9VC#aE*VTIDoCyk`GMR&UD>;p39 zOtwUa&p&*WmKIm7yiWkp7!+UM_AlO_y@J8o5|BF3f`n6C1XMPEw(Uy|MWtbr8bnfm z)p6-WAHC<)3r`mxbhO*~OaE}%?2~Ti0UDc-l*A4`P5ws1=bff{+++KnT>8i{T*}4RlHp=y00rKxK8nudFY)F=;Hlc&MiVi|U-8m)a1@sJZZdtX_Ij zk`75%&H;%~os5gSSG-E(pQ4E*W+2vXk>`0>>;aTFEbQP_ED{tB1_KxZks(lJc~F-E zJ@!6%0)QA0vH+In4+0;)bcyRetV^MizqNz;WDBeuxL?L(dL79%_Rr2e258KZzplQ* d;(n}Pu@Y=W3u!VU1GpDF6~#BuQhAG@{{yP6zg++T literal 0 HcmV?d00001 diff --git a/rootfs/standard/var/www/mynode/templates/includes/apps.html b/rootfs/standard/var/www/mynode/templates/includes/apps.html index b63c087c..92975c49 100644 --- a/rootfs/standard/var/www/mynode/templates/includes/apps.html +++ b/rootfs/standard/var/www/mynode/templates/includes/apps.html @@ -163,4 +163,24 @@ {% endif %} +
+
+ +
LNbits
+
{% if not lnd_ready %}Waiting on LND...{% else %}{{ lnbits_status }}{% endif %}
+
+ {% if product_key_skipped %} + Premium Feature + {% else %} + {% if lnd_ready %} + {% if lnbits_enabled %} + LNbits + Disable + {% else %} + Enable + {% endif %} + {% endif %} + {% endif %} +
+
\ No newline at end of file diff --git a/rootfs/standard/var/www/mynode/templates/main.html b/rootfs/standard/var/www/mynode/templates/main.html index 233b6b99..e50c1eb7 100644 --- a/rootfs/standard/var/www/mynode/templates/main.html +++ b/rootfs/standard/var/www/mynode/templates/main.html @@ -23,6 +23,11 @@ window.open(url,'_blank'); }) + $("#lnbits").on("click", function() { + url = 'http://'+location.hostname+':5000' + window.open(url,'_blank'); + }) + $("#lnd_admin").on("click", function() { url = 'http://'+location.hostname+':3004' window.open(url,'_blank'); @@ -103,6 +108,10 @@ window.location.href="/toggle-caravan" }); + $("#toggle-lnbits").on("click", function() { + window.location.href="/toggle-lnbits" + }); + function lndconnect() { $("#lndconnect_form").submit(); lndconnect_dialog.dialog( "close" ); diff --git a/rootfs/standard/var/www/mynode/templates/status.html b/rootfs/standard/var/www/mynode/templates/status.html index 39fee733..4958bb37 100644 --- a/rootfs/standard/var/www/mynode/templates/status.html +++ b/rootfs/standard/var/www/mynode/templates/status.html @@ -51,6 +51,11 @@ $("#rtl_status").show(); }); + $("#show_lnbits_status").on("click", function() { + $("#show_lnbits_status").hide(0); + $("#lnbits_status").show(); + }); + $("#show_docker_status").on("click", function() { $("#show_docker_status").hide(0); $("#docker_status").show(); @@ -335,6 +340,15 @@
+
LNbits Status
+
+
+ {{ lnbits_status }} +
+ + +
+
Docker Status
diff --git a/setup/setup_device.sh b/setup/setup_device.sh index e1a235ff..85966ba6 100755 --- a/setup/setup_device.sh +++ b/setup/setup_device.sh @@ -550,6 +550,39 @@ if [ "$CURRENT" != "$BTCRPCEXPLORER_UPGRADE_URL" ]; then fi +# Install LNBits +LNBITS_UPGRADE_URL=https://github.com/lnbits/lnbits/archive/raspiblitz.tar.gz +LNBITS_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lnbits_url +CURRENT="" +if [ -f $LNBITS_UPGRADE_URL_FILE ]; then + CURRENT=$(cat $LNBITS_UPGRADE_URL_FILE) +fi +if [ "$CURRENT" != "$LNBITS_UPGRADE_URL" ]; 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 with python 3.7 (Only use "pipenv install --python 3.7" once or it will rebuild the venv!) + sudo -u bitcoin pipenv --python 3.7 install + sudo -u bitcoin pipenv run pip install python-dotenv + sudo -u bitcoin pipenv run pip install -r requirements.txt + sudo -u bitcoin pipenv run pip install lnd-grpc + sudo -u bitcoin pipenv run flask migrate + + mkdir -p /home/bitcoin/.mynode/ + chown -R bitcoin:bitcoin /home/bitcoin/.mynode/ + echo $LNBITS_UPGRADE_URL > $LNBITS_UPGRADE_URL_FILE +fi + + # Install LND Connect LNDCONNECTARCH="lndconnect-linux-armv7" if [ $IS_X86 = 1 ]; then