-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
131 lines (122 loc) · 2.85 KB
/
docker-compose.yml
File metadata and controls
131 lines (122 loc) · 2.85 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
version: '3.8'
services:
# NATS JetStream
nats:
image: nats:latest
ports:
- "4222:4222" # Client connections
- "8222:8222" # HTTP monitoring
command:
- "-js"
- "-m=8222"
- "--store_dir=/data"
volumes:
- nats-data:/data
networks:
- app-network
healthcheck:
test: [ "CMD", "curl", "-v", "http://localhost:8222/healthz" ]
interval: 10s
timeout: 5s
retries: 3
# Loki for log storage
loki:
image: grafana/loki:latest
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
volumes:
- loki-data:/loki
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1"]
interval: 10s
timeout: 5s
retries: 3
# Grafana for visualization
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- grafana-data:/var/lib/grafana
- ./docker/grafana/provisioning:/etc/grafana/provisioning
networks:
- app-network
depends_on:
- loki
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"]
interval: 10s
timeout: 5s
retries: 3
# Jaeger for tracing
jaeger:
image: jaegertracing/all-in-one:latest
ports:
- "4317:4317" # OTLP gRPC
- "4318:4318" # OTLP HTTP
- "16686:16686" # Web UI
environment:
- COLLECTOR_OTLP_ENABLED=true
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:16686/api/services || exit 1"]
interval: 10s
timeout: 5s
retries: 3
# API Service
api-service:
build:
context: .
dockerfile: Dockerfile.api
environment:
- NATS_URL=nats://nats:4222
- JAEGER_URL=jaeger:4317
- SERVICE_NAME=api-service
- ENVIRONMENT=development
- PORT=8080
ports:
- "8080:8080"
networks:
- app-network
depends_on:
- nats
- jaeger
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
# Log Consumer
log-consumer:
build:
context: .
dockerfile: Dockerfile.consumer
environment:
- NATS_URL=nats://nats:4222
- LOKI_URL=http://loki:3100/loki/api/v1/push
- NATS_STREAM=logs
- LOG_SUBJECT=logs.>
- CONSUMER_NAME=loki-consumer
networks:
- app-network
depends_on:
- nats
- loki
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
networks:
app-network:
driver: bridge
volumes:
nats-data:
loki-data:
grafana-data: