|
1 | 1 | services: |
| 2 | + bitcoind: |
| 3 | + image: coinswap/${BITCOIN_IMAGE_NAME:-bitcoin-mutinynet}:${BITCOIN_TAG:-latest} |
| 4 | + container_name: coinswap-bitcoind |
| 5 | + profiles: ["internal-bitcoind"] |
| 6 | + command: > |
| 7 | + bitcoind |
| 8 | + ${BITCOIN_NETWORK_ARG} |
| 9 | + -rpcbind=0.0.0.0 |
| 10 | + -rpcallowip=0.0.0.0/0 |
| 11 | + ports: |
| 12 | + - "${BITCOIN_RPC_PORT:-38332}:${BITCOIN_RPC_PORT:-38332}" |
| 13 | + - "${BITCOIN_ZMQ_PORT:-28332}:${BITCOIN_ZMQ_PORT:-28332}" |
| 14 | + volumes: |
| 15 | + - bitcoin-data:/home/bitcoin/.bitcoin |
| 16 | + - ./docs/bitcoin.conf:/home/bitcoin/.bitcoin/bitcoin.conf:ro |
| 17 | + restart: unless-stopped |
| 18 | + healthcheck: |
| 19 | + test: ["CMD", "bitcoin-cli", "-rpcuser=${BITCOIN_RPC_USER:-user}", "-rpcpassword=${BITCOIN_RPC_PASSWORD:-password}", "-rpcport=${BITCOIN_RPC_PORT:-38332}", "getblockchaininfo"] |
| 20 | + interval: 30s |
| 21 | + timeout: 10s |
| 22 | + retries: 5 |
2 | 23 |
|
3 | 24 | tor: |
4 | 25 | image: osminogin/tor-simple |
5 | | - container_name: tor |
6 | | - restart: unless-stopped |
7 | | - ports: |
8 | | - - "${TOR_SOCKS_PORT:-19050}:${TOR_SOCKS_PORT:-19050}" |
9 | | - - "${TOR_CONTROL_PORT:-19051}:${TOR_CONTROL_PORT:-19051}" |
10 | | - - "${MAKER_RPC_PORT:-6113}:${MAKER_RPC_PORT:-6113}" |
| 26 | + container_name: coinswap-tor |
| 27 | + profiles: ["internal-tor"] |
| 28 | + network_mode: "host" |
| 29 | + entrypoint: /bin/sh |
| 30 | + command: |
| 31 | + - -c |
| 32 | + - | |
| 33 | + HASH=$$(tor --hash-password "$${TOR_AUTH_PASSWORD}" | grep "^16:") |
| 34 | + |
| 35 | + # use /tmp/torrc because the container runs as non-root and cannot write to /etc/tor/ |
| 36 | + cat > /tmp/torrc << EOF |
| 37 | + SocksPort 0.0.0.0:$${TOR_SOCKS_PORT:-9050} |
| 38 | + ControlPort 0.0.0.0:$${TOR_CONTROL_PORT:-9051} |
| 39 | + DataDirectory /var/lib/tor |
| 40 | + HashedControlPassword $$HASH |
| 41 | + EOF |
| 42 | + echo "Starting Tor with the following configuration:" |
| 43 | + cat /tmp/torrc |
| 44 | + echo "" |
| 45 | + |
| 46 | + exec tor -f /tmp/torrc |
11 | 47 | volumes: |
12 | | - - ./torrc:/etc/tor/torrc:ro |
13 | 48 | - tor-data:/var/lib/tor |
| 49 | + ports: |
| 50 | + - "127.0.0.1:${TOR_SOCKS_PORT:-9050}:${TOR_SOCKS_PORT:-9050}" |
| 51 | + - "127.0.0.1:${TOR_CONTROL_PORT:-9051}:${TOR_CONTROL_PORT:-9051}" |
| 52 | + - "${MAKERD_RPC_PORT:-6103}:${MAKERD_RPC_PORT:-6103}" |
| 53 | + environment: |
| 54 | + - TOR_SOCKS_PORT=${TOR_SOCKS_PORT:-9050} |
| 55 | + - TOR_CONTROL_PORT=${TOR_CONTROL_PORT:-9051} |
| 56 | + - TOR_AUTH_PASSWORD=${TOR_AUTH_PASSWORD} |
| 57 | + restart: unless-stopped |
14 | 58 |
|
15 | 59 | makerd: |
16 | | - image: coinswap/coinswap:master |
| 60 | + image: coinswap/${IMAGE_NAME:-coinswap}:latest |
17 | 61 | container_name: coinswap-makerd |
18 | | - network_mode: "service:tor" |
19 | | - command: |
| 62 | + profiles: ["external-tor"] |
| 63 | + network_mode: "host" |
| 64 | + command: &makerd-command |
20 | 65 | - sh |
21 | 66 | - -c |
22 | 67 | - | |
23 | 68 | sleep 15 |
24 | 69 | mkdir -p /home/coinswap/.coinswap/maker |
25 | | - printf '%s\n' \ |
26 | | - "network_port = ${MAKER_NETWORK_PORT:-6112}" \ |
27 | | - "rpc_port = ${MAKER_RPC_PORT:-6113}" \ |
28 | | - "socks_port = ${TOR_SOCKS_PORT:-19050}" \ |
29 | | - "control_port = ${TOR_CONTROL_PORT:-19051}" \ |
30 | | - "tor_auth_password = ${TOR_AUTH_PASSWORD:-coinswap}" \ |
31 | | - "min_swap_amount = ${MIN_SWAP_AMOUNT:-10000}" \ |
32 | | - "fidelity_amount = ${FIDELITY_AMOUNT:-50000}" \ |
33 | | - "fidelity_timelock = ${FIDELITY_TIMELOCK:-13104}" \ |
34 | | - "connection_type = TOR" \ |
35 | | - "base_fee = ${BASE_FEE:-100}" \ |
36 | | - "amount_relative_fee_ppt = ${AMOUNT_RELATIVE_FEE_PPT:-1000}" \ |
37 | | - > /home/coinswap/.coinswap/maker/config.toml |
38 | | - makerd -w ${WALLET_NAME} -r ${BITCOIN_RPC_HOST:-172.81.178.3:48332} -a ${BITCOIN_RPC_AUTH:-user:password} --taproot |
| 70 | + |
| 71 | + cat > /home/coinswap/.coinswap/maker/config.toml << EOM |
| 72 | + network_port = $${MAKER_NETWORK_PORT:-6102} |
| 73 | + rpc_port = $${MAKER_RPC_PORT:-6103} |
| 74 | + socks_port = $${TOR_SOCKS_PORT:-9050} |
| 75 | + control_port = $${TOR_CONTROL_PORT:-9051} |
| 76 | + tor_auth_password = "$${TOR_AUTH_PASSWORD}" |
| 77 | + min_swap_amount = $${MIN_SWAP_AMOUNT:-10000} |
| 78 | + fidelity_amount = $${FIDELITY_AMOUNT:-50000} |
| 79 | + fidelity_timelock = $${FIDELITY_TIMELOCK:-13104} |
| 80 | + connection_type = "TOR" |
| 81 | + base_fee = $${BASE_FEE:-100} |
| 82 | + amount_relative_fee_ppt = $${AMOUNT_RELATIVE_FEE_PPT:-1000} |
| 83 | + EOM |
| 84 | + |
| 85 | + WALLET_NAME="$${BITCOIN_WALLET_NAME:-coinswap-maker}" |
| 86 | + echo "INFO: Using wallet: $$WALLET_NAME" |
| 87 | +
|
| 88 | + echo "[DEBUG] Running: makerd -t \"$${TOR_AUTH_PASSWORD}\" -r $${BITCOIN_RPC_HOST} -a $${BITCOIN_RPC_AUTH} $${MAKERD_EXTRA_ARGS} -w \"$$WALLET_NAME\"" |
| 89 | +
|
| 90 | + makerd -t "$${TOR_AUTH_PASSWORD}" -r $${BITCOIN_RPC_HOST} -a $${BITCOIN_RPC_AUTH} $${MAKERD_EXTRA_ARGS} -w "$$WALLET_NAME" |
| 91 | + ports: |
| 92 | + - "${MAKERD_PORT:-6102}:${MAKERD_PORT:-6102}" |
| 93 | + - "${MAKERD_RPC_PORT:-6103}:${MAKERD_RPC_PORT:-6103}" |
39 | 94 | volumes: |
40 | 95 | - maker-data:/home/coinswap/.coinswap |
41 | | - environment: |
| 96 | + environment: &makerd-env |
42 | 97 | - RUST_LOG=${RUST_LOG:-info} |
43 | | - - TOR_SOCKS_PORT=${TOR_SOCKS_PORT:-19050} |
44 | | - - TOR_CONTROL_PORT=${TOR_CONTROL_PORT:-19051} |
45 | | - - TOR_AUTH_PASSWORD=${TOR_AUTH_PASSWORD:-coinswap} |
46 | | - - MAKER_NETWORK_PORT=${MAKER_NETWORK_PORT:-6112} |
47 | | - - MAKER_RPC_PORT=${MAKER_RPC_PORT:-6113} |
| 98 | + - MAKER_NETWORK_PORT=${MAKERD_PORT:-6102} |
| 99 | + - MAKER_RPC_PORT=${MAKERD_RPC_PORT:-6103} |
| 100 | + - TOR_SOCKS_PORT=${TOR_SOCKS_PORT:-9050} |
| 101 | + - TOR_CONTROL_PORT=${TOR_CONTROL_PORT:-9051} |
| 102 | + - TOR_AUTH_PASSWORD=${TOR_AUTH_PASSWORD} |
48 | 103 | - MIN_SWAP_AMOUNT=${MIN_SWAP_AMOUNT:-10000} |
49 | 104 | - FIDELITY_AMOUNT=${FIDELITY_AMOUNT:-50000} |
50 | 105 | - FIDELITY_TIMELOCK=${FIDELITY_TIMELOCK:-13104} |
51 | 106 | - BASE_FEE=${BASE_FEE:-100} |
52 | 107 | - AMOUNT_RELATIVE_FEE_PPT=${AMOUNT_RELATIVE_FEE_PPT:-1000} |
53 | | - - BITCOIN_RPC_HOST=${BITCOIN_RPC_HOST:-172.81.178.3:48332} |
| 108 | + - BITCOIN_RPC_HOST=${BITCOIN_RPC_HOST} |
54 | 109 | - BITCOIN_RPC_AUTH=${BITCOIN_RPC_AUTH:-user:password} |
| 110 | + - MAKERD_EXTRA_ARGS=${MAKERD_EXTRA_ARGS} |
| 111 | + - BITCOIN_WALLET_NAME=${BITCOIN_WALLET_NAME:-coinswap-maker} |
55 | 112 | restart: unless-stopped |
56 | 113 |
|
| 114 | + makerd-internal: |
| 115 | + image: coinswap/${IMAGE_NAME:-coinswap}:latest |
| 116 | + container_name: coinswap-makerd |
| 117 | + profiles: ["internal-tor"] |
| 118 | + network_mode: "host" |
| 119 | + command: *makerd-command |
| 120 | + volumes: |
| 121 | + - maker-data:/home/coinswap/.coinswap |
| 122 | + environment: *makerd-env |
| 123 | + restart: unless-stopped |
| 124 | + depends_on: |
| 125 | + - tor |
| 126 | + |
57 | 127 | volumes: |
| 128 | + bitcoin-data: |
| 129 | + driver: local |
58 | 130 | tor-data: |
59 | 131 | driver: local |
60 | 132 | maker-data: |
61 | 133 | driver: local |
| 134 | + |
| 135 | +networks: |
| 136 | + default: |
| 137 | + name: coinswap-network |
0 commit comments