diff --git a/cyphernodeconf_docker/prompters/100_lightning.js b/cyphernodeconf_docker/prompters/100_lightning.js index 87e0326..d0efaf4 100644 --- a/cyphernodeconf_docker/prompters/100_lightning.js +++ b/cyphernodeconf_docker/prompters/100_lightning.js @@ -57,7 +57,7 @@ module.exports = { Next question is asked when lightning_annouce is YES and (not Tor or (Tor and LN clearnet)). */ { - when: (props) => { return featureCondition(props) && props.lightning_announce && (props.torifyables.indexOf('tor_lightning') == -1 || props.clearnet.indexOf('clearnet_lightning') != -1) }, + when: (props) => { return featureCondition(props) && props.lightning_announce && ((!props.torifyables || props.torifyables.indexOf('tor_lightning') === -1) || (props.clearnet && props.clearnet.indexOf('clearnet_lightning') !== -1)) }, type: 'input', name: 'lightning_external_ip', default: utils.getDefault( 'lightning_external_ip' ), diff --git a/cyphernodeconf_docker/templates/bitcoin/bitcoin.conf b/cyphernodeconf_docker/templates/bitcoin/bitcoin.conf index 37fcb56..503716d 100644 --- a/cyphernodeconf_docker/templates/bitcoin/bitcoin.conf +++ b/cyphernodeconf_docker/templates/bitcoin/bitcoin.conf @@ -17,10 +17,10 @@ zmqpubrawtx=tcp://0.0.0.0:18502 listen=1 -<% if ( torifyables.indexOf('tor_bitcoin') !== -1 ) { %> +<% if ( torifyables && torifyables.indexOf('tor_bitcoin') !== -1 ) { %> #tor proxy=tor:9050 -<% if ( clearnet.indexOf('clearnet_bitcoin') == -1 ) { %> +<% if ( !clearnet || clearnet.indexOf('clearnet_bitcoin') === -1 ) { %> onlynet=onion <% } %> <% } %> diff --git a/cyphernodeconf_docker/templates/installer/config.sh b/cyphernodeconf_docker/templates/installer/config.sh index 6e5456a..0b3e319 100644 --- a/cyphernodeconf_docker/templates/installer/config.sh +++ b/cyphernodeconf_docker/templates/installer/config.sh @@ -10,12 +10,12 @@ TRAEFIK_DATAPATH=<%= traefik_datapath %> FEATURE_TOR=<%= (features.indexOf('tor') != -1)?'true':'false' %> <% if ( features.indexOf('tor') !== -1 ) { %> TOR_DATAPATH=<%= tor_datapath %> -TOR_OTS_WEBHOOKS=<%= (torifyables.indexOf('tor_otswebhooks') != -1)?'true':'false' %> -TOR_ADDR_WATCH_WEBHOOKS=<%= (torifyables.indexOf('tor_addrwatcheswebhooks') != -1)?'true':'false' %> -TOR_TXID_WATCH_WEBHOOKS=<%= (torifyables.indexOf('tor_txidwatcheswebhooks') != -1)?'true':'false' %> -TOR_TRAEFIK=<%= (torifyables.indexOf('tor_traefik') != -1)?'true':'false' %> -TOR_BITCOIN=<%= (torifyables.indexOf('tor_bitcoin') != -1)?'true':'false' %> -TOR_LIGHTNING=<%= (torifyables.indexOf('tor_lightning') != -1)?'true':'false' %> +TOR_OTS_WEBHOOKS=<%= (torifyables && torifyables.indexOf('tor_otswebhooks') !== -1)?'true':'false' %> +TOR_ADDR_WATCH_WEBHOOKS=<%= (torifyables && torifyables.indexOf('tor_addrwatcheswebhooks') !== -1)?'true':'false' %> +TOR_TXID_WATCH_WEBHOOKS=<%= (torifyables && torifyables.indexOf('tor_txidwatcheswebhooks') !== -1)?'true':'false' %> +TOR_TRAEFIK=<%= (torifyables && torifyables.indexOf('tor_traefik') !== -1)?'true':'false' %> +TOR_BITCOIN=<%= (torifyables && torifyables.indexOf('tor_bitcoin') !== -1)?'true':'false' %> +TOR_LIGHTNING=<%= (torifyables && torifyables.indexOf('tor_lightning') !== -1)?'true':'false' %> <% } %> DOCKER_MODE=<%= docker_mode %> RUN_AS_USER=<%= run_as_different_user?username:'' %> diff --git a/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml b/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml index 93b2450..7fd1420 100644 --- a/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml +++ b/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml @@ -68,7 +68,11 @@ services: bitcoin: image: cyphernode/bitcoin:<%= bitcoin_version %> + <% if ( torifyables && torifyables.indexOf('tor_bitcoin') !== -1 ) { %> command: $USER sh -c 'rm -f /container_monitor/bitcoin_ready ; while [ ! -f "/container_monitor/tor_ready" ]; do echo "tor not ready" ; sleep 10 ; done ; echo "tor ready" ; bitcoind' + <% } else { %> + command: $USER sh -c 'rm -f /container_monitor/bitcoin_ready ; bitcoind' + <% } %> <% if( bitcoin_expose ) { %> ports: - "<%= (net === 'regtest') ? '18443:18443' : ((net === 'testnet') ? '18332:18332' : '8332:8332') %>" @@ -235,7 +239,7 @@ services: <% if (net === 'testnet') { %> - "TESTNET=1" <% } %> - <% if ( torifyables.indexOf('tor_otsoperations') !== -1 ) { %> + <% if ( torifyables && torifyables.indexOf('tor_otsoperations') !== -1 ) { %> - "TOR_HOST=tor" - "TOR_PORT=9050" <% } %> diff --git a/cyphernodeconf_docker/templates/installer/testdeployment.sh b/cyphernodeconf_docker/templates/installer/testdeployment.sh index 731d504..06f1cdc 100644 --- a/cyphernodeconf_docker/templates/installer/testdeployment.sh +++ b/cyphernodeconf_docker/templates/installer/testdeployment.sh @@ -79,7 +79,7 @@ fi printf "\r\n\033[0;92mDepending on your current location and DNS settings, point your favorite browser to one of the following URLs to access Cyphernode's status page:\r\n" printf "\r\n" printf "\033[0;95m<% cns.forEach(cn => { %><%= ('https://' + cn + ':' + traefik_https_port + '/welcome\\r\\n') %><% }) %>\033[0m\r\n" -<% if ( torifyables.indexOf('tor_traefik') !== -1 ) { %> +<% if ( torifyables && torifyables.indexOf('tor_traefik') !== -1 ) { %> printf "\033[0;92mYou can also use Tor Browser and navigate to your onion address:\r\n" printf "\033[0;95mhttps://${TOR_TRAEFIK_HOSTNAME}:<%= traefik_https_port %>/welcome\033[0m\r\n\r\n" <% } %> diff --git a/cyphernodeconf_docker/templates/lightning/c-lightning/config b/cyphernodeconf_docker/templates/lightning/c-lightning/config index a1b24e2..98322b6 100644 --- a/cyphernodeconf_docker/templates/lightning/c-lightning/config +++ b/cyphernodeconf_docker/templates/lightning/c-lightning/config @@ -16,10 +16,10 @@ rgb=<%= lightning_nodecolor %> addr=0.0.0.0:9735 -<% if ( torifyables.indexOf('tor_lightning') !== -1 ) { %> +<% if ( torifyables && torifyables.indexOf('tor_lightning') !== -1 ) { %> # Tor # 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_lightning') == -1 ) { %> +<% if ( !clearnet || clearnet.indexOf('clearnet_lightning') === -1 ) { %> # Tor only, no clearnet always-use-proxy=true disable-dns @@ -27,7 +27,7 @@ disable-dns <% if (lightning_announce) { %> # Announcing Tor address announce-addr=<%= locals.tor_lightning_hostname %>:9735 -<% if ( clearnet.indexOf('clearnet_lightning') !== -1 ) { %> +<% if ( clearnet && clearnet.indexOf('clearnet_lightning') !== -1 ) { %> <% if( locals.lightning_external_ip ) { %> # Announcing clearnet address announce-addr=<%= locals.lightning_external_ip %>:9735 diff --git a/cyphernodeconf_docker/templates/lightning/c-lightning/entrypoint.sh b/cyphernodeconf_docker/templates/lightning/c-lightning/entrypoint.sh index e6e5760..030ca9d 100755 --- a/cyphernodeconf_docker/templates/lightning/c-lightning/entrypoint.sh +++ b/cyphernodeconf_docker/templates/lightning/c-lightning/entrypoint.sh @@ -6,7 +6,7 @@ while [ ! -f "/container_monitor/bitcoin_ready" ]; do echo "bitcoin not ready" ; echo "bitcoin ready" -<% if ( torifyables.indexOf('tor_lightning') !== -1 ) { %> +<% if ( torifyables && torifyables.indexOf('tor_lightning') !== -1 ) { %> #while [ ! -f "/container_monitor/tor_ready" ]; do echo "tor not ready" ; sleep 10 ; done while [ -z "${TORIP}" ]; do echo "tor not ready" ; TORIP=$(getent hosts tor | awk '{ print $1 }') ; sleep 10 ; done diff --git a/cyphernodeconf_docker/templates/tor/torrc b/cyphernodeconf_docker/templates/tor/torrc index 1d04ff8..e20ca50 100644 --- a/cyphernodeconf_docker/templates/tor/torrc +++ b/cyphernodeconf_docker/templates/tor/torrc @@ -1,17 +1,17 @@ -<% if ( torifyables.indexOf('tor_traefik') !== -1 ) { %> +<% if ( torifyables && torifyables.indexOf('tor_traefik') !== -1 ) { %> HiddenServiceDir /tor/traefik/hidden_service/ HiddenServiceVersion 3 HiddenServicePort <%= traefik_http_port %> traefik:<%= traefik_http_port %> HiddenServicePort <%= traefik_https_port %> traefik:<%= traefik_https_port %> <% } %> -<% if ( torifyables.indexOf('tor_lightning') !== -1 && lightning_expose ) { %> +<% if ( torifyables && torifyables.indexOf('tor_lightning') !== -1 && lightning_expose ) { %> HiddenServiceDir /tor/lightning/hidden_service/ HiddenServiceVersion 3 HiddenServicePort 9735 lightning:9735 <% } %> -<% if ( torifyables.indexOf('tor_bitcoin') !== -1 && bitcoin_expose) { %> +<% if ( torifyables && torifyables.indexOf('tor_bitcoin') !== -1 && bitcoin_expose) { %> HiddenServiceDir /tor/bitcoin/hidden_service/ HiddenServiceVersion 3 HiddenServicePort 8333 bitcoin:8333