-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
170 lines (162 loc) · 4.54 KB
/
Copy pathdocker-compose.yml
File metadata and controls
170 lines (162 loc) · 4.54 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
services:
# V2 Rust Server
finance-query-v2:
build:
context: .
dockerfile: server/Dockerfile
container_name: finance-query-v2
restart: unless-stopped
ports:
- "8001:8000"
env_file:
- server/.env
environment:
- PORT=8000
- LOG_LEVEL=INFO
- LOG_FORMAT=json
- REDIS_URL=redis://redis:6379
depends_on:
- redis
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/v2/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
- finance-query-network
# V1 Python Server
finance-query-v1:
build:
context: ./v1
dockerfile: Dockerfile
container_name: finance-query-v1
restart: unless-stopped
ports:
- "8002:8000"
env_file:
- v1/.env
environment:
- LOG_LEVEL=INFO
- LOG_FORMAT=json
- REDIS_URL=redis://redis:6379
depends_on:
- redis
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/v1/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
- finance-query-network
# Redis for caching (shared, internal only)
redis:
image: redis:7-alpine
container_name: finance-query-redis
restart: unless-stopped
# No external port - only accessible within Docker network
volumes:
- redis-data:/data
command: redis-server --appendonly yes
networks:
- finance-query-network
# Redis Exporter for Prometheus metrics
redis-exporter:
image: oliver006/redis_exporter:latest
container_name: finance-query-redis-exporter
restart: unless-stopped
ports:
- "9121:9121"
environment:
- REDIS_ADDR=redis:6379
depends_on:
- redis
networks:
- finance-query-network
# Nginx reverse proxy
nginx:
image: nginx:alpine
container_name: finance-query-nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/certs:/etc/nginx/certs:ro
depends_on:
finance-query-v1:
condition: service_healthy
finance-query-v2:
condition: service_healthy
networks:
- finance-query-network
# Prometheus - Metrics collection and storage
prometheus:
image: prom/prometheus:latest
container_name: finance-query-prometheus
restart: unless-stopped
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./monitoring/prometheus/alerts:/etc/prometheus/alerts:ro
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=30d'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
- '--web.enable-lifecycle'
depends_on:
- finance-query-v2
networks:
- finance-query-network
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:9090/-/healthy"]
interval: 30s
timeout: 10s
retries: 3
# Grafana - Metrics visualization and dashboards
grafana:
image: grafana/grafana:latest
container_name: finance-query-grafana
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- grafana-data:/var/lib/grafana
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
environment:
# Admin credentials
- GF_SECURITY_ADMIN_USER=${GRAFANA_ADMIN_USER:-admin}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_SERVER_ROOT_URL=%(protocol)s://%(domain)s:%(http_port)s/
- GF_ANALYTICS_REPORTING_ENABLED=false
- GF_ANALYTICS_CHECK_FOR_UPDATES=false
# SMTP for email alerts (optional)
- GF_SMTP_ENABLED=${GF_SMTP_ENABLED:-false}
- GF_SMTP_HOST=${GF_SMTP_HOST:-smtp.gmail.com:587}
- GF_SMTP_USER=${GF_SMTP_USER}
- GF_SMTP_PASSWORD=${GF_SMTP_PASSWORD}
- GF_SMTP_FROM_ADDRESS=${GF_SMTP_FROM_ADDRESS}
- GF_SMTP_FROM_NAME=${GF_SMTP_FROM_NAME:-Finance Query Alerts}
depends_on:
- prometheus
networks:
- finance-query-network
healthcheck:
test: ["CMD-SHELL", "wget --spider -q http://localhost:3000/api/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
networks:
finance-query-network:
driver: bridge
volumes:
redis-data:
prometheus-data:
grafana-data: