From 2941ad1a890dc9ba03b90efd7194e9cd70e4dcf7 Mon Sep 17 00:00:00 2001 From: Michael Henke Date: Tue, 22 Nov 2022 18:15:02 -0800 Subject: [PATCH] remove sed from firstrun.sh as it is not available in docker image --- docker-compose.yml | 24 ++++++++++++++---------- firstrun.sh | 6 +++--- lnd/lnd.conf | 3 +-- tor/torrc-lnd | 2 -- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 87d9773..fcbea7e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,12 +4,12 @@ services: firstrun: container_name: firstrun image: docker:latest - restart: never + restart: "no" volumes: - - lnd:/data/.lnd - - tor/torrc-lnd:/etc/tor/torrc - - firstrun.sh:/firstrun.sh - command: /firstrun.sh + - ./lnd:/lnd + - ./tor/torrc-lnd:/tor/torrc-lnd + - ./firstrun.sh:/firstrun.sh:ro + command: sh -c "cd / && sh /firstrun.sh" tor: container_name: watchtower_tor @@ -17,10 +17,11 @@ services: user: toruser restart: on-failure volumes: - - tor/torrc-lnd:/etc/tor/torrc - - tor/data:/var/lib/tor/ + - ./tor/torrc-lnd:/etc/tor/torrc:ro + - ./tor/data:/var/lib/tor/ depends_on: - - firstrun + firstrun: + condition: service_completed_successfully networks: default: ipv4_address: 172.0.0.2 @@ -29,9 +30,12 @@ services: image: lightninglabs/lnd:v0.15.4-beta user: 1000:1000 depends_on: - - tor, firstrun + firstrun: + condition: service_completed_successfully + tor: + condition: service_started volumes: - - ${PWD}/lnd:/data/.lnd + - ./lnd:/data/.lnd environment: HOME: /data restart: on-failure diff --git a/firstrun.sh b/firstrun.sh index f4266b1..b750ce7 100644 --- a/firstrun.sh +++ b/firstrun.sh @@ -1,5 +1,5 @@ PASSWORDLENGTH=32 -PASSWORDFILE="lnd/watchtower.password" +PASSWORDFILE="/lnd/watchtower.password" # 0. Check if a password file exists if [ ! -f $PASSWORDFILE ] || [ $(wc -c $PASSWORDFILE | sed "s/ */ /g" | cut -d " " -f 2 || echo 0) -ne $PASSWORDLENGTH ]; then @@ -12,6 +12,6 @@ if [ ! -f $PASSWORDFILE ] || [ $(wc -c $PASSWORDFILE | sed "s/ */ /g" | cut -d # 2. generate tor control password and set up lnd and tor TORPASSWORD=$(< /dev/urandom tr -dc "[:alnum:]" | head -c$PASSWORDLENGTH) HASHED_TOR_PASSWORD=$(docker run --rm lncm/tor:0.4.7.9 --hash-password $TORPASSWORD) - sed -i .bak "s/tor.password=.*/tor.password=$TORPASSWORD/" lnd/lnd.conf && rm lnd/lnd.conf.bak - sed -i .bak "s/HashedControlPassword .*/HashedControlPassword $HASHED_TOR_PASSWORD/" tor/torrc-lnd && rm tor/torrc-lnd.bak + echo "tor.password=$TORPASSWORD" >> /lnd/lnd.conf + echo "HashedControlPassword $HASHED_TOR_PASSWORD" >> /tor/torrc-lnd fi diff --git a/lnd/lnd.conf b/lnd/lnd.conf index bf7fec3..0b768d9 100644 --- a/lnd/lnd.conf +++ b/lnd/lnd.conf @@ -3,7 +3,7 @@ nolisten=false maxpendingchannels=0 feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json -wallet-unlock-password-file=/data/.lnd/data/watchtower.password +wallet-unlock-password-file=/data/.lnd/watchtower.password no-rest-tls=true [Bitcoin] @@ -24,4 +24,3 @@ tor.socks=9050 tor.v3=true tor.control=172.0.0.2:29051 tor.socks=172.0.0.2:9050 -tor.password=pB2o8b8osXv1uYG6bErq86EJItnluMYd diff --git a/tor/torrc-lnd b/tor/torrc-lnd index e5f8534..358266b 100644 --- a/tor/torrc-lnd +++ b/tor/torrc-lnd @@ -9,5 +9,3 @@ HiddenServicePort 8080 172.0.0.3:8080 # LND gRPC Hidden Service HiddenServiceDir /var/lib/tor/lnd-grpc HiddenServicePort 10009 172.0.0.3:10009 - -HashedControlPassword 16:85DA0C9A60900E5F60D441B9C1E7559792DDAA192F7F7C8A612D461A65