RnDAO/tc-operation

View on GitHub
production/docker-compose.monitoring.yml

Summary

Maintainability
Test Coverage
version: '3'

name: monitoring

networks:
  monitoring:
    name: monitoring
    driver: bridge
    ipam:
      config:
        - subnet: 172.22.22.0/16

x-logging:
  &logging
  logging:
    driver: loki
    options:
      loki-url: http://172.22.22.15:3100/loki/api/v1/push
      loki-retries: 5
      loki-batch-size: 400

volumes:
  grafana_volume:
  prometheus_volume:
  loki_volume:

services:
  grafana:
    image: grafana/grafana
    container_name: grafana
    restart: always
    ports:
      - 4000:3000
    volumes:
      - ./grafana/provisioning/:/etc/grafana/provisioning
      - grafana_volume:/var/lib/grafana
    depends_on:
      - prometheus
      - loki
    networks:
      - monitoring
    <<: *logging

  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    command:
      - --config.file=/etc/prometheus/prometheus.yml
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus_volume:/prometheus
    depends_on:
      - cadvisor
      - node-exporter
    networks:
      - monitoring
    <<: *logging

  cadvisor:
    image: gcr.io/cadvisor/cadvisor:latest
    container_name: cadvisor
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
    depends_on:
      - redis-cadvisor
    networks:
      - monitoring
    <<: *logging

  redis-cadvisor:
    image: redis:latest
    container_name: redis-cadvisor
    networks:
      - monitoring

  loki:
    container_name: loki
    image: grafana/loki:2.8.0
    restart: unless-stopped
    ports:
      - 3100
    volumes:
      - ./loki/loki-config.yaml:/etc/loki/loki-config.yaml
      - loki_volume:/data/loki
    command: -config.file=/etc/loki/loki-config.yaml
    networks:
      monitoring:
        ipv4_address: 172.22.22.15
    <<: *logging

  node-exporter:
    image: prom/node-exporter:latest
    container_name: node-exporter
    restart: unless-stopped
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    command:
      - '--path.procfs=/host/proc'
      - '--path.rootfs=/rootfs'
      - '--path.sysfs=/host/sys'
      - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
    networks:
      - monitoring
    <<: *logging

  pyroscope:
    container_name: pyroscope
    image: grafana/pyroscope:1.4.0
    restart: unless-stopped
    networks:
      - monitoring
    <<: *logging