-
Notifications
You must be signed in to change notification settings - Fork 1
/
grafana-loki-stack.yml
99 lines (96 loc) · 2.09 KB
/
grafana-loki-stack.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
version: '3.4'
services:
grafana:
image: grafana/grafana:latest
depends_on:
- loki
ports:
- "3000:3000"
networks:
- loki
volumes:
- grafana-data:/var/lib/grafana
environment:
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
entrypoint:
- sh
- -euc
- |
mkdir -p /etc/grafana/provisioning/datasources
cat <<EOF > /etc/grafana/provisioning/datasources/ds.yaml
apiVersion: 1
datasources:
- name: Loki
type: loki
access: proxy
url: http://loki:3100
jsonData:
httpHeaderName1: "X-Scope-OrgID"
secureJsonData:
httpHeaderValue1: "tenant1"
EOF
/run.sh
deploy: &deploy
replicas: 1
logging:
driver: json-file
# healthcheck:
# test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1" ]
# interval: 10s
# timeout: 5s
# retries: 5
loki:
image: grafana/loki:latest
command:
- -config.file=/etc/loki/loki-config.yaml
ports:
- "3100:3100"
volumes:
- loki-data:/loki
networks:
- loki
configs:
- source: loki_config
target: /etc/loki/loki-config.yaml
logging:
driver: json-file
deploy:
<<: *deploy
depends_on:
- promtail
promtail:
deploy:
<<: *deploy
image: grafana/promtail:2.9.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
configs:
- source: promtail_config
target: /etc/promtail/config.yaml
command: -config.file=/etc/promtail/config.yaml
depends_on:
- flog
networks:
- loki
flog:
deploy:
<<: *deploy
image: mingrammer/flog
command: -f json -d 1s -l
networks:
- loki
networks:
loki:
driver: overlay
volumes:
loki-data:
driver: local
grafana-data:
driver: local
configs:
loki_config:
external: true
promtail_config:
external: true