From e61e6fe3556fbd32f977abc23427eb1970ebd256 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Sat, 30 Jan 2021 14:18:59 +0200 Subject: [PATCH] Docker fragment for Bitcoin Wallet Tracker (#432) * Docker fragment for Bitcoin Wallet Tracker * Add docs for bwt * Persist all BWT_* options to BTCPAY_ENV_FILE * Add bwt to DockerFileBuildHelper, remove dynamic image name The dynamic image didn't play nicely with the build helper, so it was removed in favour of only supporting the Electrum variant for now. * Update to bwt v0.2.2 with multi-arch images --- README.md | 3 +++ contrib/DockerFileBuildHelper/Program.cs | 7 ++++++ .../docker-fragments/opt-add-bwt.yml | 25 +++++++++++++++++++ .../docker-fragments/opt-add-tor.yml | 6 +++++ helpers.sh | 1 + 5 files changed, 42 insertions(+) create mode 100644 docker-compose-generator/docker-fragments/opt-add-bwt.yml diff --git a/README.md b/README.md index e44202c..1333e5c 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ Additionally, there are specific environment variables for some addons: * `ZAMMAD_HOST`: If zammad is activated with [opt-add-zammad](docker-compose-generator/docker-fragments/opt-add-zammad.yml), the hostname of your zammad website (eg. `zammad.example.com`) * `WOOCOMMERCE_HOST`: If woocommerce is activated with [opt-add-woocommerce](docker-compose-generator/docker-fragments/opt-add-woocommerce.yml), the hostname of your woocommerce website (eg. `store.example.com`) * `EPS_XPUB`: If Electrum Personal Server (EPS) is activated with [opt-add-electrum-ps](docker-compose-generator/docker-fragments/opt-add-electrum-ps.yml), you must set the Extended Public Key (XPUB, YPUB or ZPUB) of the wallet you want to use, before first run of the EPS server. If you accidently start EPS without this, it will not work properly as the model of EPS is to monitor only specified wallets. +* If Bitcoin Wallet Tracker is activated with [opt-add-bwt](docker-compose-generator/docker-fragments/opt-add-bwt.yml), you can use `BWT_XPUB`/`BWT_XPUB_*` (to set your XPUB/YPUB/ZPUB), `BWT_DESCRIPTOR`/`BWT_DESCRIPTOR_*` (for script descriptors), `BWT_RESCAN_SINCE` (set to the wallet creation date in YYYY-MM-DD to speed up the rescan), `BWT_BITCOIND_WALLET` and `BWT_GAP_LIMIT`. # Tooling @@ -167,6 +168,7 @@ Available `BTCPAYGEN_ADDITIONAL_FRAGMENTS` currently are: * [opt-add-tor-relay](docker-compose-generator/docker-fragments/opt-add-tor-relay.yml), for a non-exit tor relay. Make sure to have ports 9001 and 9030 accessible externally. [Please read the legal implications of running a tor relay](https://community.torproject.org/relay/community-resources/eff-tor-legal-faq) and [what resources are used to operate the relay](https://trac.torproject.org/projects/tor/wiki/TorRelayGuide#RelayRequirements). * [opt-add-electrumx](docker-compose-generator/docker-fragments/opt-add-electrumx.yml), to integrate a full ElectrumX server (from official source) with BTCPay, using the BTCPay server's full bitcoin node for complete privacy when using your own Electrum wallet. You can also open port 50002 up to the internet on your router etc, to be part of the ElectrumX network, helping other Electrum wallet users to get connected. The bitcoin option `-txindex` is mandatory for ElectrumX, and this fragment will enable it on your BTCPay server automatically - NO need to use the fragment opt-txindex.yml. * [opt-add-electrum-ps](docker-compose-generator/docker-fragments/opt-add-electrum-ps.yml), to integrate Electrum Personal Server (EPS) with BTCPay (EPS is a single-user alternative to the ElectrumX Server option above). EPS will also use the BTCPay server's full bitcoin node for complete privacy when using your own Electrum wallet, for your own personal use (i.e. other users cannot use your server to verify transactions). Also, the bitcoin option `-txindex` is NOT mandatory for EPS, and it will run on a pruned node (unlike ElectrumX). You will need to add your XPUB/YPUB/ZPUB as environment variable `EPS_XPUB` before enabling EPS for the first time (see above section on environment variables, and see [full documentation](https://docs.btcpayserver.org/ElectrumPersonalServer/) for details). +* [opt-add-electrum-bwt](docker-compose-generator/docker-fragments/opt-add-bwe.yml), to integrate the [Bitcoin Wallet Tracker](https://github.com/bwt-dev/bwt) Electrum server, which uses a personal wallet index model similar to that of EPS. You will need to set `BWT_XPUB` with your XPUB/YPUB/ZPUB (see environment variables section). The server will only be available locally and through an onion service. * [opt-add-configurator](docker-compose-generator/docker-fragments/opt-add-configurator.yml), to integrate the [BTCPay Server Configurator](https://install.btcpayserver.org) to manage your BTCPay deployment through a UI, and to allow new deployments elsewhere easily. * [opt-add-pihole](docker-compose-generator/docker-fragments/opt-add-pihole.yml) ([See the documentation](docs/pihole.md)) * [opt-add-ndlc](docker-compose-generator/docker-fragments/opt-add-ndlc.yml) ([See the documentation](docs/ndlc.md)) @@ -326,6 +328,7 @@ We are trying to update our dependencies to run on `arm32v7` and `x64` boards. H | btcpayserver/lightning | v0.9.3-1 | [✔️](https://raw.githubusercontent.com/btcpayserver/lightning/basedon-v0.9.3-1/Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/lightning/basedon-v0.9.3-1/contrib/linuxarm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/lightning/basedon-v0.9.3-1/contrib/linuxarm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/lightning) - [DockerHub](https://hub.docker.com/r/btcpayserver/lightning) | | shesek/lightning-charge | 0.4.19-standalone | [✔️](https://raw.githubusercontent.com/ElementsProject/lightning-charge/v0.4.19/Dockerfile) | [✔️](https://raw.githubusercontent.com/ElementsProject/lightning-charge/v0.4.19/arm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/ElementsProject/lightning-charge/v0.4.19/arm64v8.Dockerfile) | [Github](https://github.com/ElementsProject/lightning-charge) - [DockerHub](https://hub.docker.com/r/shesek/lightning-charge) | | shesek/spark-wallet | 0.2.9-standalone | [✔️](https://raw.githubusercontent.com/shesek/spark-wallet/v0.2.9/Dockerfile) | [✔️](https://raw.githubusercontent.com/shesek/spark-wallet/v0.2.9/arm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/shesek/spark-wallet/v0.2.9/arm64v8.Dockerfile) | [Github](https://github.com/shesek/spark-wallet) - [DockerHub](https://hub.docker.com/r/shesek/spark-wallet) | +| shesek/bwt | 0.2.1 | [✔️](https://raw.githubusercontent.com/bwt-dev/bwt/v0.2.1/Dockerfile) | ❌ | ❌ | [Github](https://github.com/bwt-dev/bwt) - [DockerHub](https://hub.docker.com/r/shesek/bwt) | | saubyk/c-lightning-rest | 0.4.3 | [✔️](https://raw.githubusercontent.com/Ride-The-Lightning/c-lightning-REST/v0.4.3/amd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/Ride-The-Lightning/c-lightning-REST/v0.4.3/arm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/Ride-The-Lightning/c-lightning-REST/v0.4.3/arm64v8.Dockerfile) | [Github](https://github.com/Ride-The-Lightning/c-lightning-REST) - [DockerHub](https://hub.docker.com/r/saubyk/c-lightning-rest) | | shahanafarooqui/rtl | 0.10.0 | [✔️](https://raw.githubusercontent.com/ShahanaFarooqui/RTL/v0.10.0/Dockerfile) | [✔️](https://raw.githubusercontent.com/ShahanaFarooqui/RTL/v0.10.0/Dockerfile.arm32v7) | [✔️](https://raw.githubusercontent.com/ShahanaFarooqui/RTL/v0.10.0/Dockerfile.arm64v8) | [Github](https://github.com/ShahanaFarooqui/RTL) - [DockerHub](https://hub.docker.com/r/shahanafarooqui/rtl) | | btcpayserver/lnd | v0.11.0-beta | [✔️](https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.11.0-beta/linuxamd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.11.0-beta/linuxarm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.11.0-beta/linuxarm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/lnd) - [DockerHub](https://hub.docker.com/r/btcpayserver/lnd) | diff --git a/contrib/DockerFileBuildHelper/Program.cs b/contrib/DockerFileBuildHelper/Program.cs index 66d2632..69ec7b2 100644 --- a/contrib/DockerFileBuildHelper/Program.cs +++ b/contrib/DockerFileBuildHelper/Program.cs @@ -593,6 +593,13 @@ namespace DockerFileBuildHelper dockerInfo.GitRef = $"master"; dockerInfo.SupportedByUs = false; break; + case "bwt": + dockerInfo.DockerFilePath = $"docker/Dockerfile"; + dockerInfo.DockerFilePathARM32v7 = $"docker/arm32v7.Dockerfile"; + dockerInfo.DockerFilePathARM64v8 = $"docker/arm64v8.Dockerfile"; + dockerInfo.GitLink = "https://github.com/bwt-dev/bwt"; + dockerInfo.GitRef = $"v{image.Tag.Split('-')[0]}"; + break; default: if (firstTry) { diff --git a/docker-compose-generator/docker-fragments/opt-add-bwt.yml b/docker-compose-generator/docker-fragments/opt-add-bwt.yml new file mode 100644 index 0000000..510df6a --- /dev/null +++ b/docker-compose-generator/docker-fragments/opt-add-bwt.yml @@ -0,0 +1,25 @@ +version: "3" + +services: + bwt: + image: shesek/bwt:0.2.2-electrum + restart: unless-stopped + expose: [ "50001" ] + environment: + NETWORK: $NBITCOIN_NETWORK + BITCOIND_URL: http://bitcoind:43782/ + BITCOIND_DIR: /etc/bitcoin + ELECTRUM_ADDR: 0.0.0.0:50001 + volumes: + - "bitcoin_datadir:/etc/bitcoin" + - "nbxplorer_datadir:/root/.nbxplorer" + entrypoint: [ "/bin/bash", "-c" ] + command: + - | + while [ ! -f /root/.nbxplorer/btc_fully_synched ]; do sleep 0.5; done + [ "$$NETWORK" == "mainnet" ] && export NETWORK=bitcoin + # accept envirnoment variables with the BWT_ prefix (and strip it) + exec env -S "$$(echo $$(env | grep ^BWT_ | sed "s/^BWT_//g"))" \ + bwt ${BWT_ARGS:-} + +required: [ bitcoind ] diff --git a/docker-compose-generator/docker-fragments/opt-add-tor.yml b/docker-compose-generator/docker-fragments/opt-add-tor.yml index 9dc5c8e..7df7354 100644 --- a/docker-compose-generator/docker-fragments/opt-add-tor.yml +++ b/docker-compose-generator/docker-fragments/opt-add-tor.yml @@ -159,6 +159,12 @@ services: HIDDENSERVICE_PORT: 50002 HIDDENSERVICE_VIRTUAL_PORT: 50002 + bwt: + environment: + HIDDENSERVICE_NAME: bwt-electrum + HIDDENSERVICE_PORT: 50001 + HIDDENSERVICE_VIRTUAL_PORT: 50001 + bitcoin_teos: environment: HIDDENSERVICE_NAME: teos diff --git a/helpers.sh b/helpers.sh index c471789..acf5381 100755 --- a/helpers.sh +++ b/helpers.sh @@ -105,6 +105,7 @@ WOOCOMMERCE_HOST=$WOOCOMMERCE_HOST TOR_RELAY_NICKNAME=$TOR_RELAY_NICKNAME TOR_RELAY_EMAIL=$TOR_RELAY_EMAIL EPS_XPUB=$EPS_XPUB" > $BTCPAY_ENV_FILE +env | grep ^BWT_ >> $BTCPAY_ENV_FILE } btcpay_up() {