From bf7ae27909b79ff53a440f78ed9b406a7ab8c63f Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Mon, 5 Oct 2020 15:36:03 +0200 Subject: [PATCH 1/2] add new config property BITCOIND_LISTEN_MODE in bitcoind.conf --- docker/my-dojo/bitcoin/restart.sh | 9 ++++++--- docker/my-dojo/conf/docker-bitcoind.conf.tpl | 5 +++++ docker/my-dojo/docker-compose.yaml | 1 + docker/my-dojo/dojo.sh | 14 +++++++++----- docker/my-dojo/tor/restart.sh | 13 +++++++++---- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/docker/my-dojo/bitcoin/restart.sh b/docker/my-dojo/bitcoin/restart.sh index 751bd6b..d8cbf98 100644 --- a/docker/my-dojo/bitcoin/restart.sh +++ b/docker/my-dojo/bitcoin/restart.sh @@ -4,15 +4,12 @@ set -e echo "## Start bitcoind #############################" bitcoind_options=( - -bind=172.28.1.5 -datadir=/home/bitcoin/.bitcoin -printtoconsole=1 -dbcache=$BITCOIND_DB_CACHE -disablewallet=1 -dns=$BITCOIND_DNS -dnsseed=$BITCOIND_DNSSEED - -externalip=$(cat /var/lib/tor/hsv2bitcoind/hostname) - -listen=1 -maxconnections=$BITCOIND_MAX_CONNECTIONS -maxmempool=$BITCOIND_MAX_MEMPOOL -mempoolexpiry=$BITCOIND_MEMPOOL_EXPIRY @@ -32,6 +29,12 @@ bitcoind_options=( -zmqpubrawtx=tcp://0.0.0.0:9501 ) +if [ "$BITCOIND_LISTEN_MODE" == "on" ]; then + bitcoind_options+=(-listen=1) + bitcoind_options+=(-bind=172.28.1.5) + bitcoind_options+=(-externalip=$(cat /var/lib/tor/hsv2bitcoind/hostname)) +fi + if [ "$BITCOIND_RPC_EXTERNAL" == "on" ]; then bitcoind_options+=(-zmqpubhashtx=tcp://0.0.0.0:9500) bitcoind_options+=(-zmqpubrawblock=tcp://0.0.0.0:9503) diff --git a/docker/my-dojo/conf/docker-bitcoind.conf.tpl b/docker/my-dojo/conf/docker-bitcoind.conf.tpl index 2695e14..6a19192 100644 --- a/docker/my-dojo/conf/docker-bitcoind.conf.tpl +++ b/docker/my-dojo/conf/docker-bitcoind.conf.tpl @@ -39,6 +39,11 @@ BITCOIND_MEMPOOL_EXPIRY=72 # Type: numeric BITCOIND_MIN_RELAY_TX_FEE=0.00001 +# Allow incoming connections +# This parameter is inactive if BITCOIND_INSTALL is set to 'off' +# Values: on | off +BITCOIND_LISTEN_MODE=on + # # EXPERT SETTINGS diff --git a/docker/my-dojo/docker-compose.yaml b/docker/my-dojo/docker-compose.yaml index 1f1638b..197ce65 100644 --- a/docker/my-dojo/docker-compose.yaml +++ b/docker/my-dojo/docker-compose.yaml @@ -92,6 +92,7 @@ services: context: ./tor env_file: - ./.env + - ./conf/docker-bitcoind.conf - ./conf/docker-explorer.conf - ./conf/docker-whirlpool.conf - ./conf/docker-tor.conf diff --git a/docker/my-dojo/dojo.sh b/docker/my-dojo/dojo.sh index cda0d74..ff39c7a 100755 --- a/docker/my-dojo/dojo.sh +++ b/docker/my-dojo/dojo.sh @@ -83,8 +83,10 @@ stop() { # Shutdown the bitcoin daemon if [ "$BITCOIND_INSTALL" == "on" ]; then # Renewal of bitcoind onion address - if [ "$BITCOIND_EPHEMERAL_HS" = "on" ]; then - $( docker exec -it tor rm -rf /var/lib/tor/hsv2bitcoind ) &> /dev/null + if [ "$BITCOIND_LISTEN_MODE" == "on" ]; then + if [ "$BITCOIND_EPHEMERAL_HS" = "on" ]; then + $( docker exec -it tor rm -rf /var/lib/tor/hsv2bitcoind ) &> /dev/null + fi fi # Stop the bitcoin daemon $( docker exec -it bitcoind bitcoin-cli \ @@ -360,9 +362,11 @@ onion() { fi if [ "$BITCOIND_INSTALL" == "on" ]; then - V2_ADDR_BTCD=$( docker exec -it tor cat /var/lib/tor/hsv2bitcoind/hostname ) - echo "Your local bitcoind (do not share) = $V2_ADDR_BTCD" - echo " " + if [ "$BITCOIND_LISTEN_MODE" == "on" ]; then + V2_ADDR_BTCD=$( docker exec -it tor cat /var/lib/tor/hsv2bitcoind/hostname ) + echo "Your local bitcoind (do not share) = $V2_ADDR_BTCD" + echo " " + fi fi } diff --git a/docker/my-dojo/tor/restart.sh b/docker/my-dojo/tor/restart.sh index 1cf4458..e44a98b 100644 --- a/docker/my-dojo/tor/restart.sh +++ b/docker/my-dojo/tor/restart.sh @@ -19,12 +19,17 @@ tor_options=( --HiddenServiceDir /var/lib/tor/hsv3dojo --HiddenServiceVersion 3 --HiddenServicePort "80 172.29.1.3:80" - --HiddenServiceDir /var/lib/tor/hsv2bitcoind - --HiddenServiceVersion 2 - --HiddenServicePort "8333 172.28.1.5:8333" - --HiddenServiceDirGroupReadable 1 ) +if [ "$BITCOIND_INSTALL" == "on" ]; then + if [ "$BITCOIND_LISTEN_MODE" == "on" ]; then + tor_options+=(--HiddenServiceDir /var/lib/tor/hsv2bitcoind) + tor_options+=(--HiddenServiceVersion 2) + tor_options+=(--HiddenServicePort "8333 172.28.1.5:8333") + tor_options+=(--HiddenServiceDirGroupReadable 1) + fi +fi + if [ "$EXPLORER_INSTALL" == "on" ]; then tor_options+=(--HiddenServiceDir /var/lib/tor/hsv3explorer) tor_options+=(--HiddenServiceVersion 3) From 345b5b061c85f8d3511b1c833beb9108eee588df Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Mon, 5 Oct 2020 15:36:25 +0200 Subject: [PATCH 2/2] bump version of bitcoind and tor containers --- docker/my-dojo/.env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/my-dojo/.env b/docker/my-dojo/.env index f42db71..74bd3bb 100644 --- a/docker/my-dojo/.env +++ b/docker/my-dojo/.env @@ -12,10 +12,10 @@ COMPOSE_CONVERT_WINDOWS_PATHS=1 DOJO_VERSION_TAG=1.9.0 DOJO_DB_VERSION_TAG=1.2.0 -DOJO_BITCOIND_VERSION_TAG=1.8.0 +DOJO_BITCOIND_VERSION_TAG=1.9.0 DOJO_NODEJS_VERSION_TAG=1.9.0 DOJO_NGINX_VERSION_TAG=1.5.0 -DOJO_TOR_VERSION_TAG=1.5.0 +DOJO_TOR_VERSION_TAG=1.6.0 DOJO_EXPLORER_VERSION_TAG=1.3.0 DOJO_INDEXER_VERSION_TAG=1.1.0 DOJO_WHIRLPOOL_VERSION_TAG=1.2.0