# Starts the SpeedTest using IRIS Community. 
#
# This is good because it doesn't require an IRIS license to run.
#
# This is bad because IRIS Community has two important limitations:
# - Max of 5 connections: So we won't be able to use a high number of threads
# - Max Database size of 10Gb: So we won't be able to let the speed test run for too long
#
# But this configuration is good for development.
version: '3.7'

services:
  htapui:
    depends_on:
      - htapmaster
    container_name: htapui
    security_opt:             
    - seccomp:unconfined
    privileged: true   
    hostname: htapui
    image: intersystemsdc/irisdemo-demo-htap:ui-version-2.8.5
    ports:
    - "10000:4200" # Where Node Will be listening

  htapirisdb: 
    # We can't use clean IRIS Community because its HEALTHCHECK period is too long.
    # So we are going to use our irisdemo-base-db image.
    #image: store/intersystems/iris-community:2019.3.0.309.0
    # version-1.2 is based on IRIS Community 2019.3
    # version-1.4 is based on IRIS Community 2019.4
    # version-1.5.1 is based on IRIS Community 2020.1.0.197.0
    # version-1.5.2 is based on IRIS Community 2020.2.0.196.0
    # version-1.7.1 is based on IRIS Community 2020.3.0.200.0
    # version-1.8.0 is based on IRIS Community 2021.1.0.215.0
    # version-1.8.1 is based on IRIS Community 2021.1.0.215.3
    # version-1.9.1 is based on IRIS Community 2021.2.0.619.0
    # version-1.9.2 is based on IRIS Community 2021.2.0.637.0
    # version-1.9.5 is based on IRIS Community 2022.2
    # version-1.9.6 is based on IRIS Community 2023.2.0.202.0
    # image: intersystemsdc/irisdemo-base-irisdb-community:version-1.9.6
    image: fanji0305/myimage:1.0
    hostname: htapirisdb
    init: true
    container_name: htapirisdb
    ports:
    - "10001:52773" # 52773 is the webserver/management portal port: http://localhost:9092/csp/sys/UtilHome.csp

  # Versions prior to 2020.3.0.200.0 would use the following JDBC URL with port 51773:
  # jdbc:IRIS://htapirisdb:51773/USER
  # With IRIS 2020.3.0.200.0, the port has changed to 1972
  htapmaster:
    depends_on: 
      - htapirisdb
    container_name: htapmaster
    security_opt:             
    - seccomp:unconfined
    privileged: true   
    hostname: htapmaster
    init: true
    image: intersystemsdc/irisdemo-demo-htap:master-version-2.8.5
    ports:
      - "10002:8080" # Where Springboot Will be listening
    environment:
      - MASTER_SPEEDTEST_TITLE=SpeedTest | IRIS Community 2024.3
      - START_CONSUMERS=true
      - DISABLE_JOURNAL_FOR_DROP_TABLE=true
      - DISABLE_JOURNAL_FOR_TRUNCATE_TABLE=true
      - INGESTION_THREADS_PER_WORKER=2
      - INGESTION_BATCH_SIZE=1000
      - INGESTION_JDBC_URL=jdbc:IRIS://htapirisdb:1972/USER
      - INGESTION_JDBC_USERNAME=SuperUser
      - INGESTION_JDBC_PASSWORD=sys
      - CONSUMER_JDBC_URL=jdbc:IRIS://htapirisdb:1972/USER
      - CONSUMER_JDBC_USERNAME=SuperUser
      - CONSUMER_JDBC_PASSWORD=sys
      - CONSUMER_THREADS_PER_WORKER=1
      - CONSUMER_TIME_BETWEEN_QUERIES_IN_MILLIS=0
      - DATABASE_SIZE_IN_GB=1

  ingest-worker1:
    depends_on: 
      - htapmaster
    container_name: ingest-worker1
    security_opt:             
    - seccomp:unconfined
    privileged: true   
    hostname: ingest-worker1
    init: true
    image: intersystemsdc/irisdemo-demo-htap:iris-jdbc-ingest-worker-version-2.8.5
    ports:
      - "10003:8080" # Where Springboot Will be listening
    environment:
      - MASTER_HOSTNAME=htapmaster
      - MASTER_PORT=8080

  query-worker1:
    depends_on: 
      - htapmaster
    container_name: query-worker1
    security_opt:             
    - seccomp:unconfined
    privileged: true   
    hostname: query-worker1
    init: true
    image: intersystemsdc/irisdemo-demo-htap:iris-jdbc-query-worker-version-2.8.5
    ports:
      - "10004:8080" # Where Springboot Will be listening
    environment:
      - MASTER_HOSTNAME=htapmaster
      - MASTER_PORT=8080
  
  # ingest-worker2:
  #   depends_on: 
  #     - htapmaster
  #   container_name: ingest-worker2
  #   hostname: ingest-worker2
  #   init: true
  #   image: intersystemsdc/irisdemo-demo-htap:iris-jdbc-ingest-worker-version-2.8.5
  #   ports:
  #     - "10005:8080" # Where Springboot Will be listening
  #   environment:
  #     - MASTER_HOSTNAME=htapmaster
  #     - MASTER_PORT=8080

  # query-worker2:
  #   depends_on: 
  #     - htapmaster
  #   container_name: query-worker2
  #   hostname: query-worker2
  #   init: true
  #   image: intersystemsdc/irisdemo-demo-htap:iris-jdbc-query-worker-version-2.8.5
  #   ports:
  #     - "10006:8080" # Where Springboot Will be listening
  #   environment:
  #     - MASTER_HOSTNAME=htapmaster
  #     - MASTER_PORT=8080