-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose-observability.yml
More file actions
163 lines (154 loc) · 4.27 KB
/
Copy pathdocker-compose-observability.yml
File metadata and controls
163 lines (154 loc) · 4.27 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
version: '3.8'
services:
# MongoDB Database
mongodb:
image: mongo:latest
container_name: petshop-mongodb
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
environment:
- MONGO_INITDB_DATABASE=petshop
networks:
- petshop-network
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
# Jaeger - Distributed Tracing
jaeger:
image: jaegertracing/all-in-one:latest
container_name: petshop-jaeger
ports:
- "5775:5775/udp" # Zipkin compact thrift
- "6831:6831/udp" # Jaeger compact thrift
- "6832:6832/udp" # Jaeger binary thrift
- "5778:5778" # Jaeger configs
- "16686:16686" # Jaeger UI
- "14268:14268" # Jaeger collector HTTP
- "14250:14250" # Jaeger gRPC
- "9411:9411" # Zipkin compatible endpoint
environment:
- COLLECTOR_OTLP_ENABLED=true
- LOG_LEVEL=info
networks:
- petshop-network
# OpenTelemetry Collector
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
container_name: petshop-otel-collector
command: ["--config=/etc/otel-collector-config.yaml"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics
- "13133:13133" # Health check extension
depends_on:
- jaeger
networks:
- petshop-network
# Prometheus - Metrics Collection
prometheus:
image: prom/prometheus:latest
container_name: petshop-prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
ports:
- "9090:9090"
networks:
- petshop-network
depends_on:
- otel-collector
# Grafana - Metrics Visualization
grafana:
image: grafana/grafana:latest
container_name: petshop-grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_INSTALL_PLUGINS=grafana-piechart-panel
volumes:
- grafana_data:/var/lib/grafana
- ./grafana-datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml
networks:
- petshop-network
depends_on:
- prometheus
- jaeger
# Pet Shop API
api:
build:
context: .
dockerfile: Dockerfile.api
container_name: petshop-api
ports:
- "8000:8000"
environment:
- MONGODB_URI=mongodb://mongodb:27017
- MONGODB_DATABASE=petshop
- API_HOST=0.0.0.0
- API_PORT=8000
- OTLP_ENDPOINT=http://otel-collector:4317
- JAEGER_ENDPOINT=http://jaeger:14268/api/traces
- PROMETHEUS_PORT=9091
- ENABLE_TRACING=true
- ENABLE_METRICS=true
- SERVICE_NAME=petshop-api
- SERVICE_VERSION=1.0.0
- ENVIRONMENT=production
depends_on:
mongodb:
condition: service_healthy
otel-collector:
condition: service_started
networks:
- petshop-network
volumes:
- ./.env:/app/.env
command: python api.py
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
# Pet Shop Chat Interface
chat:
build:
context: .
dockerfile: Dockerfile.chat
container_name: petshop-chat
ports:
- "8001:8001"
environment:
- API_BASE_URL=http://api:8000
- OTLP_ENDPOINT=http://otel-collector:4317
- ENABLE_TRACING=true
- SERVICE_NAME=petshop-chat
- SERVICE_VERSION=1.0.0
depends_on:
- api
networks:
- petshop-network
volumes:
- ./.env:/app/.env
command: chainlit run app.py --host 0.0.0.0 --port 8001
volumes:
mongodb_data:
prometheus_data:
grafana_data:
networks:
petshop-network:
driver: bridge