captainVersion: 4
services:
    $$cap_appname:
        image: docker.elastic.co/elasticsearch/elasticsearch:$$cap_elasticsearch_version
        volumes:
            - $$cap_appname-elasticsearch-data:/usr/share/elasticsearch/data
        restart: always
        environment:
            ES_JAVA_OPTS: -Xms512m -Xmx512m
            cluster.name: $$cap_elasticsearch_cluster_name
            cluster.initial_master_nodes: $$cap_elasticsearch_cluster_initial_master_nodes
            http.port: $$cap_container_port
            node.name: $$cap_appname
            node.master: $$cap_elasticsearch_node_master
            node.data: $$cap_elasticsearch_node_data
            discovery.seed_hosts: $$cap_elasticsearch_discovery_seed_hosts
        caproverExtra:
            containerHttpPort: $$cap_container_port
caproverOneClickApp:
    variables:
        - id: $$cap_elasticsearch_version
          label: 'Elasticsearch Version Tag '
          description: 'Checkout the releases overview: https://www.elastic.co/de/downloads/elasticsearch'
          defaultValue: 7.8.0
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_elasticsearch_cluster_name
          label: Cluster Name
          description: Only nodes within the same cluster name can be combined
          defaultValue: elasticsearch-cluster
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_elasticsearch_cluster_initial_master_nodes
          label: Cluster Initial Master Nodes
          description: Nodes to be used as master nodes. If this is the master node, put the 'App Name' selected above
          defaultValue: ''
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_elasticsearch_node_data
          label: Node Data
          description: Should the node used for storing data? (true / false)
          defaultValue: 'true'
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_elasticsearch_node_master
          label: Node Master
          description: Define node as master-eligible (usual first node TRUE, others FALSE).
          defaultValue: 'true'
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_elasticsearch_discovery_seed_hosts
          label: Discovery seed hosts
          defaultValue: srv-captain--XXX
          description: Domains to start the discovery of other nodes
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_container_port
          label: Container TCP Port
          defaultValue: '9200'
          description: Internal port for Elasticsearch the container listens to.
          validRegex: /^([0-9])+$/
    instructions:
        start: 'Elasticsearch is a distributed, RESTful search and analytics engine. This image can be used for single nodes and cluster setups. IMPORTANT: Be sure to extend the virtual memory on all your hosts! (increase "echo ''vm.max_map_count=262144'' >> /etc/sysctl.conf" and restart "sysctl -p")'
        end: 'Deployment of Elasticsearch is finished. You might see 502 errors for the next 2 minutes. Goto <YOUR-APP-URL>/_cat/health to check the health of your cluster. IMPORTANT: Be sure to extend the virtual memory on all your hosts! (increase "echo ''vm.max_map_count=262144'' >> /etc/sysctl.conf" and restart "sysctl -p")'
    displayName: ''
    isOfficial: true
    description: Elasticsearch is a search engine based on the Lucene library
    documentation: Look at https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html for further assistance using Elasticsearch with docker.
