-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yaml
155 lines (146 loc) · 3.75 KB
/
compose.yaml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: weaver-example-ts
# Create a three-segment network for the app, data, and telemetry services
networks:
app:
data:
telemetry:
# Create internal volumes for telemetry storage
volumes:
loki:
minio-loki:
prometheus:
tempo:
# Define shared environment variables
x-env-database: &envDatabase
POSTGRES_USER: petshop
POSTGRES_PASSWORD: petshop
POSTGRES_DB: petshop
x-env-minio-loki: &envMinioLoki
MINIO_ROOT_USER: loki
MINIO_ROOT_PASSWORD: supersecret
# Define common container configuration
x-container-config-telemetry: &containerConfigTelemetry
networks: [telemetry]
restart: always
services:
# A React single-page application
client:
build:
context: ./app/client
network_mode: "service:api"
depends_on: [api]
# A Node.js server which provides the API for the React app
api:
build:
context: ./app/server
ports: ["3001"]
networks: [app, data]
environment:
<<: *envDatabase
depends_on: [postgres]
# The primary storage for the application
postgres:
image: postgres:13
networks: [data]
environment:
<<: *envDatabase
#
# The remaining services are for telemetry and monitoring
#
grafana:
<<: *containerConfigTelemetry
image: grafana/grafana:11.0.0
volumes:
- ./monitoring/etc/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_FEATURE_TOGGLES_ENABLE=traceqlEditor
ports: ["3000"]
depends_on:
- tempo
- loki
- prometheus
init-tempo:
image: &tempoImage grafana/tempo:latest
user: root
entrypoint:
- "chown"
- "10001:10001"
- "/var/tempo"
volumes:
- tempo:/var/tempo
init-loki:
image: &lokiImage grafana/loki:latest
user: root
entrypoint:
- "chown"
- "10001:10001"
- "/var/loki"
volumes:
- loki:/var/loki
otel-collector:
<<: *containerConfigTelemetry
image: otel/opentelemetry-collector:0.86.0
volumes:
- ./monitoring/etc/otel-collector.yaml:/etc/otel-collector.yaml
command: [ "--config=/etc/otel-collector.yaml" ]
depends_on:
- loki
- prometheus
- tempo
tempo:
<<: *containerConfigTelemetry
image: *tempoImage
ports: ["3200, "4317"]
volumes:
- ./monitoring/etc/tempo.yaml:/etc/tempo.yaml
- tempo:/var/tempo
command: [ "-config.file=/etc/tempo.yaml" ]
depends_on:
- init-tempo
loki:
<<: *containerConfigTelemetry
image: *lokiImage
ports: ["3100", "7946"]
environment:
<<: *envMinioLoki
volumes:
- ./monitoring/etc/loki.yaml:/etc/loki/loki.yaml
- ./rules:/loki/rules:ro
command: "-config.file=/etc/loki/loki.yaml -target=backend -legacy-read-mode=false"
depends_on:
- init-loki
minio:
<<: *containerConfigTelemetry
image: minio/minio
ports: ["9000"]
environment:
<<: *envMinioLoki
- MINIO_PROMETHEUS_AUTH_TYPE=public
- MINIO_UPDATE=off
volumes: [minio-loki:/data]
entrypoint:
- sh
- -euc
- |
mkdir -p /data/loki-data && \
mkdir -p /data/loki-ruler && \
minio server /data
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 15s
timeout: 20s
retries: 5
prometheus:
<<: *containerConfigTelemetry
image: prom/prometheus:latest
ports: ["9090"]
volumes:
- ./monitoring/etc/prometheus.yaml:/etc/prometheus.yaml
command:
- --config.file=/etc/prometheus.yaml
- --web.enable-remote-write-receiver
- --enable-feature=exemplar-storage
- --enable-feature=native-histograms