From 7eafde853236bd61422639d3e341ef935118f200 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Sat, 21 Jan 2023 00:12:21 -0600 Subject: [PATCH] Change LndBoss install process --- .../share/mynode_apps/lndboss/lndboss.service | 13 +++++++---- .../lndboss/scripts/install_lndboss.sh | 21 ++++++++++------- .../lndboss/scripts/pre_lndboss.sh | 23 ++++++++++++++++++- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/rootfs/standard/usr/share/mynode_apps/lndboss/lndboss.service b/rootfs/standard/usr/share/mynode_apps/lndboss/lndboss.service index c637a9f4..6a2a63a0 100644 --- a/rootfs/standard/usr/share/mynode_apps/lndboss/lndboss.service +++ b/rootfs/standard/usr/share/mynode_apps/lndboss/lndboss.service @@ -9,18 +9,21 @@ After=www.service docker_images.service [Service] WorkingDirectory=/opt/mynode/lndboss +EnvironmentFile=-/mnt/hdd/mynode/lndboss/env + ExecStartPre=/usr/bin/is_not_shutting_down.sh -ExecStartPre=+/bin/bash -c 'if [ -f /usr/bin/service_scripts/pre_lndboss.sh ]; then /bin/bash /usr/bin/service_scripts/pre_lndboss.sh; fi' +ExecStartPre=/bin/bash -c 'if [ -f /usr/bin/service_scripts/pre_lndboss.sh ]; then /bin/bash /usr/bin/service_scripts/pre_lndboss.sh; fi' ExecStart=/usr/bin/docker run --rm \ --name lndboss \ --publish 8055:8055 \ - --env BOS_DATA_PATH="/root/.bosgui" \ - --env LNDBOSS_DIRECTORY="/root/.bosgui" \ + --env BOS_DATA_PATH="/.bosgui" \ + --env LNDBOSS_DIRECTORY="/.bosgui" \ --env NODE_ENV="production" \ --env PORT="8055" \ --env BOS_DEFAULT_LND_SOCKET="host.docker.internal:10009" \ - --volume /mnt/hdd/mynode/lndboss/:/root/.bosgui \ - --volume /mnt/hdd/mynode/lnd/:/root/.lnd \ + --user ${UID}:${GID} \ + --volume /mnt/hdd/mynode/lndboss:/.bosgui \ + --volume /mnt/hdd/mynode/lnd:/.lnd:ro \ --add-host=host.docker.internal:host-gateway \ lndboss ExecStartPost=/bin/bash -c 'if [ -f /usr/bin/service_scripts/post_lndboss.sh ]; then /bin/bash /usr/bin/service_scripts/post_lndboss.sh; fi' diff --git a/rootfs/standard/usr/share/mynode_apps/lndboss/scripts/install_lndboss.sh b/rootfs/standard/usr/share/mynode_apps/lndboss/scripts/install_lndboss.sh index 7e804997..e0c68c04 100644 --- a/rootfs/standard/usr/share/mynode_apps/lndboss/scripts/install_lndboss.sh +++ b/rootfs/standard/usr/share/mynode_apps/lndboss/scripts/install_lndboss.sh @@ -14,15 +14,20 @@ echo "==================== INSTALLING APP ====================" # Remove old containers docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep 'lndboss') || true +docker rmi lndboss || true + +# Pull latest image and tag latest +docker pull niteshbalusu/lndboss:v2.16.0 +docker tag niteshbalusu/lndboss:v2.16.0 lndboss # Build docker container -if [ "$DEVICE_ARCH" = "x86_64" ]; then - docker build -t lndboss . -elif [ "$DEVICE_ARCH" = "aarch64" ]; then - docker build . -t lndboss -f arm64.Dockerfile -else - echo "THIS ARCHITECTURE IS NOT SUPPORTED FOR LndBoss" - exit 1 -fi +#if [ "$DEVICE_ARCH" = "x86_64" ]; then +# docker build -t lndboss . +#elif [ "$DEVICE_ARCH" = "aarch64" ]; then +# docker build . -t lndboss -f arm64.Dockerfile +#else +# echo "THIS ARCHITECTURE IS NOT SUPPORTED FOR LndBoss" +# exit 1 +#fi echo "================== DONE INSTALLING APP =================" \ No newline at end of file diff --git a/rootfs/standard/usr/share/mynode_apps/lndboss/scripts/pre_lndboss.sh b/rootfs/standard/usr/share/mynode_apps/lndboss/scripts/pre_lndboss.sh index acf7b39f..96815ad3 100644 --- a/rootfs/standard/usr/share/mynode_apps/lndboss/scripts/pre_lndboss.sh +++ b/rootfs/standard/usr/share/mynode_apps/lndboss/scripts/pre_lndboss.sh @@ -11,4 +11,25 @@ if [ -f /home/bitcoin/.mynode/.hashedpw_bcrypt ]; then "passwordHash": "$HASH_BCRYPT" } EOF -fi \ No newline at end of file +fi + +mkdir -p /mnt/hdd/mynode/lndboss/local +cat << EOF > /mnt/hdd/mynode/lndboss/config.json +{ + "default_saved_node": "local" +} +EOF +cat << EOF > /mnt/hdd/mynode/lndboss/local/credentials.json +{ + "cert_path": "/.lnd/tls.cert", + "macaroon_path": "/.lnd/data/chain/bitcoin/mainnet/admin.macaroon", + "socket": "host.docker.internal:10009" +} +EOF + + +# Create env file +MY_UID=$(id -u) +MY_GID=$(id -g) +echo "UID=$MY_UID" > /mnt/hdd/mynode/lndboss/env +echo "GID=$MY_GID" >> /mnt/hdd/mynode/lndboss/env \ No newline at end of file