This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
101 lines (92 loc) · 2.68 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
x-deploy-policy: &x-deploy-policy
replicas: ${PROMETHEUS_REPLICAS:-2}
placement:
max_replicas_per_node: 1
constraints:
- node.role == manager
- node.labels.prometheus == true
preferences:
- spread: node.labels.prometheus
labels:
# Promtail
io.promtail.enabled: "true"
update_config:
parallelism: 1
delay: 30s
order: stop-first
failure_action: rollback
rollback_config:
parallelism: 1
delay: 30s
restart_policy:
condition: on-failure
delay: 30s
max_attempts: 3
window: 120s
x-default-logging: &x-default-logging
options:
max-size: "12m"
max-file: "5"
driver: json-file
networks:
dockerswarm_monitoring:
name: dockerswarm_monitoring
external: true
volumes:
prometheus:
external: true
configs:
prometheus_config:
template_driver: golang
file: configs/prometheus.yml
# Scrape configs
scrape_configs_dockerswarm_nodes:
file: configs/scrape_configs/dockerswarm_nodes.yml
scrape_configs_dockerswarm_tasks:
file: configs/scrape_configs/dockerswarm_tasks.yml
scrape_configs_dockerswarm_cadvisor:
file: configs/scrape_configs/dockerswarm_cadvisor.yml
# Rules
alerting_rules_node:
file: configs/rules/node.yml
alerting_rules_service:
file: configs/rules/service.yml
alerting_rules_task:
file: configs/rules/task.yml
services:
prometheus:
image: prom/prometheus:${PROMETHEUS_VERSION:-latest}
hostname: prometheus-{{.Task.Slot}}
user: root
command:
- "--log.level=info"
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.size=60GB"
- "--storage.tsdb.retention.time=30d"
networks:
- dockerswarm_monitoring
ports:
- ${PROMETHEUS_PORT:-9090}:9090
volumes:
- prometheus:/prometheus
- /var/run/docker.sock:/var/run/docker.sock:ro
configs:
- source: prometheus_config
target: /etc/prometheus/prometheus.yml
# Scrape configs
- source: scrape_configs_dockerswarm_nodes
target: /etc/prometheus/scrape_configs/dockerswarm_nodes.yml
- source: scrape_configs_dockerswarm_tasks
target: /etc/prometheus/scrape_configs/dockerswarm_tasks.yml
- source: scrape_configs_dockerswarm_cadvisor
target: /etc/prometheus/scrape_configs/dockerswarm_cadvisor.yml
# Rules
- source: alerting_rules_node
target: /etc/prometheus/rules/node.yml
- source: alerting_rules_service
target: /etc/prometheus/rules/service.yml
- source: alerting_rules_task
target: /etc/prometheus/rules/task.yml
deploy: *x-deploy-policy
logging: *x-default-logging