version: "3.8"
services:

  lotus-miner:
    hostname: lotus-miner
    env_file:
      - ../config/fixturenet-lotus/lotus-env.env
    image: cerc/lotus:local
    volumes:
      - ../config/fixturenet-lotus/setup-miner.sh:/docker-entrypoint-scripts.d/setup-miner.sh
      - ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car
      - $HOME/stack-orchestrator/app/data/config/fixturenet-lotus/genesis/.genesis-sectors:/root/.genesis-sectors
      - lotus-shared:/root/.lotus-shared
    healthcheck:
#      test: ["CMD-SHELL", "grep 'started ChainNotify channel' /var/log/lotus.log"]
#      test: ["CMD-SHELL", "[ -f /root/.lotus-shared/miner.addr ]"]
      test: ["CMD-SHELL", "[ -d /root/.lotus-miner-local-net ]"]
      interval: 10s
      timeout: 10s
      retries: 10
      start_period: 60s
    entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-miner.sh"]
    ports:
      - "1234"
      - "2345"
      - "3456"
      - "1777"

  lotus-node-1:
    hostname: lotus-node-1
    env_file:
      - ../config/fixturenet-lotus/lotus-env.env
    image: cerc/lotus:local
    volumes:
      - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh
      - ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car
      - lotus-shared:/root/.lotus-shared
    depends_on:
      lotus-miner:
        condition: service_healthy
    entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"]
    ports:
      - "1234"
      - "2345"
      - "3456"
      - "1777"

  lotus-node-2:
    hostname: lotus-node-2
    env_file:
      - ../config/fixturenet-lotus/lotus-env.env
    image: cerc/lotus:local
    volumes:
      - ../config/fixturenet-lotus/setup-node.sh:/docker-entrypoint-scripts.d/setup-node.sh
      - ../config/fixturenet-lotus/genesis/devgen.car:/devgen.car
      - lotus-shared:/root/.lotus-shared
    depends_on:
      lotus-miner:
        condition: service_healthy
    entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"]
    ports:
      - "1234"
      - "2345"
      - "3456"
      - "1777"

volumes:
  lotus-shared: