# Docker Compose configuration for OpenObserve
# OpenObserve is a cloud-native observability platform for logs, metrics, traces, and more
# https://github.com/openobserve/openobserve

x-defaults: &defaults
  restart: unless-stopped
  logging:
    driver: json-file
    options:
      max-size: 100m
      max-file: '3'

services:
  openobserve:
    <<: *defaults
    image: ${GLOBAL_REGISTRY:-public.ecr.aws/zinclabs/}openobserve:${OPENOBSERVE_VERSION:-v0.50.0}
    ports:
      - '${OPENOBSERVE_PORT_OVERRIDE:-5080}:5080'
    volumes:
      - openobserve_data:/data
    environment:
      - TZ=${TZ:-UTC}
      - ZO_DATA_DIR=${ZO_DATA_DIR:-/data}
      - ZO_ROOT_USER_EMAIL=${ZO_ROOT_USER_EMAIL:-root@example.com}
      - ZO_ROOT_USER_PASSWORD=${ZO_ROOT_USER_PASSWORD:-Complexpass#123}
      # Optional: S3 configuration for object storage
      - ZO_S3_BUCKET_NAME=${ZO_S3_BUCKET_NAME:-}
      - ZO_S3_REGION_NAME=${ZO_S3_REGION_NAME:-}
      - ZO_S3_ACCESS_KEY=${ZO_S3_ACCESS_KEY:-}
      - ZO_S3_SECRET_KEY=${ZO_S3_SECRET_KEY:-}
    healthcheck:
      test: [CMD, wget, --no-verbose, --tries=1, --spider, 'http://localhost:5080/healthz']
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
    deploy:
      resources:
        limits:
          cpus: ${OPENOBSERVE_CPU_LIMIT:-2.0}
          memory: ${OPENOBSERVE_MEMORY_LIMIT:-2G}
        reservations:
          cpus: ${OPENOBSERVE_CPU_RESERVATION:-0.1}
          memory: ${OPENOBSERVE_MEMORY_RESERVATION:-512M}

volumes:
  openobserve_data:
