version: "2.4"

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

services:

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


  chain:
    container_name: home-chain
    image: blockcore/node-multi:1.2.62
    mem_limit: 2048m
    cpus: 0.200
    healthcheck:
      test: curl --fail http://localhost:33333/api/Node/status || exit 1
      interval: 10s
      retries: 5
      start_period: 5s
      timeout: 10s
    command: ["--chain=HOME", "-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:33333", "-rpcuser=rpcuser", "-rpcpassword=rpcpassword"]
    restart: unless-stopped
    stop_grace_period: 15m
    volumes:
      - blockchain:/root/.blockcore
    ports:
      - 33331:33331 # Make this a public node.
    networks:
      - homecoinnetwork

  mongo:
    container_name: home-mongo
    image: mongo:5.0.12
    mem_limit: 2048m
    cpus: 0.200
    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:
      - homecoinnetwork

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

  tipbot-chain:
    container_name: home-tipbot-chain
    image: blockcore/node-multi:1.2.62
    mem_limit: 2048m
    cpus: 0.200
    healthcheck:
      test: curl --fail http://localhost:33333/api/Node/status || exit 1
      interval: 10s
      retries: 5
      start_period: 5s
      timeout: 10s
    command: ["--chain=HOME", "-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:33333", "-rpcuser=rpcuser", "-rpcpassword=rpcpassword"]
    restart: unless-stopped
    stop_grace_period: 15m
    volumes:
      - tipbot-blockchain:/root/.blockcore
    networks:
      - homecoinnetwork

  tipbot-database:
    container_name: home-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:
      - homecoinnetwork

networks:
  homecoinnetwork:
    external: false
    name: homecoinnetwork
  proxy:
    external: true
    name: proxy