services: otel-queue-init: image: alpine:3.21.2 command: ["sh", "-c", "chown 10001:10001 /queue && chmod 0700 /queue"] volumes: - otel-queue:/queue networks: [observability] restart: "no" read_only: true cap_drop: ["ALL"] cap_add: ["CHOWN", "FOWNER"] security_opt: ["no-new-privileges:true"] otel-collector: image: otel/opentelemetry-collector-contrib:0.117.0 command: ["--config=/etc/otelcol/config.yaml"] environment: APP_ENV: ${APP_ENV:-production-like} RELEASE_VERSION: ${RELEASE_VERSION:-unknown} OTEL_REMOTE_ENDPOINT: ${OTEL_REMOTE_ENDPOINT} OTEL_REMOTE_AUTH_HEADER: ${OTEL_REMOTE_AUTH_HEADER} expose: ["4317", "4318", "13133", "8888"] volumes: - ./otel-collector.yaml:/etc/otelcol/config.yaml:ro - otel-queue:/var/lib/otelcol/queue networks: [observability, backend] depends_on: otel-queue-init: {condition: service_completed_successfully} healthcheck: test: ["CMD", "/otelcol-contrib", "validate", "--config=/etc/otelcol/config.yaml"] interval: 30s timeout: 10s retries: 3 restart: unless-stopped read_only: true tmpfs: ["/tmp:size=32m,mode=1777"] user: "10001:10001" cap_drop: ["ALL"] security_opt: ["no-new-privileges:true"] mem_limit: 512m cpus: 0.5 logging: driver: json-file options: {max-size: "50m", max-file: "5"} otel-collector-local: image: otel/opentelemetry-collector-contrib:0.117.0 profiles: ["observability-local"] command: ["--config=/etc/otelcol/config.yaml"] expose: ["4317", "4318", "13133"] volumes: - ./otel-collector.local.yaml:/etc/otelcol/config.yaml:ro networks: [observability] healthcheck: test: ["CMD", "/otelcol-contrib", "validate", "--config=/etc/otelcol/config.yaml"] interval: 30s timeout: 10s retries: 3 read_only: true tmpfs: ["/tmp:size=16m,mode=1777"] user: "10001:10001" cap_drop: ["ALL"] security_opt: ["no-new-privileges:true"]