From 4693d96c524a8642bc63eab5e547493fceddc510 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Tue, 12 Nov 2024 22:43:32 +0200 Subject: [PATCH] docker: Update templates for BCH. --- basicswap/bin/prepare.py | 4 ++-- basicswap/interface/btc.py | 2 +- docker/production/bitcoincash/Dockerfile | 14 +++++++------- docker/production/bitcoincash/entrypoint.sh | 6 +++--- .../compose-fragments/1_bitcoincash.yml | 16 ++++++++++++++++ .../compose-fragments/8_wownero-daemon.yml | 2 +- .../compose-fragments/9_swapprepare.yml | 10 ++++++++-- docker/production/example.env | 12 ++++++------ docker/production/notes.md | 4 ++-- docker/production/swapclient/Dockerfile | 2 +- 10 files changed, 47 insertions(+), 25 deletions(-) create mode 100644 docker/production/compose-fragments/1_bitcoincash.yml diff --git a/basicswap/bin/prepare.py b/basicswap/bin/prepare.py index a9b7729..d235cfb 100644 --- a/basicswap/bin/prepare.py +++ b/basicswap/bin/prepare.py @@ -1972,8 +1972,8 @@ def main(): chainclients['bitcoin']['rpcuser'] = BTC_RPC_USER chainclients['bitcoin']['rpcpassword'] = BTC_RPC_PWD if BCH_RPC_USER != '': - chainclients['bitcoin']['rpcuser'] = BCH_RPC_USER - chainclients['bitcoin']['rpcpassword'] = BCH_RPC_PWD + chainclients['bitcoincash']['rpcuser'] = BCH_RPC_USER + chainclients['bitcoincash']['rpcpassword'] = BCH_RPC_PWD if XMR_RPC_USER != '': chainclients['monero']['rpcuser'] = XMR_RPC_USER chainclients['monero']['rpcpassword'] = XMR_RPC_PWD diff --git a/basicswap/interface/btc.py b/basicswap/interface/btc.py index 9af6830..469490b 100644 --- a/basicswap/interface/btc.py +++ b/basicswap/interface/btc.py @@ -1502,7 +1502,7 @@ class BTCInterface(Secp256k1Interface): 'amount': txjs['vout'][n]['value'] } - def inspectSwipeTx(self, tx: dict) -> bytes | None: + def inspectSwipeTx(self, tx: dict): mercy_keyshare = None for vout in tx['vout']: script_bytes = bytes.fromhex(vout['scriptPubKey']['hex']) diff --git a/docker/production/bitcoincash/Dockerfile b/docker/production/bitcoincash/Dockerfile index c9ca712..8004e36 100644 --- a/docker/production/bitcoincash/Dockerfile +++ b/docker/production/bitcoincash/Dockerfile @@ -8,20 +8,20 @@ RUN basicswap-prepare --preparebinonly --bindir=/coin_bin --withcoin=bitcoincash FROM debian:bullseye-slim COPY --from=install_stage /coin_bin . -ENV BITCOIN_DATA /data +ENV BITCOINCASH_DATA /data -RUN groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin \ +RUN groupadd -r bitcoincash && useradd -r -m -g bitcoincash bitcoincash \ && apt-get update \ && apt-get install -qq --no-install-recommends gosu \ && rm -rf /var/lib/apt/lists/* \ - && mkdir "$BITCOIN_DATA" \ - && chown -R bitcoin:bitcoin "$BITCOIN_DATA" \ - && ln -sfn "$BITCOIN_DATA" /home/bitcoin/.bitcoin \ - && chown -h bitcoin:bitcoin /home/bitcoin/.bitcoin + && mkdir "$BITCOINCASH_DATA" \ + && chown -R bitcoincash:bitcoincash "$BITCOINCASH_DATA" \ + && ln -sfn "$BITCOINCASH_DATA" /home/bitcoincash/.bitcoincash \ + && chown -h bitcoincash:bitcoincash /home/bitcoincash/.bitcoincash VOLUME /data COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] EXPOSE 8332 8333 18332 18333 18443 18444 -CMD ["/bitcoin/bitcoind", "--datadir=/data"] +CMD ["/bitcoincash/bitcoind", "--datadir=/data"] diff --git a/docker/production/bitcoincash/entrypoint.sh b/docker/production/bitcoincash/entrypoint.sh index 925d7d2..1068f99 100755 --- a/docker/production/bitcoincash/entrypoint.sh +++ b/docker/production/bitcoincash/entrypoint.sh @@ -2,10 +2,10 @@ set -e if [[ "$1" == "bitcoin-cli" || "$1" == "bitcoin-tx" || "$1" == "bitcoind" || "$1" == "test_bitcoin" ]]; then - mkdir -p "$BITCOIN_DATA" + mkdir -p "$BITCOINCASH_DATA" - chown -h bitcoin:bitcoin /home/bitcoin/.bitcoin - exec gosu bitcoin "$@" + chown -h bitcoincash:bitcoincash /home/bitcoincash/.bitcoincash + exec gosu bitcoincash "$@" else exec "$@" fi diff --git a/docker/production/compose-fragments/1_bitcoincash.yml b/docker/production/compose-fragments/1_bitcoincash.yml new file mode 100644 index 0000000..ca6a9bb --- /dev/null +++ b/docker/production/compose-fragments/1_bitcoincash.yml @@ -0,0 +1,16 @@ + bitcoincash_core: + image: i_bitcoincash + build: + context: bitcoincash + dockerfile: Dockerfile + container_name: bitcoincash_core + volumes: + - ${DATA_PATH}/bitcoincash:/data + expose: + - ${BCH_RPC_PORT} + logging: + driver: "json-file" + options: + max-size: "10m" + max-file: "3" + restart: unless-stopped diff --git a/docker/production/compose-fragments/8_wownero-daemon.yml b/docker/production/compose-fragments/8_wownero-daemon.yml index 73fccfe..7d140b6 100644 --- a/docker/production/compose-fragments/8_wownero-daemon.yml +++ b/docker/production/compose-fragments/8_wownero-daemon.yml @@ -7,7 +7,7 @@ volumes: - ${DATA_PATH}/wownero_daemon:/data expose: - - ${BASE_WOW_RPC_PORT} + - ${WOW_RPC_PORT} logging: driver: "json-file" options: diff --git a/docker/production/compose-fragments/9_swapprepare.yml b/docker/production/compose-fragments/9_swapprepare.yml index 309d6a6..7b1d531 100644 --- a/docker/production/compose-fragments/9_swapprepare.yml +++ b/docker/production/compose-fragments/9_swapprepare.yml @@ -16,6 +16,7 @@ - ${DATA_PATH}/pivx:/data/pivx - ${DATA_PATH}/dash:/data/dash - ${DATA_PATH}/firo:/data/firo + - ${DATA_PATH}/bitcoincash:/data/bitcoincash environment: - TZ - BSX_DOCKER_MODE @@ -50,8 +51,8 @@ - DEFAULT_XMR_RESTORE_HEIGHT - WOW_DATA_DIR - WOW_RPC_HOST - - BASE_WOW_RPC_PORT - - BASE_WOW_ZMQ_PORT + - WOW_RPC_PORT + - WOW_ZMQ_PORT - WOW_WALLETS_DIR - WOW_WALLET_RPC_HOST - WOW_WALLET_RPC_PORT @@ -73,4 +74,9 @@ - FIRO_RPC_PORT - FIRO_RPC_USER - FIRO_RPC_PWD + - BCH_DATA_DIR + - BCH_RPC_HOST + - BCH_RPC_PORT + - BCH_RPC_USER + - BCH_RPC_PWD restart: "no" diff --git a/docker/production/example.env b/docker/production/example.env index 9f065d8..f451d38 100644 --- a/docker/production/example.env +++ b/docker/production/example.env @@ -21,12 +21,6 @@ BTC_RPC_PORT=19796 BTC_RPC_USER=bitcoin_user BTC_RPC_PWD=bitcoin_pwd -BCH_DATA_DIR=/data/bitcoincash -BCH_RPC_HOST=bitcoincash_core -BCH_RPC_PORT=19797 -BCH_RPC_USER=bitcoincash_user -BCH_RPC_PWD=bitcoincash_pwd - LTC_DATA_DIR=/data/litecoin LTC_RPC_HOST=litecoin_core LTC_RPC_PORT=19795 @@ -78,3 +72,9 @@ FIRO_RPC_HOST=firo_core FIRO_RPC_PORT=8888 FIRO_RPC_USER=firo_user FIRO_RPC_PWD=firo_pwd + +BCH_DATA_DIR=/data/bitcoincash +BCH_RPC_HOST=bitcoincash_core +BCH_RPC_PORT=19797 +BCH_RPC_USER=bitcoincash_user +BCH_RPC_PWD=bitcoincash_pwd diff --git a/docker/production/notes.md b/docker/production/notes.md index 06d74fc..56ad54d 100644 --- a/docker/production/notes.md +++ b/docker/production/notes.md @@ -165,7 +165,7 @@ Prepare config files: export ADD_COIN=monero docker-compose -f docker-compose-prepare.yml run --rm swapprepare \ - basicswap-prepare --nocores --usecontainers --addcoin=${ADD_COIN} --htmlhost="0.0.0.0" --particl_mnemonic=none + basicswap-prepare --nocores --usecontainers --addcoin=${ADD_COIN} --particl_mnemonic=none Prepare wallet: @@ -177,7 +177,7 @@ Prepare wallet: docker-compose -f docker-compose-prepare.yml run -e WALLET_ENCRYPTION_PWD=walletpass \ --rm swapprepare \ - basicswap-prepare --initwalletsonly --withoutcoin=particl --withcoin=monero + basicswap-prepare --initwalletsonly --withoutcoin=particl --withcoin=${ADD_COIN} docker-compose -f docker-compose-prepare.yml stop diff --git a/docker/production/swapclient/Dockerfile b/docker/production/swapclient/Dockerfile index 64a804d..47c6348 100644 --- a/docker/production/swapclient/Dockerfile +++ b/docker/production/swapclient/Dockerfile @@ -6,7 +6,7 @@ ENV LANG=C.UTF-8 \ RUN apt-get update; \ apt-get install -y --no-install-recommends \ - python3-pip libpython3-dev gnupg pkg-config gcc libc-dev gosu tzdata; + python3-pip libpython3-dev gnupg pkg-config gcc libc-dev gosu tzdata wget unzip; ARG BASICSWAP_URL=https://github.com/basicswap/basicswap/archive/master.zip ARG BASICSWAP_DIR=basicswap-master