version: '3.2'
services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    ports:
    - 9090:9090
    command:
    - --config.file=/etc/prometheus/prometheus.yml
    volumes:
    - ${PROMETHEUS_ROOT}/prometheus.yml:/etc/prometheus/prometheus.yml:ro
    depends_on:
    - cadvisor
    - node-exporter
  cadvisor:
    image: gcr.io/google-containers/cadvisor:latest
    container_name: cadvisor
    ports:
    - 8087:8080
    volumes:
    - /:/rootfs:ro,rslave
    - /boot:/boot:ro
    - /var/run:/var/run:rw
    - /sys:/sys:ro
    - /var/lib/docker/:/var/lib/docker:ro
    depends_on:
    - redis
  
  node-exporter:
    image: prom/node-exporter:latest
    container_name: node-exporter
    ports:
    - 9100:9100
    volumes:
    - /proc:/proc:rw
    command:
      - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
      

  redis:
    image: redis:latest
    container_name: redis
    ports:
    - 6479:6379

  grafana:
    image: grafana/grafana:latest
    container_name: monitoring_grafana
    restart: "no" 
    links:
      - prometheus:prometheus
    volumes:
      - ${PROMETHEUS_ROOT}/grafana/data/grafana:/var/lib/grafana
      - ${PROMETHEUS_ROOT}/grafana/provisioning:/etc/grafana/provisioning
    environment:
#      - GF_SECURITY_ADMIN_USER=${ADMIN_USER}
      - GF_SECURITY_ADMIN_USER=admin
      #- GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD}
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_USERS_ALLOW_SIGN_UP=false
      - GF_SERVER_DOMAIN=myrul.com
      - GF_SMTP_ENABLED=true
      - GF_SMTP_HOST=smtp.gmail.com:587
      - GF_SMTP_USER=myadrress@gmail.com
      - GF_SMTP_PASSWORD=mypassword
      - GF_SMTP_FROM_ADDRESS=myaddress@gmail.com
    ports:
      - 3000:3000
