-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompose.yaml
230 lines (211 loc) · 5.96 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/3fd860446371071d409abfc5b101ecc047df9b37/examples/demo/docker-compose.yaml
services:
# Jaeger
jaeger-all-in-one:
image: jaegertracing/all-in-one:latest
ports:
- "16686:16686"
- "14268"
- "14250"
# Zipkin
zipkin-all-in-one:
image: openzipkin/zipkin:latest
ports:
- "9411:9411"
otel-collector:
image: otel/opentelemetry-collector-contrib:0.63.1
command: ["--config=/etc/otel-collector-config.yaml"]
restart: on-failure
user: '0:0' # required for logs
volumes:
- ./config/otel-collector-config.yaml:/etc/otel-collector-config.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/log:/var/log:ro
ports:
- "1888:1888" # pprof extension
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics
- "13133:13133" # health_check extension
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
- "55678:55678" # opencensus receiver
- "55679:55679" # zpages extension
depends_on:
- jaeger-all-in-one
- zipkin-all-in-one
prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./config/prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
postgres:
image: postgres:latest
restart: always
environment:
POSTGRES_DB: uptrace
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- ./config/pg-init.sql:/docker-entrypoint-initdb.d/pg-init.sql
- pg_data:/var/lib/postgresql/data
ports:
- "5432:5432"
nginx:
build:
context: ./nginx/
image: nginx-otel:1.22.0
volumes:
- ./config/nginx-otel.toml:/etc/nginx/conf.d/nginx-otel.toml
- ./config/nginx-router.conf:/etc/nginx/conf.d/default.conf
- ./var/log/nginx:/var/log/nginx
ports:
- 80:80
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
- backend
backend:
build:
context: ./
dockerfile: ./backend/Dockerfile
image: backend:latest
volumes:
- ./backend:/code
ports:
- 8000:8000
depends_on:
- postgres
environment:
- DATABASE_URL=postgres://postgres:postgres@postgres:5432/backend
- OTEL_SERVICE_NAME=django
# - OTEL_TRACES_EXPORTER=console,otlp
# - OTEL_METRICS_EXPORTER=console,otlp
# - OTEL_LOGS_EXPORTER=console,otlp
- OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
- OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317
- OTEL_EXPORTER_OTLP_INSECURE=true
command:
- /bin/sh
- -c
- |
python manage.py migrate
opentelemetry-instrument python manage.py runserver 0.0.0.0:8000 --noreload
console:
build:
context: ./
dockerfile: ./console/Dockerfile
image: console:latest
volumes:
- ./console:/code
environment:
- OTEL_SERVICE_NAME=console-hand
# - OTEL_TRACES_EXPORTER=console,otlp
# - OTEL_METRICS_EXPORTER=console,otlp
# - OTEL_LOGS_EXPORTER=console,otlp
- OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317
- OTEL_EXPORTER_OTLP_INSECURE=true
command: python client.py
extra_hosts:
- 'api.lvh.me:host-gateway'
profiles:
- notstart
console-auto:
build:
context: ./
dockerfile: ./console/Dockerfile
image: console:latest
volumes:
- ./console:/code
environment:
- OTEL_SERVICE_NAME=console-auto
# - OTEL_TRACES_EXPORTER=console,otlp
# - OTEL_METRICS_EXPORTER=console,otlp
# - OTEL_LOGS_EXPORTER=console,otlp
- OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317
- OTEL_EXPORTER_OTLP_INSECURE=true
command: opentelemetry-instrument python client-auto.py
extra_hosts:
- 'api.lvh.me:host-gateway'
profiles:
- notstart
frontend:
build:
context: ./frontend/
dockerfile: ./Dockerfile
image: frontend:latest
volumes:
- ./frontend:/code
- frontend_node_modules:/code/node_modules
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://lvh.me:4317/v1/traces
# - EXPORTER_OTLP_ENDPOINT=http://lvh.me:4317/v1/traces
command: npm run dev
# for uptrace
clickhouse:
image: clickhouse/clickhouse-server:22.7
restart: on-failure
environment:
CLICKHOUSE_DB: uptrace
healthcheck:
test: ['CMD', 'wget', '--spider', '-q', 'localhost:8123/ping']
interval: 1s
timeout: 1s
retries: 30
volumes:
- ch_data:/var/lib/clickhouse
ports:
- '8123:8123'
- '9000:9000'
extra_hosts:
- 'host.docker.internal:host-gateway'
uptrace:
image: 'uptrace/uptrace:1.5.9'
volumes:
- uptrace_data:/var/lib/uptrace
- ./config/uptrace.yml:/etc/uptrace/uptrace.yml
ports:
- '14317:14317'
- '14318:14318'
depends_on:
clickhouse:
condition: service_healthy
alertmanager:
image: prom/alertmanager:v0.24.0
restart: on-failure
volumes:
- ./config/alertmanager.yml:/etc/alertmanager/config.yml
- alertmanager_data:/alertmanager
ports:
- 9093:9093
command:
- '--config.file=/etc/alertmanager/config.yml'
- '--storage.path=/alertmanager'
mailhog:
image: mailhog/mailhog:v1.0.1
restart: on-failure
ports:
- '8025:8025'
vector:
image: timberio/vector:0.25.X-alpine
volumes:
- ./config/vector.toml:/etc/vector/vector.toml:ro
- /var/log:/var/log:ro
extra_hosts:
- 'host.docker.internal:host-gateway'
profiles:
# まだnginx logフォーマット設定が完了していないため起動させない
- notstart
volumes:
uptrace_data:
driver: local
pg_data:
driver: local
ch_data:
driver: local
alertmanager_data:
driver: local
frontend_node_modules:
driver: local