version: "3"

services:
  bitcoind:
    environment:
      BITCOIN_EXTRA_ARGS: |
        rpcauth=eclair:d3a244200d5c946f6bef48e6583ec979$$215049513aef33245dfec8ff3ab5e749458fde51ede931dec04c767c0732d468
  eclair_bitcoin:
    container_name: btcpayserver_eclair_bitcoin
    restart: unless-stopped
    stop_signal: SIGINT
    image: acinq/eclair:release-0.7.0
    environment:
      PUBLIC_HOST: ${BTCPAY_HOST}
      JAVA_OPTS: |
        -Declair.printToConsole
        -Declair.headless
        -Declair.chain=${NBITCOIN_NETWORK:-regtest}
        -Declair.server.binding-ip=0.0.0.0
        -Declair.server.public-ips.0=${BTCPAY_HOST}
        -Declair.server.port=9735
        -Declair.api.enabled=true
        -Declair.api.binding-ip=0.0.0.0
        -Declair.api.port=8080
        -Declair.node-alias=${LIGHTNING_ALIAS}
        -Declair.api.password=DwubwWsoo3
        -Declair.bitcoind.host=bitcoind
        -Declair.bitcoind.rpcport=43782
        -Declair.bitcoind.rpcuser=eclair
        -Declair.bitcoind.rpcpassword=sFLjcg99Puh4k3CAZCQkLvC-fcoFUFRyKwKcXQKa7dw=
        -Declair.bitcoind.zmqblock=tcp://bitcoind:28334
        -Declair.bitcoind.zmqtx=tcp://bitcoind:28333
    expose:
      - "9735" # server port
      - "8080" # api port
    volumes:
      - "bitcoin_datadir:/etc/bitcoin"
      - "eclair_bitcoin_datadir:/data"
    links:
      - bitcoind

  bitcoin_rtl:
    image: shahanafarooqui/rtl:0.12.3
    restart: unless-stopped
    environment:
      LN_IMPLEMENTATION: ECL
      LN_SERVER_URL: http://eclair_bitcoin:8080
      LN_API_PASSWORD: DwubwWsoo3
      BITCOIND_CONFIG_PATH: /etc/bitcoin/bitcoin.conf
      RTL_SSO: 1
      RTL_COOKIE_PATH: /data/.cookie
      LOGOUT_REDIRECT_LINK: /server/services
    volumes:
      - "bitcoin_datadir:/etc/bitcoin"
      - "eclair_bitcoin_datadir:/etc/eclair"
      - "eclair_bitcoin_rtl_datadir:/data"
    expose:
      - "3000"
    labels:
      traefik.enable: true
      traefik.http.routers.bitcoin_rtl.rule: Host(`${BTCPAY_HOST}`) && (Path(`/rtl`) || PathPrefix(`/rtl/`))
    links:
      - eclair_bitcoin

  btcpayserver:
    environment:
      BTCPAY_BTCLIGHTNING: "type=eclair;server=http://eclair_bitcoin:8080;password=DwubwWsoo3"
      BTCPAY_BTCEXTERNALRTL: "server=/rtl/api/authenticate/cookie;cookiefile=/etc/eclair_bitcoin_rtl/.cookie"
    volumes:
      - "eclair_bitcoin_datadir:/etc/eclair_bitcoin"
      - "eclair_bitcoin_rtl_datadir:/etc/eclair_bitcoin_rtl"
    links:
      - eclair_bitcoin
volumes:
  eclair_bitcoin_datadir:
  eclair_bitcoin_rtl_datadir:

incompatible:
  - pruning
required:
  - "opt-add-zmq"
  - "opt-txindex"
exclusive:
  - lightning
