# 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:
  banyandb:
    image: ${BANYANDB_IMAGE}:${BANYANDB_IMAGE_TAG}
    networks: [ sw ]
    expose:
      - 17912
    ports:
      - "17913:17913"
    command: standalone --observability-modes=native
    healthcheck:
      test: ["CMD", "nc", "-z", "127.0.0.1", "17913"]
      interval: 30s
      timeout: 10s
      retries: 3

  oap:
    image: ${SW_OAP_IMAGE}:${SW_OAP_IMAGE_TAG}
    networks: [ sw ]
    environment:
      SW_HEALTH_CHECKER: default # @feature: health-check;
      SW_OTEL_RECEIVER: default # @feature: vm; enable the OC receiver that receives the VM metrics
      SW_OTEL_RECEIVER_ENABLED_OTEL_METRICS_RULES: vm,mysql/*,postgresql/*,elasticsearch/*,rabbitmq/*,mongodb/*,rocketmq/*,pulsar/*,activemq/*,flink/* # @feature: vm,mysql,postgresql,elasticsearch; enable the OC rules that analyse the metrics
      SW_STORAGE: banyandb
      SW_STORAGE_BANYANDB_TARGETS: banyandb:17912
      SW_TELEMETRY: prometheus # @feature: so11y; expose the metrics of self o11y through prometheus
      SW_PROMETHEUS_FETCHER: default # @feature: so11y; fetch the metrics of self o11y through prometheus
      JAVA_OPTS: "-Xms2048m -Xmx2048m"
      SW_METER_ANALYZER_ACTIVE_FILES: datasource,threadpool,satellite,spring-sleuth,go-runtime,java-agent,go-agent
    healthcheck:
      test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/11800"]
      interval: 30s
      timeout: 10s
      retries: 3
    depends_on:
      banyandb:
        condition: service_healthy

  ui:
    image: ${SW_UI_IMAGE}
    networks: [ sw ]
    ports:
      - "9999:8080"
    depends_on:
      oap:
        condition: service_healthy
    environment:
      SW_OAP_ADDRESS: http://oap:12800

networks:
  sw:
