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 fi
# check if started with sudo # check if started with sudo
if [ "$EUID" -ne 0 ]; then if [ "$EUID" -ne 0 ]; then
echo "error='run as root'" echo "error='run as root'"
exit 1 exit 1
fi fi
@ -46,21 +46,18 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# INSTALL Web API ..." echo "# INSTALL Web API ..."
rm -r /root/blitz_api 2>/dev/null 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/fusion44/blitz_api.git /root/blitz_api
git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git /root/blitz_api if ! git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git /root/blitz_api; then
if [ "$?" != "0"]; then
echo "error='git clone failed'" echo "error='git clone failed'"
exit 1 exit 1
fi fi
cd blitz_api cd blitz_api || exit 1
git checkout ${DEFAULT_GITHUB_BRANCH} if ! git checkout ${DEFAULT_GITHUB_BRANCH}; then
if [ "$?" != "0"]; then
echo "error='git checkout failed'" echo "error='git checkout failed'"
exit 1 exit 1
fi fi
pip install -r requirements.txt if ! pip install -r requirements.txt --no-deps; then
if [ "$?" != "0"]; then
echo "error='pip install failed'" echo "error='pip install failed'"
exit 1 exit 1
fi fi
@ -183,10 +180,13 @@ if [ "$1" = "update-config" ]; then
# configure CL # configure CL
elif [ "${lightning}" == "cl" ]; then elif [ "${lightning}" == "cl" ]; then
echo "# CONFIG Web API Lightning --> CL" echo "# CONFIG Web API Lightning --> CL"
sed -i "s/^ln_node=.*/ln_node=cln_grpc/g" ./.env 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 # get hex values of pem files
hexClient=$(xxd -p -c2000 /home/bitcoin/.lightning/bitcoin/client.pem) hexClient=$(xxd -p -c2000 /home/bitcoin/.lightning/bitcoin/client.pem)
hexClientKey=$(xxd -p -c2000 /home/bitcoin/.lightning/bitcoin/client-key.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" echo "# INSTALL WebUI"
rm -r /root/blitz_web 2>/dev/null rm -r /root/blitz_web 2>/dev/null
rm -r /root/${DEFAULT_GITHUB_REPO} 2>/dev/null rm -r /root/${DEFAULT_GITHUB_REPO} 2>/dev/null
cd /root cd /root || exit 1
# git clone https://github.com/cstenglein/raspiblitz-web.git /home/admin/blitz_web if ! git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git; then
git clone https://github.com/${DEFAULT_GITHUB_USER}/${DEFAULT_GITHUB_REPO}.git /root/blitz_web
if [ "$?" != "0"]; then
echo "error='git clone failed'" echo "error='git clone failed'"
exit 1 exit 1
fi fi
mv /root/${DEFAULT_GITHUB_REPO} /root/blitz_web mv /root/${DEFAULT_GITHUB_REPO} /root/blitz_web
cd blitz_web cd blitz_web || exit 1
git checkout ${DEFAULT_GITHUB_BRANCH} if ! git checkout ${DEFAULT_GITHUB_BRANCH}; then
if [ "$?" != "0"]; then
echo "error='git checkout failed'" echo "error='git checkout failed'"
exit 1 exit 1
fi fi
@ -59,19 +56,16 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# Compile WebUI" echo "# Compile WebUI"
/home/admin/config.scripts/bonus.nodejs.sh on /home/admin/config.scripts/bonus.nodejs.sh on
source <(/home/admin/config.scripts/bonus.nodejs.sh info) source <(/home/admin/config.scripts/bonus.nodejs.sh info)
npm install --global yarn if ! npm install --global yarn; then
if [ "$?" != "0"]; then
echo "error='install yarn failed'" echo "error='install yarn failed'"
exit 1 exit 1
fi fi
${NODEPATH}/yarn config set --home enableTelemetry 0 ${NODEPATH}/yarn config set --home enableTelemetry 0
${NODEPATH}/yarn install if ! ${NODEPATH}/yarn install; then
if [ "$?" != "0"]; then
echo "error='yarn install failed'" echo "error='yarn install failed'"
exit 1 exit 1
fi fi
${NODEPATH}/yarn build if ! ${NODEPATH}/yarn build; then
if [ "$?" != "0"]; then
echo "error='yarn build failed'" echo "error='yarn build failed'"
exit 1 exit 1
fi fi

View File

@ -36,7 +36,7 @@ function buildGRPCplugin() {
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo build \ sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo build \
--target-dir /home/bitcoin/cl-plugins-available/cln-grpc --target-dir /home/bitcoin/cl-plugins-available/cln-grpc
else else
echo "# - cln-grpc plugin already build/installed" echo "# - cln-grpc plugin was already built/installed"
fi fi
} }
@ -53,21 +53,30 @@ elif [ "$1" = status ]; then
exit 0 exit 0
elif [ "$1" = on ]; then 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 # symlink to plugin directory
sudo ln -s /home/bitcoin/cl-plugins-available/cln-grpc/debug/cln-grpc /home/bitcoin/${netprefix}cl-plugins-enabled/ 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/" echo "# cln-grpc moved to /home/bitcoin/${netprefix}cl-plugins-enabled/"
# blitz.conf.sh set [key] [value] [?conffile] <noquotes> # 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 "grpc-port" "${PORT}" "${CLCONF}" "noquotes"
/home/admin/config.scripts/blitz.conf.sh set "${netprefix}clnGRPCport" "${PORT}" /home/admin/config.scripts/blitz.conf.sh set "${netprefix}clnGRPCport" "${PORT}"
# firewall # firewall
sudo ufw allow "${PORT}" comment "${netprefix}clnGRPCport" sudo ufw allow "${PORT}" comment "${netprefix}clnGRPCport"
# Tor # Tor
/home/admin/config.scripts/tor.onion-service.sh "${netprefix}clnGRPCport" "${PORT}" "${PORT}" /home/admin/config.scripts/tor.onion-service.sh "${netprefix}clnGRPCport" "${PORT}" "${PORT}"
echo "# cl-plugin.cln-grpc.sh on --> done" 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 exit 0
elif [ "$1" = off ]; then elif [ "$1" = off ]; then