/ monitoring.yaml
monitoring.yaml
1 networks: 2 monitoring: 3 name: monitoring 4 5 secrets: 6 promtail-config: 7 external: true 8 9 services: 10 grafana: 11 image: grafana/grafana:11.3.1 12 volumes: 13 - ./grafana_data:/var/lib/grafana 14 - ./grafana/dashboards:/var/lib/grafana/dashboards 15 - ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards 16 - ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources 17 - ./grafana/grafana.ini:/etc/grafana/grafana.ini 18 environment: 19 - GF_SECURITY_ADMIN_USER=${ADMIN_USER} 20 - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD} 21 - GF_USERS_ALLOW_SIGN_UP=false 22 ports: 23 - target: 3000 24 published: 3000 25 protocol: tcp 26 mode: host 27 networks: 28 - monitoring 29 deploy: 30 replicas: 1 31 update_config: 32 parallelism: 1 33 delay: 10s 34 failure_action: rollback 35 restart_policy: 36 condition: any 37 placement: 38 constraints: 39 - node.labels.type == master 40 max_replicas_per_node: 1 41 42 prometheus: 43 image: prom/prometheus:v2.54.1 44 volumes: 45 - ./prometheus:/etc/prometheus 46 - ./prometheus_data:/prometheus 47 command: 48 - '--config.file=/etc/prometheus/prometheus.yml' 49 - '--storage.tsdb.path=/prometheus' 50 - '--web.console.libraries=/etc/prometheus/console_libraries' 51 - '--web.console.templates=/etc/prometheus/consoles' 52 - '--storage.tsdb.retention.time=7d' 53 - '--web.enable-lifecycle' 54 ports: 55 - target: 9090 56 published: 9090 57 protocol: tcp 58 mode: host 59 networks: 60 - monitoring 61 deploy: 62 replicas: 1 63 update_config: 64 parallelism: 1 65 delay: 10s 66 failure_action: rollback 67 restart_policy: 68 condition: any 69 placement: 70 constraints: 71 - node.labels.type == master 72 max_replicas_per_node: 1 73 74 alertmanager: 75 image: prom/alertmanager:v0.27.0 76 volumes: 77 - ./alertmanager:/etc/alertmanager 78 command: 79 - '--config.file=/etc/alertmanager/config.yml' 80 - '--storage.path=/alertmanager' 81 networks: 82 - monitoring 83 deploy: 84 replicas: 1 85 update_config: 86 parallelism: 1 87 delay: 10s 88 failure_action: rollback 89 restart_policy: 90 condition: any 91 placement: 92 constraints: 93 - node.labels.type == master 94 max_replicas_per_node: 1 95 96 loki: 97 image: grafana/loki 98 volumes: 99 - ./loki/loki-config.yml:/mnt/config/loki-config.yml 100 - ./loki_data:/loki 101 command: -config.file=/mnt/config/loki-config.yml 102 ports: 103 - target: 3100 104 published: 3100 105 protocol: tcp 106 mode: host 107 networks: 108 - monitoring 109 deploy: 110 replicas: 1 111 update_config: 112 parallelism: 1 113 delay: 10s 114 failure_action: rollback 115 116 promtail: 117 image: grafana/promtail 118 secrets: 119 - source: promtail-config 120 volumes: 121 - /var/log:/var/log 122 - /var/lib/docker/containers:/var/lib/docker/containers:ro 123 - /var/run/docker.sock:/var/run/docker.sock 124 command: -config.file=/run/secrets/promtail-config 125 networks: 126 - monitoring 127 deploy: 128 mode: global 129 resources: 130 limits: 131 memory: 128m 132 reservations: 133 memory: 64m 134 restart_policy: 135 condition: on-failure 136 137 nodeexporter: 138 image: prom/node-exporter:v1.8.2 139 volumes: 140 - /proc:/host/proc:ro 141 - /sys:/host/sys:ro 142 - /:/rootfs:ro 143 command: 144 - '--path.procfs=/host/proc' 145 - '--path.rootfs=/rootfs' 146 - '--path.sysfs=/host/sys' 147 - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)' 148 ports: 149 - target: 9100 150 published: 9100 151 protocol: tcp 152 mode: host 153 networks: 154 - monitoring 155 deploy: 156 mode: global 157 resources: 158 limits: 159 memory: 128m 160 reservations: 161 memory: 64m 162 restart_policy: 163 condition: on-failure 164 165 cadvisor: 166 image: gcr.io/cadvisor/cadvisor:v0.49.1 167 volumes: 168 - /:/rootfs:ro 169 - /var/run:/var/run:rw 170 - /sys:/sys:ro 171 - /var/lib/docker:/var/lib/docker:ro 172 ports: 173 - target: 8080 174 published: 8080 175 protocol: tcp 176 mode: host 177 networks: 178 - monitoring 179 deploy: 180 mode: global 181 resources: 182 limits: 183 memory: 128m 184 reservations: 185 memory: 64m 186 restart_policy: 187 condition: on-failure