version: "3.7"
services:
  node:
    image: registry.cn-hangzhou.aliyuncs.com/dahaige/node:gemini-3g-2024-jan-24
    volumes:
      - /root/node:/var/subspace:rw
    networks:
      internal_network:
        ipv4_address: 172.30.0.1
    container_name: node
    ports:
      - "0.0.0.0:30333:30333/udp"
      - "0.0.0.0:30333:30333/tcp"
      - "0.0.0.0:30433:30433/udp"
      - "0.0.0.0:30433:30433/tcp"
    restart: unless-stopped
    command:
      [
        "--chain", "gemini-3g",
        "--base-path", "/var/subspace",
        "--blocks-pruning", "256",
        "--state-pruning", "archive-canonical",
        "--port", "30333",
        "--dsn-listen-on", "/ip4/0.0.0.0/udp/30433/quic-v1",
        "--dsn-listen-on", "/ip4/0.0.0.0/tcp/30433",
        "--dsn-out-connections", "100",
        "--dsn-pending-out-connections", "100",
        "--in-peers", "100",
        "--out-peers", "100",
        "--rpc-cors", "all",
        "--rpc-methods", "unsafe",
        "--rpc-external",
        "--no-private-ipv4",
        "--validator",
        "--timekeeper-cpu-cores", "16,17,18,19",
        "--name", "dahainode01"
      ]
    healthcheck:
      timeout: 5s
      interval: 30s
      retries: 60
      
  farmer:
    depends_on:
      node:
        condition: service_healthy
    image: registry.cn-hangzhou.aliyuncs.com/dahaige/farmer:gemini-3g-2024-jan-24
    volumes:
      - /data1:/data1:rw
      - /data2:/data2:rw
      - /data3:/data3:rw
      - /data4:/data4:rw
    networks:
      internal_network:
        ipv4_address: 172.30.0.2
    container_name: farmer   
    ports:
      - "0.0.0.0:30533:30533/udp"
      - "0.0.0.0:30533:30533/tcp"
    restart: unless-stopped
    command:
      [
        "farm",
        "--node-rpc-url", "ws://172.30.0.1:9944",
        "--listen-on", "/ip4/0.0.0.0/udp/30533/quic-v1",
        "--listen-on", "/ip4/0.0.0.0/tcp/30533",
        "--pending-out-connections", "400",
        "--pending-in-connections", "400",
        #"--sector-encoding-concurrency", "4",
        "--sector-downloading-concurrency", "4",
        "--plotting-cpu-cores", "0,1,2,3 4,5,6,7 8,9,10,11 12,13,14,15",
        "--replotting-cpu-cores", "0,2 4,6 8,10 12,14",
        "--farm-during-initial-plotting", "true",
        "--reward-address", "stAV4W15a7eFNmdt87jiG8SsGFmYPRwjLA62gYZ8r3pqxcGEz",
        "path=/data1,size=7200G",
        "path=/data2,size=7200G",
        "path=/data3,size=7200G",
        "path=/data4,size=7200G"
      ]

volumes:
  node-data:
  farmer-data: 

networks:
  internal_network:
    enable_ipv6: true
    name: internal_network
    driver_opts:
      "com.docker.network.bridge.name": "br-proxy"
    ipam:
      config:
        - subnet: 172.30.0.0/24
          gateway: 172.30.0.254
        - subnet: 2408:823d:5615:9e70::/62
          gateway: 2408:823d:5615:9e70::1