services:
  unbound:
    image: alpinelinux/unbound
    restart: unless-stopped

    configs:
      - source: unbound_conf
        target: /etc/unbound/unbound.conf
        uid: "100"
        gid: "101"

    networks:
      default:
        ipv4_address: 172.28.0.53

  happydomain:
    image: happydomain/happydomain
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "8081:8081"
    environment:
      HAPPYDOMAIN_NO_AUTH: "1"

      # Override some checkers options: use local checkers instead of remote public ones
      HAPPYDOMAIN_CHECKER_MATRIXIM_FEDERATIONTESTERSERVER: "http://matrixfederationtester:8080/api/report?server_name=%s"
      HAPPYDOMAIN_CHECKER_ZONEMASTER_ZONEMASTERAPIURL: "http://zonemaster:5000"
      HAPPYDOMAIN_CHECKER_DNSVIZ_ENDPOINT: "http://dnsviz:8080"

      # Add more settings here
      # HAPPYDOMAIN_MAIL_SMTP_HOST: "mailer"

    dns:
      - 172.28.0.53
    restart: unless-stopped

    volumes:
      - storage:/var/lib/happydomain:rw

  dnsviz:
    image: happydomain/checker-dnsviz
    restart: unless-stopped

  matrixfederationtester:
    image: matrixdotorg/federation-tester-backend
    environment:
      BIND_ADDRESS: "0.0.0.0:8080"
    restart: unless-stopped

  zonemaster:
    image: zonemaster/backend
    command: full
    restart: unless-stopped

configs:
  unbound_conf:
    content: |
      server:
          verbosity: 1
          interface: 0.0.0.0
          port: 53
          do-ip4: yes
          do-ip6: no
          do-udp: yes
          do-tcp: yes

          access-control: 127.0.0.0/8 allow
          access-control: 172.28.0.0/24 allow

          # Short cache for a testing resolver
          cache-max-ttl: 60

          # Buffers: let the system decide
          so-sndbuf: 0
          so-rcvbuf: 0

          # Trust anchor (static, ships with the image)
          trust-anchor-file: "/etc/unbound/root.key"

volumes:
  storage:

networks:
  default:
    ipam:
      config:
        - subnet: 172.28.0.0/24
