version: '3.1'

services:
  harmony-mainnet:
    build: ./harmony/build
    command: bash -c "/harmony.sh && /binary --log.dir /harmony/log --run explorer --run.shard 0 --dns.zone t.hmny.io --http.ip 0.0.0.0 --datadir /harmony"
    sysctls:
      net.core.somaxconn: 1024
      # net.core.netdev_max_backlog: 65536
      net.ipv4.tcp_tw_reuse: 1
      net.ipv4.tcp_rmem: 4096 65536 16777216
      net.ipv4.tcp_wmem: 4096 65536 16777216
      # net.ipv4.tcp_mem: 65536 131072 262144
    ulimits:
      nproc: 65535
      nofile:
        soft: 65535
        hard: 65535
    expose:
      - "9500"
      - "9000"
      - "6000"
      - "30303"
    volumes:
      - ./harmony:/harmony/
      - ./bootstrap_skript/harmony.sh:/harmony.sh
    networks:
      - chains
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.harmony-mainnet-stripprefix.stripprefix.prefixes=/harmony"
      - "traefik.http.services.harmony-mainnet.loadbalancer.server.port=9500"
      - "traefik.http.routers.harmony-mainnet.entrypoints=websecure"
      - "traefik.http.routers.harmony-mainnet.tls.certresolver=myresolver"
      - "traefik.http.routers.harmony-mainnet.rule=Host(`$DOMAIN`) && PathPrefix(`/harmony`)"
      - "traefik.http.routers.harmony-mainnet.middlewares=harmony-mainnet-stripprefix, ipwhitelist"
      - "prometheus-scrape.enabled=true"
      - "prometheus-scrape.port=9900"
      - "prometheus-scrape.job_name=harmony-mainnet"

volumes:
    harmony:  