version: "3"

services:
  # Ophion Agent - coleta métricas do host
  ophion-agent:
    image: ophion-agent
    build:
      context: ../../
      dockerfile: deploy/docker/Dockerfile.agent
    container_name: ophion-agent
    restart: always
    hostname: ${HOSTNAME:-remote-host}
    network_mode: host
    pid: host
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /:/hostfs:ro
    environment:
      - OPHION_SERVER=${OPHION_SERVER:-http://10.83.23.4:8080}
      - OPHION_API_KEY=${AGENT_KEY:-ophion-secret-agent-key-2024}
      - OPHION_INTERVAL=30s
      - OPHION_DOCKER=true
      - OPHION_LOGS=true

  # OTel Collector local - recebe traces/logs das apps e envia pro server
  otel-collector:
    image: otel/opentelemetry-collector-contrib:0.96.0
    container_name: ophion-otel-collector
    restart: always
    command: ["--config=/etc/otel-collector-config.yaml"]
    volumes:
      - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - "4317:4317"
      - "4318:4318"
    environment:
      - OPHION_SERVER=${OPHION_SERVER:-http://10.83.23.4:8080}
