# 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
    environment:
      SW_METER_ANALYZER_ACTIVE_FILES: network-profiling
      SW_LOG_LAL_FILES: slow-trace-lal
    volumes:
      - ./network-profiling.yaml:/skywalking/config/meter-analyzer-config/network-profiling.yaml
      - ./slow-trace-lal.yaml:/skywalking/config/lal/slow-trace-lal.yaml

  banyandb:
    extends:
      file: ../../../../script/docker-compose/base-compose.yml
      service: banyandb

  service:
    build:
      context: .
      dockerfile: Dockerfile.service
    expose:
      - 80
    networks:
      - e2e

  rover:
    image: "ghcr.io/apache/skywalking-rover/skywalking-rover:${SW_ROVER_COMMIT}"
    networks:
      - e2e
    privileged: true
    pid: host
    environment:
      ROVER_HOST_MAPPING: /host
      ROVER_BACKEND_ADDR: oap:11800
      ROVER_PROFILING_ACTIVE: "true"
      ROVER_PROFILING_CHECK_INTERVAL: 2s
      ROVER_PROFILING_FLUSH_INTERVAL: 5s
      ROVER_PROFILING_TASK_ON_CPU_DUMP_PERIOD: 9ms
    volumes:
      - /:/host
      - ./rover_configs.yaml:/skywalking/configs/rover_configs.yaml

  proxy:
    image: nginx:1.23.3
    networks:
      - e2e
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
    expose:
      - 80
    healthcheck:
      test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/80" ]
      interval: 5s
      timeout: 60s
      retries: 120

networks:
  e2e: