mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-19 01:40:16 +01:00
add the cln-grpc plugin (#3109)
* add cln-grpc plugin * set firewall, Tor and move rust install * build the cln-grpc as part of the fatpack option * add to CHANGES
This commit is contained in:
parent
55df916305
commit
539afe9882
@ -4,6 +4,7 @@
|
||||
|
||||
- New: WebUI
|
||||
- New: BackendAPI
|
||||
- New: Core Lightning GRPC plugin [details](https://github.com/rootzoll/raspiblitz/pull/3109)
|
||||
- Update: Bitcoin Core v23.0 [details](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-23.0.md)
|
||||
- Update: Core Lightning (CLN - formerly C-lightning) v0.11.0.1 [details](https://github.com/ElementsProject/lightning/releases/tag/v0.11.0.1)
|
||||
- Update: LND v0.14.3 [details](https://github.com/lightningnetwork/lnd/releases/tag/v0.14.3-beta)
|
||||
|
@ -751,11 +751,13 @@ if ${fatpack}; then
|
||||
echo "* Optional Packages (may be needed for extended features)"
|
||||
sudo apt install -y qrencode secure-delete fbi ssmtp unclutter xterm python3-pyqt5 xfonts-terminus apache2-utils nginx python3-jinja2 socat libatlas-base-dev hexyl autossh
|
||||
|
||||
echo "* Adding lnd ..."
|
||||
echo "* Adding LND ..."
|
||||
/home/admin/config.scripts/lnd.install.sh install || exit 1
|
||||
|
||||
echo "* Adding c-lightning ..."
|
||||
echo "* Adding Core Lightning ..."
|
||||
/home/admin/config.scripts/cl.install.sh install || exit 1
|
||||
echo "* Adding the cln-grpc plugin ..."
|
||||
/home/admin/config.scripts/cl-plugin.cln-grpc.sh install || exit 1
|
||||
|
||||
# *** UPDATE FALLBACK NODE LIST (only as part of fatpack) *** see https://github.com/rootzoll/raspiblitz/issues/1888
|
||||
echo "*** FALLBACK NODE LIST ***"
|
||||
|
72
home.admin/config.scripts/cl-plugin.cln-grpc.sh
Normal file
72
home.admin/config.scripts/cl-plugin.cln-grpc.sh
Normal file
@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
|
||||
echo
|
||||
echo "Install the cln-grpc plugin for CLN"
|
||||
echo "Usage:"
|
||||
echo "cl-plugin.cln-grpc.sh install - called by build_sdcard.sh"
|
||||
echo "cl-plugin.cln-grpc.sh [on|off] <testnet|mainnet|signet>"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
|
||||
|
||||
# netprefix is: "" | t | s
|
||||
# portprefix is: "" | 1 | 3
|
||||
PORT="${portprefix}4772"
|
||||
|
||||
function buildGRPCplugin() {
|
||||
echo "- build the cln-grpc plugin"
|
||||
if [ ! -f /home/bitcoin/cl-plugins-available/cln-grpc/debug/cln-grpc ]; then
|
||||
# check if the source code is present
|
||||
if [ ! -d /home/bitcoin/lightning/plugins/grpc-plugin ];then
|
||||
echo "* Adding c-lightning ..."
|
||||
/home/admin/config.scripts/cl.install.sh install || exit 1
|
||||
fi
|
||||
# rust for cln-grpc, includes rustfmt
|
||||
sudo -u bitcoin curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||
sudo -u bitcoin sh -s -- -y
|
||||
cd /home/bitcoin/lightning/plugins/grpc-plugin || exit 1
|
||||
# build
|
||||
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo build \
|
||||
--target-dir /home/bitcoin/cl-plugins-available/cln-grpc
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" = install ]; then
|
||||
buildGRPCplugin
|
||||
exit 0
|
||||
|
||||
elif [ "$1" = on ]; then
|
||||
buildGRPCplugin
|
||||
|
||||
# symlink to plugin directory
|
||||
sudo ln -s /home/bitcoin/cl-plugins-available/cln-grpc/debug/cln-grpc \
|
||||
/home/bitcoin/${netprefix}cl-plugins-enabled/
|
||||
|
||||
# blitz.conf.sh set [key] [value] [?conffile] <noquotes>
|
||||
/home/admin/config.scripts/blitz.conf.sh set grpc-port "${PORT}" "${CLCONF}" noquotes
|
||||
/home/admin/config.scripts/blitz.conf.sh set "${netprefix}cln-grpc-port" "${PORT}"
|
||||
|
||||
# firewall
|
||||
sudo ufw allow "${PORT}" comment "${netprefix}cln-grpc-port"
|
||||
# Tor
|
||||
/home/admin/config.scripts/tor.onion-service.sh "${netprefix}cln-grpc-port" "${PORT}" "${PORT}"
|
||||
exit 0
|
||||
|
||||
elif [ "$1" = off ]; then
|
||||
sed -i "/^grpc-port/d" "${CLCONF}"
|
||||
rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}cln-grpc-port "off"
|
||||
# firewall
|
||||
sudo ufw deny "${PORT}" comment "cln-grpc-port"
|
||||
# Tor
|
||||
/home/admin/config.scripts/tor.onion-service.sh off ${netprefix}cln-grpc-port
|
||||
exit 0
|
||||
|
||||
else
|
||||
echo "FAIL - Unknown Parameter $1"
|
||||
exit 1
|
||||
fi
|
@ -37,7 +37,6 @@ if [ $(grep -c "^sparko" < ${CLCONF}) -gt 0 ];then
|
||||
echo "# The Sparko plugin is not present but in config"
|
||||
sed -i "/^sparko/d" ${CLCONF}
|
||||
rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/sparko
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}sparko "off"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -47,7 +46,6 @@ if [ $(grep -c "^http-pass" < ${CLCONF}) -gt 0 ];then
|
||||
echo "# The clHTTPplugin is not present but in config"
|
||||
sed -i "/^http-pass/d" ${CLCONF}
|
||||
rm -rf /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin
|
||||
/home/admin/config.scripts/blitz.conf.sh set clHTTPplugin "off"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -57,7 +55,6 @@ if [ $(grep -c "^feeadjuster" < ${CLCONF}) -gt 0 ];then
|
||||
echo "# The feeadjuster plugin is not present but in config"
|
||||
sed -i "/^feeadjuster/d" ${CLCONF}
|
||||
rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/feeadjuster.py
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}feeadjuster "off"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -66,4 +63,13 @@ if [ "${LNBitsFunding}" = "${netprefix}cl" ]; then
|
||||
if [ $(grep -c "^rpc-file-mode=0660" < ${CLCONF}) -eq 0 ]; then
|
||||
echo "rpc-file-mode=0660" | tee -a ${CLCONF}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $(grep -c "^grpc-port" < ${CLCONF}) -gt 0 ];then
|
||||
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc ]\
|
||||
|| [ "$(eval echo \$${netprefix}cln-grpc-port)" = "off" ]; then
|
||||
echo "# The cln-grpc plugin is not present but in config"
|
||||
sed -i "/^grpc-port/d" ${CLCONF}
|
||||
rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc
|
||||
fi
|
||||
fi
|
||||
|
@ -44,8 +44,6 @@ function installDependencies()
|
||||
gettext
|
||||
# additional requirements
|
||||
sudo apt-get install -y postgresql libpq-dev
|
||||
# rust for cln-grpc, includes rustfmt
|
||||
sudo -u bitcoin curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u bitcoin sh -s -- -y
|
||||
# mrkd and mistune needs to be globally available for the build
|
||||
sudo pip3 install mrkd==0.2.0
|
||||
sudo pip3 install mistune==0.8.4
|
||||
@ -381,8 +379,21 @@ alias ${netprefix}clconf=\"sudo\
|
||||
echo "${netprefix}lightning-cli help"
|
||||
echo
|
||||
|
||||
# setting value in the raspiblitz.conf
|
||||
# setting values in the raspiblitz.conf
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}cl on
|
||||
# blitz.conf.sh needs sudo access - cannot be run in cl.check.sh
|
||||
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/sparko ];then
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}sparko "off"
|
||||
fi
|
||||
if [ ! -f /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin ];then
|
||||
/home/admin/config.scripts/blitz.conf.sh set clHTTPplugin "off"
|
||||
fi
|
||||
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/feeadjuster.py ]; then
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}feeadjuster "off"
|
||||
fi
|
||||
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc ];then
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}cln-grpc "off"
|
||||
fi
|
||||
|
||||
# if this is the first lightning mainnet turned on - make default
|
||||
if [ "${CHAIN}" == "mainnet" ] && [ "${lightning}" == "" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user