Hack to get proxy to work in c-lightning, getting the tor container IP dynamically

This commit is contained in:
kexkey
2019-12-10 15:03:19 -05:00
committed by kexkey
parent 20b6f22e19
commit 0eb8c2cfbe
5 changed files with 20 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ const featureCondition = function(props) {
const templates = {
'lnd': [ path.join('lnd','lnd.conf') ],
'c-lightning': [ path.join('c-lightning','config') ]
'c-lightning': [ path.join('c-lightning','config'), path.join('c-lightning','entrypoint.sh') ]
};
module.exports = {

View File

@@ -29,7 +29,7 @@ services:
lightning:
image: cyphernode/clightning:<%= lightning_version %>
command: $USER sh -c 'while [ ! -f "/bitcoin_monitor/up" ]; do echo "bitcoin not ready" ; sleep 10 ; done ; echo "bitcoin ready!" ; lightningd'
command: $USER /.lightning/entrypoint.sh
<% if( lightning_expose ) { %>
ports:
- "9735:9735"

View File

@@ -18,12 +18,12 @@ addr=0.0.0.0:9735
<% if ( torifyables.indexOf('tor_lnnode') !== -1 ) { %>
# TOR
proxy=tor:9050
# proxy=tor:9050 this has to be made at execution time because of getaddrinfo and alpine not being friends, see entrypoint.sh
<% if ( clearnet.indexOf('clearnet_lnnode') == -1 ) { %>
# TOR only, no clearnet
always-use-proxy=true
disable-dns
<% } %>
#disable-dns
<% if (lightning_announce) { %>
# Announcing TOR address
announce-addr=<%= locals.tor_hostname %>:9735

View File

@@ -0,0 +1,15 @@
#!/bin/sh
while [ ! -f "/bitcoin_monitor/up" ]; do echo "bitcoin not ready" ; sleep 10 ; done
<% if ( torifyables.indexOf('tor_lnnode') !== -1 ) { %>
while [ -z "${TORIP}" ]; do echo "tor not ready" ; TORIP=$(getent hosts tor | awk '{ print $1 }') ; sleep 10 ; done
echo "TOR ready at IP ${TORIP}"
lightningd --proxy=$TORIP:9050
<% } else { %>
lightningd
<% } %>

1
dist/setup.sh vendored
View File

@@ -477,6 +477,7 @@ install_docker() {
fi
copy_file $cyphernodeconf_filepath/lightning/c-lightning/config $LIGHTNING_DATAPATH/config 1 $SUDO_REQUIRED
copy_file $cyphernodeconf_filepath/lightning/c-lightning/entrypoint.sh $LIGHTNING_DATAPATH/entrypoint.sh 1 $SUDO_REQUIRED
fi
fi