|
| 1 | +version: '3.8' |
| 2 | + |
| 3 | +services: |
| 4 | + # OpenTelemetry Collector |
| 5 | + otel-collector: |
| 6 | + image: otel/opentelemetry-collector-contrib:0.98.0 |
| 7 | + container_name: otel-collector |
| 8 | + restart: unless-stopped |
| 9 | + command: ["--config=/etc/otel-collector/config.yaml"] |
| 10 | + volumes: |
| 11 | + - ./otel-collector-config.yaml:/etc/otel-collector/config.yaml:ro |
| 12 | + ports: |
| 13 | + - "4317:4317" # OTLP gRPC receiver |
| 14 | + - "4318:4318" # OTLP HTTP receiver |
| 15 | + - "9090:9090" # Prometheus metrics exporter |
| 16 | + - "8888:8888" # Collector metrics |
| 17 | + - "13133:13133" # Health check |
| 18 | + environment: |
| 19 | + - OTLP_BACKEND_ENDPOINT=${OTLP_BACKEND_ENDPOINT:-otlp-backend:4317} |
| 20 | + - OTLP_BACKEND_TOKEN=${OTLP_BACKEND_TOKEN:-} |
| 21 | + networks: |
| 22 | + - metrics |
| 23 | + |
| 24 | + # Prometheus with OTLP support |
| 25 | + prometheus: |
| 26 | + image: prom/prometheus:v3.7.3 |
| 27 | + container_name: prometheus |
| 28 | + restart: unless-stopped |
| 29 | + command: |
| 30 | + - '--config.file=/etc/prometheus/prometheus.yml' |
| 31 | + - '--storage.tsdb.path=/prometheus' |
| 32 | + - '--web.console.libraries=/etc/prometheus/console_libraries' |
| 33 | + - '--web.console.templates=/etc/prometheus/consoles' |
| 34 | + - '--web.enable-lifecycle' |
| 35 | + - '--web.enable-otlp-receiver' # Enable OTLP receiver |
| 36 | + - '--storage.tsdb.retention.time=30d' |
| 37 | + - '--query.max-concurrency=20' |
| 38 | + volumes: |
| 39 | + - ./prometheus-config.yaml:/etc/prometheus/prometheus.yml:ro |
| 40 | + - ./prometheus-recording-rules.yml:/etc/prometheus/rules/nativelink.yml:ro |
| 41 | + - prometheus_data:/prometheus |
| 42 | + ports: |
| 43 | + - "9091:9090" # Prometheus web UI (different port to avoid conflict with collector) |
| 44 | + networks: |
| 45 | + - metrics |
| 46 | + depends_on: |
| 47 | + - otel-collector |
| 48 | + |
| 49 | + # Grafana for visualization |
| 50 | + grafana: |
| 51 | + image: grafana/grafana:10.3.0 |
| 52 | + container_name: grafana |
| 53 | + restart: unless-stopped |
| 54 | + ports: |
| 55 | + - "3000:3000" |
| 56 | + environment: |
| 57 | + - GF_SECURITY_ADMIN_USER=admin |
| 58 | + - GF_SECURITY_ADMIN_PASSWORD=admin |
| 59 | + - GF_INSTALL_PLUGINS=grafana-piechart-panel |
| 60 | + - GF_USERS_ALLOW_SIGN_UP=false |
| 61 | + volumes: |
| 62 | + - grafana_data:/var/lib/grafana |
| 63 | + - ./grafana/provisioning:/etc/grafana/provisioning:ro |
| 64 | + - ./grafana/dashboards:/var/lib/grafana/dashboards:ro |
| 65 | + networks: |
| 66 | + - metrics |
| 67 | + depends_on: |
| 68 | + - prometheus |
| 69 | + |
| 70 | + # Optional: AlertManager for alerts |
| 71 | +# alertmanager: |
| 72 | +# image: prom/alertmanager:v0.27.0 |
| 73 | +# container_name: alertmanager |
| 74 | +# restart: unless-stopped |
| 75 | +# volumes: |
| 76 | +# - ./alertmanager-config.yml:/etc/alertmanager/config.yml:ro |
| 77 | +# - alertmanager_data:/alertmanager |
| 78 | +# ports: |
| 79 | +# - "9093:9093" |
| 80 | +# command: |
| 81 | +# - '--config.file=/etc/alertmanager/config.yml' |
| 82 | +# - '--storage.path=/alertmanager' |
| 83 | +# networks: |
| 84 | +# - metrics |
| 85 | + |
| 86 | + # Optional: Node exporter for host metrics |
| 87 | + node-exporter: |
| 88 | + image: prom/node-exporter:v1.7.0 |
| 89 | + container_name: node-exporter |
| 90 | + restart: unless-stopped |
| 91 | + volumes: |
| 92 | + - /proc:/host/proc:ro |
| 93 | + - /sys:/host/sys:ro |
| 94 | + - /:/rootfs:ro |
| 95 | + command: |
| 96 | + - '--path.procfs=/host/proc' |
| 97 | + - '--path.rootfs=/rootfs' |
| 98 | + - '--path.sysfs=/host/sys' |
| 99 | + - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' |
| 100 | + ports: |
| 101 | + - "9100:9100" |
| 102 | + networks: |
| 103 | + - metrics |
| 104 | + |
| 105 | + # Optional: Jaeger for trace visualization (if traces are enabled) |
| 106 | + jaeger: |
| 107 | + image: jaegertracing/all-in-one:1.53 |
| 108 | + container_name: jaeger |
| 109 | + restart: unless-stopped |
| 110 | + environment: |
| 111 | + - COLLECTOR_OTLP_ENABLED=true |
| 112 | + ports: |
| 113 | + - "16686:16686" # Jaeger UI |
| 114 | + - "14268:14268" # Jaeger collector HTTP |
| 115 | + networks: |
| 116 | + - metrics |
| 117 | + |
| 118 | +volumes: |
| 119 | + prometheus_data: |
| 120 | + grafana_data: |
| 121 | + alertmanager_data: |
| 122 | + |
| 123 | +networks: |
| 124 | + metrics: |
| 125 | + driver: bridge |
| 126 | + |
| 127 | +# Usage Instructions: |
| 128 | +# 1. Start the stack: docker-compose up -d |
| 129 | +# 2. Configure NativeLink with these environment variables: |
| 130 | +# export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 |
| 131 | +# export OTEL_EXPORTER_OTLP_PROTOCOL=grpc |
| 132 | +# export OTEL_SERVICE_NAME=nativelink |
| 133 | +# export OTEL_RESOURCE_ATTRIBUTES="deployment.environment=dev" |
| 134 | +# 3. Access services: |
| 135 | +# - Prometheus: http://localhost:9091 |
| 136 | +# - Grafana: http://localhost:3000 (admin/admin) |
| 137 | +# - Jaeger: http://localhost:16686 |
| 138 | +# - AlertManager: http://localhost:9093 |
| 139 | +# - OTEL Collector metrics: http://localhost:8888/metrics |
0 commit comments