version: '3'
services:
  opensearch-node1:
    image: {{docker_image}}:{{os_version}}
    container_name: opensearch-node1
    labels:
      io.benchmark.description: "opensearch-benchmark"
    {%- if docker_cpu_count is defined %}
    cpu_count: {{docker_cpu_count}}
    {%- endif %}
    {%- if docker_mem_limit is defined %}
    mem_limit: {{docker_mem_limit}}
    {%- endif %}
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node1
      - discovery.seed_hosts=opensearch-node1
      - DISABLE_INSTALL_DEMO_CONFIG=true
      - bootstrap.memory_lock=true
      - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    volumes:
      - {{os_data_dir}}:/usr/share/opensearch/data
      - {{os_log_dir}}:/var/log/opensearch
      - {{os_heap_dump_dir}}:/usr/share/opensearch/heapdump
    {%- for host_path, docker_path in mounts.items() %}
      - {{host_path}}:{{docker_path}}
    {%- endfor %}
    ports:
      - {{http_port}}:{{http_port}}
      - 9200:9200
      - 9600:9600
    networks:
      - opensearch-net
    healthcheck:
          test: curl -f http://localhost:{{http_port}} -u admin:admin --insecure
          interval: 5s
          timeout: 2s
          retries: 10

volumes:
  opensearch-data1:
networks:
  opensearch-net: