-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
279 lines (265 loc) · 11 KB
/
docker-compose.yml
File metadata and controls
279 lines (265 loc) · 11 KB
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#================================================================================================
# Order Service - Docker Compose Configuration
# RESTful API with DDD + CQRS Pattern
#================================================================================================
#================================================================================================
# NETWORK SETUP
#================================================================================================
networks:
order_service_net:
name: order_service_net
driver: bridge
ipam:
config:
- subnet: 172.152.0.0/16
#================================================================================================
# VOLUME SETUP
#================================================================================================
volumes:
vol_postgres_data:
driver: local
vol_prometheus_data:
driver: local
vol_grafana_data:
driver: local
#================================================================================================
# SERVICES
#================================================================================================
services:
#----------------------------------------------------------------------------------------------
# POSTGRESQL - Order Data Storage
#----------------------------------------------------------------------------------------------
postgres:
profiles: ["db", "all"]
platform: linux/amd64
image: postgres:${POSTGRES_VERSION:-16-alpine}
container_name: ${CONTAINER_POSTGRES:-TFO-SDK-PostgreSQL}
restart: unless-stopped
ports:
- "${PORT_POSTGRES:-5432}:5432"
environment:
- TZ=${TZ:-UTC}
- POSTGRES_USER=${DB_USER:-postgres}
- POSTGRES_PASSWORD=${DB_PASSWORD:-password}
- POSTGRES_DB=${DB_NAME:-orders}
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- vol_postgres_data:/var/lib/postgresql/data
networks:
order_service_net:
ipv4_address: ${CONTAINER_IP_POSTGRES:-172.152.152.20}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-orders}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
#----------------------------------------------------------------------------------------------
# API - Order Service RESTful API
#----------------------------------------------------------------------------------------------
api:
profiles: ["app", "all"]
platform: linux/amd64
build:
context: .
dockerfile: Dockerfile
container_name: ${CONTAINER_API:-TFO-SDK-Order-Service}
restart: unless-stopped
ports:
- "${PORT:-8080}:8080"
environment:
- TZ=${TZ:-UTC}
# Server
- SERVER_PORT=8080
- SERVER_READ_TIMEOUT=${SERVER_READ_TIMEOUT:-15s}
- SERVER_WRITE_TIMEOUT=${SERVER_WRITE_TIMEOUT:-15s}
# PostgreSQL
- DB_DRIVER=${DB_DRIVER:-postgres}
- DB_HOST=postgres
- DB_PORT=5432
- DB_NAME=${DB_NAME:-orders}
- DB_USER=${DB_USER:-postgres}
- DB_PASSWORD=${DB_PASSWORD:-password}
- DB_SSL_MODE=${DB_SSL_MODE:-disable}
- DB_MAX_OPEN_CONNS=${DB_MAX_OPEN_CONNS:-25}
- DB_MAX_IDLE_CONNS=${DB_MAX_IDLE_CONNS:-5}
- DB_CONN_MAX_LIFETIME=${DB_CONN_MAX_LIFETIME:-5m}
# JWT
- JWT_SECRET=${JWT_SECRET}
- JWT_EXPIRATION=${JWT_EXPIRATION:-24h}
- JWT_REFRESH_EXPIRATION=${JWT_REFRESH_EXPIRATION:-168h}
# Rate Limiting
- RATE_LIMIT_REQUESTS=${RATE_LIMIT_REQUESTS:-100}
- RATE_LIMIT_WINDOW=${RATE_LIMIT_WINDOW:-1m}
# TelemetryFlow / OpenTelemetry
- TELEMETRYFLOW_API_KEY_ID=${TELEMETRYFLOW_API_KEY_ID}
- TELEMETRYFLOW_API_KEY_SECRET=${TELEMETRYFLOW_API_KEY_SECRET}
- TELEMETRYFLOW_ENDPOINT=otel-collector:4317
- TELEMETRYFLOW_SERVICE_NAME=${TELEMETRYFLOW_SERVICE_NAME:-Order-Service}
- TELEMETRYFLOW_SERVICE_VERSION=${TELEMETRYFLOW_SERVICE_VERSION:-1.1.1}
- TELEMETRYFLOW_INSECURE=${TELEMETRYFLOW_INSECURE:-true}
# Logging
- LOG_LEVEL=${LOG_LEVEL:-info}
- LOG_FORMAT=${LOG_FORMAT:-json}
depends_on:
postgres:
condition: service_healthy
otel-collector:
condition: service_started
networks:
order_service_net:
ipv4_address: ${CONTAINER_IP_API:-172.152.152.10}
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
#----------------------------------------------------------------------------------------------
# OTEL COLLECTOR - OpenTelemetry Collector
#----------------------------------------------------------------------------------------------
# Supports dual ingestion: v1 (OTEL standard) and v2 (TelemetryFlow enhanced)
#
# OTLP HTTP Endpoints:
# TelemetryFlow Platform (Recommended - TFO Standalone):
# POST http://localhost:4318/v2/traces
# POST http://localhost:4318/v2/metrics
# POST http://localhost:4318/v2/logs
#
# OTEL Community (Backwards Compatible - OCB/Standard):
# POST http://localhost:4318/v1/traces
# POST http://localhost:4318/v1/metrics
# POST http://localhost:4318/v1/logs
#
# gRPC (Both versions via same port): localhost:4317
#----------------------------------------------------------------------------------------------
otel-collector:
profiles: ["monitoring", "all"]
platform: linux/amd64
# =============================================================================
# TelemetryFlow Collector (TFO-Collector) - TFO format with OTLP support (v1.1.2+)
image: telemetryflow/telemetryflow-collector:${TFO_VERSION:-1.1.2}
command: ["--config=/etc/tfo-collector/tfo-collector.yaml"]
# =============================================================================
# TelemetryFlow Collector OCB (TFO-Collector-OCB) - Standard OTEL format
# image: telemetryflow/telemetryflow-collector:${TFO_VERSION:-1.1.2}
# command: ["--config=/etc/tfo-collector/otel-collector.yaml"]
# =============================================================================
# OTEL Collector Community Contributor (Standard OTEL format)
# image: otel/opentelemetry-collector-contrib:${OTEL_VERSION:-0.142.0}
# command: ["--config=/etc/otelcol-contrib/config.yaml"]
# =============================================================================
container_name: ${CONTAINER_OTEL:-TFO-SDK-OTEL}
restart: unless-stopped
volumes:
# TelemetryFlow Collector config (Custom TFO format)
- ./configs/otel/tfo-collector.yaml:/etc/tfo-collector/tfo-collector.yaml:ro
# Logs output directory
- ./logs:/tmp/logs
# =============================================================================
# TelemetryFlow Collector OCB config (Standard OTEL format)
# - ./configs/otel/otel-collector.yaml:/etc/tfo-collector/otel-collector.yaml:ro
# =============================================================================
# OTEL Collector Community Contributor config (Standard OTEL format)
# - ./configs/otel/otel-collector.yaml:/etc/otelcol-contrib/config.yaml:ro
ports:
- "${PORT_OTEL_GRPC:-4317}:4317" # OTLP gRPC (v1 & v2)
- "${PORT_OTEL_HTTP:-4318}:4318" # OTLP HTTP (v1 & v2)
- "${PORT_OTEL_METRICS:-8889}:8889" # Prometheus metrics
- "${PORT_OTEL_HEALTH:-13133}:13133" # Health check
- "${PORT_OTEL_ZPAGES:-55679}:55679" # zPages
- "${PORT_OTEL_PPROF:-1777}:1777" # pprof
networks:
order_service_net:
ipv4_address: ${CONTAINER_IP_OTEL:-172.152.152.30}
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:13133"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
depends_on:
- jaeger
#----------------------------------------------------------------------------------------------
# JAEGER - Distributed Tracing UI
#----------------------------------------------------------------------------------------------
jaeger:
profiles: ["monitoring", "all"]
platform: linux/amd64
image: jaegertracing/jaeger:${JAEGER_VERSION:-2.13.0}
container_name: ${CONTAINER_JAEGER:-TFO-SDK-Jaeger}
restart: unless-stopped
ports:
- "${PORT_JAEGER_UI:-16686}:16686" # Jaeger UI
environment:
- COLLECTOR_OTLP_ENABLED=true
networks:
order_service_net:
ipv4_address: ${CONTAINER_IP_JAEGER:-172.152.152.40}
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:16686"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
#----------------------------------------------------------------------------------------------
# PROMETHEUS - Metrics Collection with Exemplars Support
#----------------------------------------------------------------------------------------------
prometheus:
profiles: ["monitoring", "all"]
platform: linux/amd64
image: prom/prometheus:${PROMETHEUS_VERSION:-v3.4.0}
container_name: ${CONTAINER_PROMETHEUS:-TFO-SDK-Prometheus}
restart: unless-stopped
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.enable-lifecycle'
- '--web.enable-remote-write-receiver'
- '--enable-feature=exemplar-storage'
- '--enable-feature=native-histograms'
ports:
- "${PORT_PROMETHEUS:-9090}:9090"
volumes:
- ./configs/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- vol_prometheus_data:/prometheus
networks:
order_service_net:
ipv4_address: ${CONTAINER_IP_PROMETHEUS:-172.152.152.50}
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:9090/-/healthy"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
#----------------------------------------------------------------------------------------------
# GRAFANA - Observability Dashboard with Exemplars Visualization
#----------------------------------------------------------------------------------------------
grafana:
profiles: ["monitoring", "all"]
platform: linux/amd64
image: grafana/grafana:${GRAFANA_VERSION:-12.3.1}
container_name: ${CONTAINER_GRAFANA:-TFO-SDK-Grafana}
restart: unless-stopped
ports:
- "${PORT_GRAFANA:-3000}:3000"
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_FEATURE_TOGGLES_ENABLE=traceqlEditor tempoSearch tempoBackendSearch tempoApmTable
volumes:
- ./configs/grafana/provisioning:/etc/grafana/provisioning:ro
- vol_grafana_data:/var/lib/grafana
networks:
order_service_net:
ipv4_address: ${CONTAINER_IP_GRAFANA:-172.152.152.60}
depends_on:
- prometheus
- jaeger
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/api/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s