version: "2.4"

volumes:
  database:
    name: exos-db
  blockchain:
    name: exos-data
  tipbot-blockchain:
    name: exos-tipbot-data
  tipbot-database:
    name: exos-tipbot-db

services:

  indexer:
    container_name: exos-indexer
    image: blockcore/indexer:0.2.50
    mem_limit: 4096m
    cpus: 2.000
    environment:
      VIRTUAL_HOST: exos.indexer.blockcore.net
      VIRTUAL_PORT: 9910
      VIRTUAL_PROTO: http
      VIRTUAL_NETWORK: proxy
      LETSENCRYPT_HOST: exos.indexer.blockcore.net
      LETSENCRYPT_EMAIL: admin@blockcore.net
      ASPNETCORE_URLS: https://+:9910
      Logging__LogLevel__Default: Debug
    command: ["--chain=EXOS"]
    restart: unless-stopped
    depends_on:
      mongo:
        condition: service_healthy
      chain:
        condition: service_healthy
    networks:
      - exosnetwork
      - proxy

  chain:
    container_name: exos-chain
    image: blockcore/node-multi:1.2.62
    mem_limit: 6144m
    cpus: 2.000
    healthcheck:
      test: curl --fail http://localhost:39120/api/Node/status || exit 1
      interval: 10s
      retries: 5
      start_period: 5s
      timeout: 10s
    command: ["--chain=EXOS", "-server=1", "-txindex=1", "-iprangefiltering=0", "-rpcallowip=10.202.0.0/8", "-rpcallowip=10.201.0.0/8", "-rpcallowip=192.168.0.0/8", "-rpcallowip=172.0.0.0/8", "-rpcbind=0.0.0.0", "-apiuri=http://0.0.0.0:39120", "-rpcuser=rpcuser", "-rpcpassword=rpcpassword"]
    restart: unless-stopped
    stop_grace_period: 15m
    volumes:
      - blockchain:/root/.blockcore
    ports:
      - 4562:4562 # Make this a public node.
    networks:
      - exosnetwork

  mongo:
    container_name: exos-mongo
    image: mongo:5.0.12
    mem_limit: 4096m
    cpus: 2.000
    healthcheck:
      test: echo 'db.runCommand("ping").ok' | mongo mongo:27017/test --quiet
      interval: 10s
      timeout: 10s
      retries: 5
      start_period: 40s
    restart: unless-stopped
    stop_grace_period: 5m
    volumes:
      - database:/data/db
      - database:/data/configdb
    networks:
      - exosnetwork

networks:
  exosnetwork:
    external: false
    name: exosnetwork
  proxy:
    external: true
    name: proxy

  # tipbot:
  #   container_name: exos-tipbot
  #   image: blockcore/tipbot:0.1.8
  #   mem_limit: 1024m
  #   cpus: 0.200
  #   env_file:
  #     - tipbot.env
  #   command: ["--chain=EXOS"]
  #   restart: unless-stopped
  #   depends_on:
  #     tipbot-database:
  #       condition: service_started
  #     tipbot-chain:
  #       condition: service_healthy
  #   networks:
  #     - exosnetwork

  # tipbot-chain:
  #   container_name: exos-tipbot-chain
  #   image: blockcore/node-multi:1.2.62
  #   mem_limit: 6144m
  #   cpus: 0.200
  #   healthcheck:
  #     test: curl --fail http://localhost:39120/api/Node/status || exit 1
  #     interval: 10s
  #     retries: 5
  #     start_period: 5s
  #     timeout: 10s
  #   command: ["--chain=EXOS", "-server=1", "-txindex=0", "-iprangefiltering=0", "-rpcallowip=10.202.0.0/8", "-rpcallowip=10.201.0.0/8", "-rpcallowip=192.168.0.0/8", "-rpcallowip=172.0.0.0/8", "-rpcbind=0.0.0.0", "-apiuri=http://0.0.0.0:39120", "-rpcuser=rpcuser", "-rpcpassword=rpcpassword"]
  #   restart: unless-stopped
  #   stop_grace_period: 15m
  #   volumes:
  #     - tipbot-blockchain:/root/.blockcore
  #   networks:
  #     - exosnetwork

  # tipbot-database:
  #   container_name: exos-tipbot-db
  #   image: mcr.microsoft.com/mssql/server:2019-latest
  #   mem_limit: 2048m
  #   cpus: 0.500
  #   env_file:
  #     - tipbot.env
  #   environment:
  #     ACCEPT_EULA: "Y"
  #   restart: unless-stopped
  #   volumes:
  #     - tipbot-database:/var/opt/mssql
  #   networks:
  #     - exosnetwork
