From 062c719b88261b703db3d803298197f31e635d04 Mon Sep 17 00:00:00 2001 From: koalasat Date: Mon, 14 Oct 2024 23:09:00 +0200 Subject: [PATCH] Add LNDg --- compose/docker-compose.override-lnd.yml | 17 ++++++++++++++++ compose/env-sample/lndtn/compose.env | 17 ++++++++-------- compose/env-sample/lndtn/supervisord.conf | 24 +++++++++++++++++++++++ compose/env-sample/lndtn/torrc | 4 ++++ compose/lndg/Dockerfile | 10 ++++++++++ 5 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 compose/env-sample/lndtn/supervisord.conf create mode 100644 compose/lndg/Dockerfile diff --git a/compose/docker-compose.override-lnd.yml b/compose/docker-compose.override-lnd.yml index 0095e8f..f3c08da 100644 --- a/compose/docker-compose.override-lnd.yml +++ b/compose/docker-compose.override-lnd.yml @@ -45,6 +45,23 @@ services: volumes: - ${LND_DATA:?}:/lnd/:ro - ${LIT_DATA:?}:/root/ + + lndg: + build: ./lndg + restart: always + container_name: lndg${SUFFIX} + volumes: + - ${LNDG_CONFIG}:/root/supervisord.conf:ro + - ${LND_DATA}:/root/.lnd:ro + - ${LNDG_DATA}:/lndg/data:rw + depends_on: + - tor + - lnd + command: + - sh + - -c + - python initialize.py -net ${NETWORK} -d -dx -dir /root/.lnd -rpc 127.0.0.1:${GUEST_LND_RPC_PORT:?} -pw '${LNDG_PASSWORD:?}' && supervisord -c /root/supervisord.conf && python manage.py runserver 0.0.0.0:8889 + network_mode: service:tor # Patch common services tor: diff --git a/compose/env-sample/lndtn/compose.env b/compose/env-sample/lndtn/compose.env index 802227b..46a2b5e 100644 --- a/compose/env-sample/lndtn/compose.env +++ b/compose/env-sample/lndtn/compose.env @@ -41,15 +41,15 @@ BU_DIR2='/custom_path/backup' BU_DIR3='/custom_path/backup2' BITCOIN_DATA='/custom_path/testnet/bitcoin' -BITCOIN_CONF='./env/lndtn/bitcoin.conf' +BITCOIN_CONF='./env-sample/lndtn/bitcoin.conf' LND_DATA='/custom_path/testnet/lnd' -LND_CONF='./env/lndtn/lnd.conf' +LND_CONF='./env-sample/lndtn/lnd.conf' LIT_DATA='/custom_path/testnet/lit' GUEST_BITCOIN=/home/bitcoin/.bitcoin -TOR_DATA='./env/lndtn/tor' -TOR_CONFIG='./env/lndtn/torrc' +TOR_DATA='./env-sample/lndtn/tor' +TOR_CONFIG='./env-sample/lndtn/torrc' GUEST_LND_RPC_PORT=10009 GUEST_LND_REST_PORT=8080 @@ -58,12 +58,13 @@ HOST_LND_RPC_PORT=10009 HOST_LND_REST_PORT=8080 THUB_LOCAL_PORT=3001 -THUB_ACCOUNTS='./env/lndtn/thunderhub-accounts.yml' +THUB_ACCOUNTS='./env-sample/lndtn/thunderhub-accounts.yml' # THUB_ACCOUNTS_CONFIG_PATH must match thub...env THUB_ACCOUNTS_CONFIG_PATH='/config/accounts.yml' - - +LNDG_CONFIG='./env-sample/lndtn/supervisord.conf' +LNDG_DATA='/custom_path/testnet/lndg/data' +LNDG_PASSWORD=999999999 LIT_LOCAL_PORT=4001 LIT_PASSWORD=999999999 @@ -72,4 +73,4 @@ LND_BACKUP_PATH='/custom_path/testnet/lnd-backup' NODE_ALIAS='šŸ¤–RoboSats⚔(Testnet)' NODE_COLOR='#4126a7' -LND_AUTOUNLOCK_PWD='./env/lndtn/lnd_autounlock_pwd' +LND_AUTOUNLOCK_PWD='./env-sample/lndtn/lnd_autounlock_pwd' diff --git a/compose/env-sample/lndtn/supervisord.conf b/compose/env-sample/lndtn/supervisord.conf new file mode 100644 index 0000000..157a6e1 --- /dev/null +++ b/compose/env-sample/lndtn/supervisord.conf @@ -0,0 +1,24 @@ +[supervisord] +user=root +childlogdir = /var/log +logfile = /var/log/supervisord.log +logfile_maxbytes = 50MB +logfile_backups = 30 +loglevel = info +pidfile = /var/supervisord.pid +umask = 022 +nodaemon = false +nocleanup = false + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface + +[program:controller] +command = sh -c "python controller.py && sleep 15" +process_name = lndg-controller +directory = /app +autorestart = true +redirect_stderr = true +stdout_logfile = /var/log/lndg-controller.log +stdout_logfile_maxbytes = 150MB +stdout_logfile_backups = 15 diff --git a/compose/env-sample/lndtn/torrc b/compose/env-sample/lndtn/torrc index fda6663..fbbf5cd 100644 --- a/compose/env-sample/lndtn/torrc +++ b/compose/env-sample/lndtn/torrc @@ -28,3 +28,7 @@ HiddenServicePort 80 127.0.0.1:3000 HiddenServiceDir /var/lib/tor/robotest-lit/ HiddenServiceVersion 3 HiddenServicePort 8443 127.0.0.1:8443 + +HiddenServiceDir /var/lib/tor/robotest-lndg/ +HiddenServiceVersion 3 +HiddenServicePort 80 127.0.0.1:8889 diff --git a/compose/lndg/Dockerfile b/compose/lndg/Dockerfile new file mode 100644 index 0000000..50dd136 --- /dev/null +++ b/compose/lndg/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3-alpine +ENV TZ=Europe/London +ENV PYTHONUNBUFFERED 1 + +RUN apk add git g++ linux-headers && git clone https://github.com/cryptosharks131/lndg /app +WORKDIR /app + +RUN git checkout "v1.9.0" +RUN pip install -r requirements.txt +RUN pip install supervisor whitenoise