version: "3"

services:
  btcpayserver:
    restart: unless-stopped
    container_name: generated_btcpayserver_1
    image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:2.1.0}
    expose:
      - "49392"
    environment:
      # BTCPay settings
      BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Application Name=btcpayserver;Database=btcpayserver${NBITCOIN_NETWORK:-regtest}
      BTCPAY_EXPLORERPOSTGRES: User ID=postgres;Host=postgres;Port=5432;Application Name=btcpayserver;MaxPoolSize=80;Database=nbxplorer${NBITCOIN_NETWORK:-regtest}
      BTCPAY_NETWORK: ${NBITCOIN_NETWORK:-regtest}
      BTCPAY_BIND: 0.0.0.0:49392
      BTCPAY_ROOTPATH: ${BTCPAY_ROOTPATH:-/}
      BTCPAY_SSHCONNECTION: "root@host.docker.internal"
      BTCPAY_SSHTRUSTEDFINGERPRINTS: ${BTCPAY_SSHTRUSTEDFINGERPRINTS}
      BTCPAY_SSHKEYFILE: ${BTCPAY_SSHKEYFILE}
      BTCPAY_SSHAUTHORIZEDKEYS: ${BTCPAY_SSHAUTHORIZEDKEYS}
      BTCPAY_DEBUGLOG: btcpay.log
      BTCPAY_UPDATEURL: https://api.github.com/repos/btcpayserver/btcpayserver/releases/latest
      BTCPAY_DOCKERDEPLOYMENT: "true"
    labels:
      traefik.enable: "true"
      traefik.http.routers.btcpayserver.rule: Host(`${BTCPAY_HOST}`)
      # Traefic can not accept list from BTCPAY_ADDITIONAL_HOSTS, see Traefik/README.md
    links:
      - postgres
    volumes:
      - "btcpay_datadir:/datadir"
      - "nbxplorer_datadir:/root/.nbxplorer"
      - "$<BTCPAY_HOST_SSHAUTHORIZEDKEYS>?:${BTCPAY_SSHAUTHORIZEDKEYS}"
      - "btcpay_pluginsdir:/root/.btcpayserver/Plugins"

volumes:
  btcpay_datadir:
  btcpay_pluginsdir:

required:
  - "postgres"
  - "nbxplorer"
  - "btcpayserver"
recommended:
  - "opt-add-tor"
