This commit is contained in:
rootzoll 2022-06-20 17:43:49 +02:00
commit ee26fb48cb
3 changed files with 39 additions and 36 deletions

View File

@ -18,7 +18,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ];
fi
# check if started with sudo
if [ "$EUID" -ne 0 ]; then
if [ "$EUID" -ne 0 ]; then
echo "error='run as root'"
exit 1
fi
@ -46,21 +46,18 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# INSTALL Web API ..."
rm -r /root/blitz_api 2>/dev/null
cd /root
cd /root || exit 1
# git clone https://github.com/fusion44/blitz_api.git /root/blitz_api
git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git /root/blitz_api
if [ "$?" != "0"]; then
if ! git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git /root/blitz_api; then
echo "error='git clone failed'"
exit 1
fi
cd blitz_api
git checkout ${DEFAULT_GITHUB_BRANCH}
if [ "$?" != "0"]; then
cd blitz_api || exit 1
if ! git checkout ${DEFAULT_GITHUB_BRANCH}; then
echo "error='git checkout failed'"
exit 1
fi
pip install -r requirements.txt
if [ "$?" != "0"]; then
if ! pip install -r requirements.txt --no-deps; then
echo "error='pip install failed'"
exit 1
fi
@ -183,10 +180,13 @@ if [ "$1" = "update-config" ]; then
# configure CL
elif [ "${lightning}" == "cl" ]; then
echo "# CONFIG Web API Lightning --> CL"
sed -i "s/^ln_node=.*/ln_node=cln_grpc/g" ./.env
# make sure cln-grpc is on
/home/admin/config.scripts/cl-plugin.cln-grpc.sh on mainnet
# get hex values of pem files
hexClient=$(xxd -p -c2000 /home/bitcoin/.lightning/bitcoin/client.pem)
hexClientKey=$(xxd -p -c2000 /home/bitcoin/.lightning/bitcoin/client-key.pem)

View File

@ -41,17 +41,14 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# INSTALL WebUI"
rm -r /root/blitz_web 2>/dev/null
rm -r /root/${DEFAULT_GITHUB_REPO} 2>/dev/null
cd /root
# git clone https://github.com/cstenglein/raspiblitz-web.git /home/admin/blitz_web
git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git /root/blitz_web
if [ "$?" != "0"]; then
cd /root || exit 1
if ! git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git; then
echo "error='git clone failed'"
exit 1
fi
mv /root/${DEFAULT_GITHUB_REPO} /root/blitz_web
cd blitz_web
git checkout ${DEFAULT_GITHUB_BRANCH}
if [ "$?" != "0"]; then
cd blitz_web || exit 1
if ! git checkout ${DEFAULT_GITHUB_BRANCH}; then
echo "error='git checkout failed'"
exit 1
fi
@ -59,19 +56,16 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# Compile WebUI"
/home/admin/config.scripts/bonus.nodejs.sh on
source <(/home/admin/config.scripts/bonus.nodejs.sh info)
npm install --global yarn
if [ "$?" != "0"]; then
if ! npm install --global yarn; then
echo "error='install yarn failed'"
exit 1
fi
${NODEPATH}/yarn config set --home enableTelemetry 0
${NODEPATH}/yarn install
if [ "$?" != "0"]; then
if ! ${NODEPATH}/yarn install; then
echo "error='yarn install failed'"
exit 1
fi
${NODEPATH}/yarn build
if [ "$?" != "0"]; then
if ! ${NODEPATH}/yarn build; then
echo "error='yarn build failed'"
exit 1
fi

View File

@ -36,7 +36,7 @@ function buildGRPCplugin() {
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo build \
--target-dir /home/bitcoin/cl-plugins-available/cln-grpc
else
echo "# - cln-grpc plugin already build/installed"
echo "# - cln-grpc plugin was already built/installed"
fi
}
@ -53,21 +53,30 @@ elif [ "$1" = status ]; then
exit 0
elif [ "$1" = on ]; then
buildGRPCplugin
if ! "$lightningcli_alias" plugin list | grep "/home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc"; 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/
echo "# cln-grpc moved to /home/bitcoin/${netprefix}cl-plugins-enabled/"
# symlink to plugin directory
sudo ln -s /home/bitcoin/cl-plugins-available/cln-grpc/debug/cln-grpc /home/bitcoin/${netprefix}cl-plugins-enabled/
echo "# cln-grpc moved to /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}clnGRPCport" "${PORT}"
# 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}clnGRPCport" "${PORT}"
# firewall
sudo ufw allow "${PORT}" comment "${netprefix}clnGRPCport"
# Tor
/home/admin/config.scripts/tor.onion-service.sh "${netprefix}clnGRPCport" "${PORT}" "${PORT}"
echo "# cl-plugin.cln-grpc.sh on --> done"
# firewall
sudo ufw allow "${PORT}" comment "${netprefix}clnGRPCport"
# Tor
/home/admin/config.scripts/tor.onion-service.sh "${netprefix}clnGRPCport" "${PORT}" "${PORT}"
source <(/home/admin/_cache.sh get state)
if [ "${state}" == "ready" ]; then
sudo systemctl restart ${netprefix}lightningd
fi
echo "# cl-plugin.cln-grpc.sh on --> done"
else
echo "# cl-plugin.cln-grpc.sh on --> already installed and running"
fi
exit 0
elif [ "$1" = off ]; then