-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
259 lines (245 loc) · 5.92 KB
/
docker-compose.yml
File metadata and controls
259 lines (245 loc) · 5.92 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
version: "3.9"
services:
# ======================
# MongoDB Database
# ======================
mongodb:
image: mongo:5
container_name: mongodb
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=secret
volumes:
- mongodb_data:/data/db
networks:
- private_net
healthcheck:
test:
[
"CMD",
"mongosh",
"--username",
"admin",
"--password",
"secret",
"--authenticationDatabase",
"admin",
"--eval",
"db.adminCommand('ping')",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# ======================
# Mongo Express UI
# ======================
mongo-express:
image: mongo-express:latest
container_name: mongo-express
ports:
- "8081:8081"
environment:
- ME_CONFIG_MONGODB_SERVER=mongodb
- ME_CONFIG_MONGODB_PORT=27017
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
- ME_CONFIG_MONGODB_ADMINPASSWORD=secret
- ME_CONFIG_MONGODB_ENABLE_ADMIN=true
- ME_CONFIG_BASICAUTH=false
- ME_CONFIG_MONGODB_AUTH_DATABASE=admin
depends_on:
mongodb:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- private_net
# ======================
# Prometheus Monitoring
# ======================
prometheus:
image: prom/prometheus
container_name: prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
networks:
- private_net
# ======================
# Monitoring Engine (Backend API) - Production Mode
# ======================
monitoring_engine:
build:
context: .
dockerfile: Dockerfile.monitoring
container_name: monitoring_engine
ports:
- "8000:8000"
depends_on:
mongodb:
condition: service_healthy
prometheus:
condition: service_started
networks:
- private_net
environment:
- MONGO_URI=mongodb://admin:secret@mongodb:27017
- JWT_SECRET=2004@
- GROQ_API_KEY=GROQ_API_KEY
- GROQ_MODEL=llama3-8b-8192
- PROMETHEUS_URL=http://prometheus:9090
- SENDGRID_API_KEY=your_sendgrid_api_key
- ALERT_EMAIL_FROM=your_email@example.com
- ALERT_EMAIL_TO=your_email@example.com
- DEMO_MODE=0
volumes:
- ./logs:/app/logs
- ./data:/app/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"]
interval: 10s
timeout: 5s
retries: 30
start_period: 30s
# ======================
# Frontend React App - Production Mode
# ======================
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: frontend
ports:
- "3000:3000"
networks:
- private_net
depends_on:
monitoring_engine:
condition: service_healthy
environment:
- REACT_APP_API_URL=http://localhost:8000
postgres:
image: postgres:14
container_name: postgres
environment:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: testdb
ports:
- "5432:5432"
networks:
- private_net
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: testuser@example.com
PGADMIN_DEFAULT_PASSWORD: testpass
ports:
- "8083:80"
depends_on:
- postgres
networks:
- private_net
volumes:
- pgadmin_data:/var/lib/pgadmin
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/misc/ping"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
mysql:
image: mysql:8
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: testdb
MYSQL_USER: testuser
MYSQL_PASSWORD: testpass
ports:
- "3306:3306"
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- private_net
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
environment:
PMA_HOST: mysql
PMA_USER: testuser
PMA_PASSWORD: testpass
ports:
- "8082:80"
depends_on:
- mysql
networks:
- private_net
exporter:
build:
context: ./forecast/exporter
dockerfile: Dockerfile.exporter
container_name: metrics_exporter
working_dir: /forecast/exporter/app
restart: unless-stopped
depends_on:
mongodb:
condition: service_healthy
volumes:
- ./forecast:/forecast # Persist logs to host machine
environment:
- MONGO_HOST=mongodb
- MONGO_PORT=27017
- MONGO_USER=admin
- MONGO_PASS=secret
- MONGO_AUTH_DB=admin
- DB_NAME=appvital
- COLLECTION_NAME=metrics_history
networks:
- private_net
forecast_ui:
build:
context: ./forecast/forecast_ui
dockerfile: Dockerfile.forecast_ui
container_name: forecast_ui
ports:
- "8501:8501"
volumes:
- ./forecast:/forecast # ✅ Mount forecast folder
working_dir: /forecast/forecast_ui/app
depends_on:
- exporter
networks:
- private_net
controller:
build:
context: .
dockerfile: Dockerfile.controller
environment:
- MONITORING_ENGINE_URL=http://monitoring_engine:8000
- CONTROLLER_USER_EMAIL=testuser@example.com
- CONTROLLER_USER_PASSWORD=testpass123
# Add other env vars as needed
depends_on:
monitoring_engine:
condition: service_healthy
volumes:
- ./logs:/app/logs
restart: unless-stopped
networks:
- private_net
volumes:
mongodb_data:
pgadmin_data:
networks:
private_net:
driver: bridge