-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
805 lines (777 loc) · 21.5 KB
/
docker-compose.yml
File metadata and controls
805 lines (777 loc) · 21.5 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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
services:
# ============================================================================
# Infrastructure Services
# ============================================================================
# MySQL Database (shared)
mysql:
image: mysql:8.0
container_name: metargb-mysql
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: metargb_db
MYSQL_USER: metargb_user
MYSQL_PASSWORD: metargb_password
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
networks:
- metargb-network
command:
- --host-cache-size=0
- --pid-file=/tmp/mysqld.pid
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-proot_password"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
# Redis (for pub/sub and caching)
redis:
image: redis:7-alpine
container_name: metargb-redis
ports:
- "6379:6379"
networks:
- metargb-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# ============================================================================
# Core Microservices
# ============================================================================
# Auth Service - Authentication & User Management
auth-service:
build:
context: .
dockerfile: ./services/auth-service/Dockerfile
container_name: metargb-auth-service
ports:
- "50051:50051"
env_file:
- ./services/auth-service/config.env
environment:
GRPC_PORT: 50051
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_URL: redis://redis:6379/0
NOTIFICATIONS_SERVICE_ADDR: notifications-service:50058
LEVELS_SERVICE_ADDR: levels-service:50054
FEATURES_SERVICE_ADDR: features-service:50053
COMMERCIAL_SERVICE_ADDR: commercial-service:50052
# OAUTH_SERVER_URL, OAUTH_CLIENT_ID, and OAUTH_CLIENT_SECRET are loaded from config.env via env_file
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
notifications-service:
condition: service_started
commercial-service:
condition: service_healthy
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "50051"]
interval: 30s
timeout: 3s
retries: 3
develop:
watch:
- action: rebuild
path: ./services/auth-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# gRPC Gateway Service - REST to gRPC Translation
grpc-gateway:
build:
context: .
dockerfile: ./services/grpc-gateway/Dockerfile
container_name: metargb-grpc-gateway
ports:
- "8080:8080"
env_file:
- ./services/grpc-gateway/config.env
environment:
HTTP_PORT: 8080
AUTH_SERVICE_ADDR: auth-service:50051
CALENDAR_SERVICE_ADDR: calendar-service:50059
DYNASTY_SERVICE_ADDR: dynasty-service:50055
FEATURES_SERVICE_ADDR: features-service:50053
FINANCIAL_SERVICE_ADDR: financial-service:50062
LEVELS_SERVICE_ADDR: levels-service:50054
TRAINING_SERVICE_ADDR: training-service:50057
SUPPORT_SERVICE_ADDR: support-service:50056
SOCIAL_SERVICE_ADDR: social-service:50061
NOTIFICATION_SERVICE_ADDR: notifications-service:50058
STORAGE_SERVICE_ADDR: storage-service:8059
depends_on:
auth-service:
condition: service_started
training-service:
condition: service_started
storage-service:
condition: service_started
levels-service:
condition: service_started
social-service:
condition: service_started
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
develop:
watch:
- action: rebuild
path: ./services/grpc-gateway
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Commercial Service - Wallets & Transactions
commercial-service:
build:
context: .
dockerfile: ./services/commercial-service/Dockerfile
container_name: metargb-commercial-service
ports:
- "50052:50052"
env_file:
- ./services/commercial-service/config.env
environment:
GRPC_PORT: 50052
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "50052"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- metargb-network
restart: unless-stopped
develop:
watch:
- action: rebuild
path: ./services/commercial-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Features Service - Feature/Land Management
features-service:
build:
context: .
dockerfile: ./services/features-service/Dockerfile
container_name: metargb-features-service
ports:
- "50053:50053"
env_file:
- ./services/features-service/config.env
environment:
GRPC_PORT: 50053
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
REDIS_HOST: redis
REDIS_PORT: 6379
COMMERCIAL_SERVICE_ADDR: commercial-service:50052
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
commercial-service:
condition: service_started
networks:
- metargb-network
restart: unless-stopped
develop:
watch:
- action: rebuild
path: ./services/features-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Levels Service - User Progression & Activities
levels-service:
build:
context: .
dockerfile: ./services/levels-service/Dockerfile
container_name: metargb-levels-service
ports:
- "50054:50054"
env_file:
- ./services/levels-service/config.env
environment:
GRPC_PORT: 50054
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
depends_on:
mysql:
condition: service_healthy
networks:
- metargb-network
restart: unless-stopped
develop:
watch:
- action: rebuild
path: ./services/levels-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Dynasty Service - Family & Dynasty Management
dynasty-service:
build:
context: .
dockerfile: ./services/dynasty-service/Dockerfile
container_name: metargb-dynasty-service
ports:
- "50055:50055"
env_file:
- ./services/dynasty-service/config.env
environment:
GRPC_PORT: 50055
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
depends_on:
mysql:
condition: service_healthy
networks:
- metargb-network
restart: unless-stopped
develop:
watch:
- action: rebuild
path: ./services/dynasty-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Calendar Service - Events Management
calendar-service:
build:
context: .
dockerfile: ./services/calendar-service/Dockerfile
container_name: metargb-calendar-service
ports:
- "50059:50059"
env_file:
- ./services/calendar-service/config.env
environment:
GRPC_PORT: 50059
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
depends_on:
mysql:
condition: service_healthy
networks:
- metargb-network
restart: unless-stopped
develop:
watch:
- action: rebuild
path: ./services/calendar-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Support Service - Tickets & Reports
support-service:
build:
context: .
dockerfile: ./services/support-service/Dockerfile
container_name: metargb-support-service
ports:
- "50056:50056"
env_file:
- ./services/support-service/config.env
environment:
GRPC_PORT: 50056
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
NOTIFICATION_SERVICE_ADDR: notifications-service:50058
depends_on:
mysql:
condition: service_healthy
notifications-service:
condition: service_started
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "50056"]
interval: 30s
timeout: 3s
retries: 3
develop:
watch:
- action: rebuild
path: ./services/support-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Social Service - Challenge quiz & user follow graph
social-service:
build:
context: .
dockerfile: ./services/social-service/Dockerfile
container_name: metargb-social-service
ports:
- "50061:50061"
env_file:
- ./services/social-service/config.env
environment:
GRPC_PORT: 50061
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
COMMERCIAL_SERVICE_ADDR: commercial-service:50052
depends_on:
mysql:
condition: service_healthy
commercial-service:
condition: service_healthy
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "50061"]
interval: 30s
timeout: 3s
retries: 3
develop:
watch:
- action: rebuild
path: ./services/social-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Training Service - Video Tutorials & Comments
training-service:
build:
context: .
dockerfile: ./services/training-service/Dockerfile
container_name: metargb-training-service
ports:
- "50057:50057"
env_file:
- ./services/training-service/config.env
environment:
GRPC_PORT: 50057
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
AUTH_SERVICE_ADDR: auth-service:50051
depends_on:
mysql:
condition: service_healthy
auth-service:
condition: service_healthy
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "50057"]
interval: 30s
timeout: 3s
retries: 3
develop:
watch:
- action: rebuild
path: ./services/training-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Notifications Service - Multi-channel Notifications
notifications-service:
build:
context: .
dockerfile: ./services/notifications-service/Dockerfile
container_name: metargb-notifications-service
ports:
- "50058:50058"
env_file:
- ./services/notifications-service/config.env
environment:
GRPC_PORT: 50058
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
DB_MAX_OPEN_CONNS: 25
DB_MAX_IDLE_CONNS: 5
DB_CONN_MAX_LIFETIME: 5m
REDIS_ADDR: redis:6379
REDIS_DB: 0
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "50058"]
interval: 30s
timeout: 3s
retries: 3
develop:
watch:
- action: rebuild
path: ./services/notifications-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Financial Service - Payment Processing & Transactions
financial-service:
build:
context: .
dockerfile: ./services/financial-service/Dockerfile
container_name: metargb-financial-service
ports:
- "50062:50062"
env_file:
- ./services/financial-service/config.env
environment:
GRPC_PORT: 50062
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
depends_on:
mysql:
condition: service_healthy
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "50062"]
interval: 30s
timeout: 3s
retries: 3
develop:
watch:
- action: rebuild
path: ./services/financial-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- action: rebuild
path: ./shared
# Storage Service - File Upload & Management
storage-service:
build:
context: .
dockerfile: ./services/storage-service/Dockerfile
container_name: metargb-storage-service
ports:
- "50060:50060" # gRPC port
- "8059:8059" # HTTP REST API port
volumes:
- ./services/storage-service/uploads:/app/uploads
env_file:
- ./services/storage-service/config.env
environment:
GRPC_PORT: 50060
HTTP_PORT: 8059
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: metargb_db
DB_USER: metargb_user
DB_PASSWORD: metargb_password
TEMP_DIR: /tmp/storage-chunks
depends_on:
mysql:
condition: service_healthy
networks:
- metargb-network
restart: unless-stopped
develop:
watch:
- action: rebuild
path: ./services/storage-service
ignore:
- "**/_test.go"
- "**/tmp"
- "**/.git"
- "**/uploads"
- action: rebuild
path: ./shared
# ============================================================================
# Gateway Services
# ============================================================================
# WebSocket Gateway - Real-time Communication
websocket-gateway:
build:
context: .
dockerfile: ./websocket-gateway/Dockerfile
container_name: metargb-websocket-gateway
ports:
- "3002:3002"
env_file:
- ./websocket-gateway/config.env
environment:
PORT: 3002
REDIS_URL: redis://redis:6379
AUTH_SERVICE_ADDR: auth-service:50051
depends_on:
redis:
condition: service_healthy
auth-service:
condition: service_started
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3002/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
interval: 30s
timeout: 5s
retries: 3
develop:
watch:
- action: sync+restart
path: ./websocket-gateway
target: /app
ignore:
- "**/node_modules"
- "**/.git"
- action: rebuild
path: ./websocket-gateway/package.json
- action: rebuild
path: ./websocket-gateway/package-lock.json
# Health Check Service - System Health Monitoring
health-check-service:
build:
context: .
dockerfile: ./services/health-check-service/Dockerfile
container_name: metargb-health-check-service
ports:
- "8090:8090"
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/health"]
interval: 30s
timeout: 3s
retries: 3
# Kong API Gateway - HTTP to gRPC Translation
kong:
image: kong:3.4
container_name: metargb-kong
environment:
KONG_DATABASE: "off"
KONG_DECLARATIVE_CONFIG: /kong/kong.yml
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_ADMIN_LISTEN: 0.0.0.0:8001
KONG_PROXY_LISTEN: 0.0.0.0:8000
ports:
- "8000:8000" # Proxy port (main API endpoint)
- "8001:8001" # Admin API
volumes:
- ./kong/kong.yml:/kong/kong.yml:ro
- ./shared/proto:/kong/protos:ro
depends_on:
grpc-gateway:
condition: service_healthy
auth-service:
condition: service_started
commercial-service:
condition: service_started
features-service:
condition: service_started
levels-service:
condition: service_started
dynasty-service:
condition: service_started
calendar-service:
condition: service_started
support-service:
condition: service_started
training-service:
condition: service_started
notifications-service:
condition: service_started
storage-service:
condition: service_started
financial-service:
condition: service_started
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "kong", "health"]
interval: 10s
timeout: 5s
retries: 5
# ============================================================================
# Monitoring Stack
# ============================================================================
# Prometheus - Metrics Collection
prometheus:
image: prom/prometheus:v2.47.0
container_name: metargb-prometheus
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=30d'
- '--web.enable-lifecycle'
- '--web.enable-admin-api'
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/-/healthy"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Grafana - Visualization & Dashboards
grafana:
image: grafana/grafana:10.1.5
container_name: metargb-grafana
ports:
- "3001:3001"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin123
- GF_USERS_ALLOW_SIGN_UP=false
- GF_SERVER_HTTP_PORT=3001
- GF_SERVER_ROOT_URL=http://localhost:3001
- GF_INSTALL_PLUGINS=
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana/datasources:/etc/grafana/provisioning/datasources:ro
- ./monitoring/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
- ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards:ro
networks:
- metargb-network
restart: unless-stopped
depends_on:
- prometheus
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/api/health"]
interval: 30s
timeout: 10s
retries: 3
# Node Exporter - Host-level infrastructure metrics (CPU, Memory, Disk, Network)
node-exporter:
image: prom/node-exporter:v1.6.1
container_name: metargb-node-exporter
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--path.rootfs=/rootfs'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
ports:
- "9100:9100"
networks:
- metargb-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9100/metrics"]
interval: 30s
timeout: 10s
retries: 3
# Note: cAdvisor removed due to Windows/Docker Desktop compatibility issues
# Node Exporter provides host-level infrastructure metrics (CPU, Memory, Disk, Network)
# For container-level metrics on Windows, consider using Docker Desktop's built-in metrics
volumes:
mysql_data:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
networks:
metargb-network:
driver: bridge