version: "3"
# ============LICENSE_START=======================================================
# csit-dcaegen2-collectors-hv-ves
# ================================================================================
# Copyright (C) 2018-2019 NOKIA
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END=========================================================


networks:
  hv-ves-default:
    external:
      name: $CONTAINERS_NETWORK

services:

  #
  # DMaaP Message Router
  #

  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - "2181:2181"
    networks:
      - hv-ves-default

  kafka:
    image: wurstmeister/kafka
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_HOST_NAME: "kafka"
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
      KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
      KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://kafka:9092"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    depends_on:
      - zookeeper
    networks:
      - hv-ves-default

  #
  # Consul / CBS
  #

  consul-server:
    image: docker.io/consul:1.0.6
    ports:
      - "8500:8500"
    volumes:
      - ./consul/:/consul/config
    networks:
      - hv-ves-default

  config-binding-service:
    image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:2.2.4
    ports:
      - "10000:10000"
    environment:
      - CONSUL_HOST
    depends_on:
      - consul-server
    networks:
      - hv-ves-default

  #
  # DCAE HV VES Collector
  #

  hv-ves-collector:
    image: ${DOCKER_REGISTRY}/${HV_VES_COLLECTOR_NAMESPACE}/${HV_VES_GROUP_ID}.${HV_VES_IMAGE}:${HV_VES_VERSION}
    ports:
      - "6060:6060"
      - "6061:6061/tcp"
    command: ["--configuration-file", "/etc/hv-ves/configuration/secure.json"]
    environment:
      - JAVA_OPTS
      - HOSTNAME=${HV_VES_HOSTNAME}
      - CONSUL_HOST
      - CONFIG_BINDING_SERVICE
    healthcheck:
      interval: 10s
      timeout: 5s
      retries: 2
      test: ${HV_VES_HEALTHCHECK_CMD}
    volumes:
      - ./collector/:/etc/hv-ves/
    depends_on:
      - config-binding-service
      - kafka
    networks:
      - hv-ves-default

  unencrypted-hv-ves-collector:
    image: ${DOCKER_REGISTRY}/${HV_VES_COLLECTOR_NAMESPACE}/${HV_VES_GROUP_ID}.${HV_VES_IMAGE}:${HV_VES_VERSION}
    ports:
      - "7060:6060"
      - "7061:6061/tcp"
    command: ["--configuration-file", "/etc/hv-ves/configuration/insecure.json"]
    environment:
      - JAVA_OPTS
      - HOSTNAME=${HV_VES_HOSTNAME}
      - CONSUL_HOST
      - CONFIG_BINDING_SERVICE
    healthcheck:
      interval: 10s
      timeout: 5s
      retries: 2
      test: ${HV_VES_HEALTHCHECK_CMD}
    volumes:
      - ./collector/:/etc/hv-ves/
    depends_on:
      - config-binding-service
      - kafka
    networks:
      - hv-ves-default

  dcae-app-simulator:
    image: ${DOCKER_REGISTRY}/${HV_VES_COLLECTOR_NAMESPACE}/${HV_VES_GROUP_ID}.${DCAE_APP_SIMULATOR_IMAGE}:${HV_VES_VERSION}
    ports:
      - "6063:6063/tcp"
    command: ["--listen-port", "6063", "--kafka-bootstrap-servers", "kafka:9092", "--kafka-topics", "non-existing-topic"]
    healthcheck:
      interval: 10s
      timeout: 5s
      retries: 2
      test: "curl --request GET --fail --silent --show-error localhost:6063/healthcheck"
    depends_on:
      - kafka
    networks:
      - hv-ves-default