# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

version: '2.1'

services:
  oap:
    extends:
      file: ../../script/docker-compose/base-compose.yml
      service: oap
    ports:
      - 12800
    networks:
      e2e:

  provider:
    extends:
      file: ../../script/docker-compose/base-compose.yml
      service: provider
    environment:
      SW_METER_REPORT_INTERVAL: 5
      kafka_enable: "true"
      kafka_topic: topic
      kafka_server: kafka:9092
    depends_on:
      - oap
      - kafka
    ports:
      - "9090:9090"
    networks:
      e2e:

  consumer:
    extends:
      file: ../../script/docker-compose/base-compose.yml
      service: consumer
    environment:
      SW_AGENT_COLLECTOR_BACKEND_SERVICES: oap:11800
      SW_AGENT_NAME: e2e-service-consumer
      kafka_enable: "true"
      kafka_topic: topic
      kafka_server: kafka:9092
    depends_on:
      - oap
      - kafka
    ports:
      - "9092:9092"
    networks:
      e2e:
  zookeeper:
    image: 'bitnami/zookeeper:latest'
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
    networks:
      e2e:
  kafka:
    image: 'bitnami/kafka:2.4.1'
    environment:
      - KAFKA_BROKER_ID=1
      - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092
      - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
      - ALLOW_PLAINTEXT_LISTENER=yes
    depends_on:
      - zookeeper
    networks:
      e2e:
networks:
  e2e:
