-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
114 lines (107 loc) · 3.98 KB
/
Copy pathdocker-compose.yml
File metadata and controls
114 lines (107 loc) · 3.98 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
services:
postgres:
image: pgvector/pgvector:pg16
container_name: sscm-postgres
ports:
- "${DB_PORT:-5432}:5432"
environment:
POSTGRES_DB: ${DB_NAME:-sscm}
POSTGRES_USER: ${DB_USER:-sscm}
POSTGRES_PASSWORD: ${DB_PASSWORD:-sscm1234}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-sscm}"]
interval: 10s
timeout: 5s
retries: 5
# ── OLAP 인프라 ──────────────────────────────────────────────
# Zookeeper: Kafka 클러스터의 메타데이터(토픽 설정, 브로커 상태 등)를 관리
zookeeper:
image: confluentinc/cp-zookeeper:7.6.0
container_name: sscm-zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181 # 클라이언트(Kafka)가 접속하는 포트
ZOOKEEPER_TICK_TIME: 2000 # 하트비트 주기 (ms)
# Kafka: 도메인 이벤트를 전달하는 메시지 브로커
# Producer(Spring Boot)가 이벤트를 발행하면 Consumer가 받아서 분석 DB에 적재
kafka:
image: confluentinc/cp-kafka:7.6.0
container_name: sscm-kafka
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 # Zookeeper 연결 주소
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
# kafka:29092 → Docker 내부 컨테이너끼리 통신할 때 사용
# localhost:9092 → 호스트(Spring Boot 앱)에서 접속할 때 사용
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 # 로컬 단일 브로커이므로 1
depends_on:
- zookeeper
healthcheck:
test: ["CMD", "kafka-topics", "--bootstrap-server", "localhost:9092", "--list"]
interval: 15s
timeout: 10s
retries: 5
start_period: 30s
# Analytics DB: 분석 전용 PostgreSQL (운영 DB와 물리적으로 분리)
# 집계 데이터가 여기에 저장됨 → 대시보드 API는 이 DB만 조회
postgres-analytics:
image: pgvector/pgvector:pg16
container_name: sscm-postgres-analytics
ports:
- "5433:5432" # 호스트에서는 5433으로 접근 (운영 DB 5432와 구분)
environment:
POSTGRES_DB: sscm_analytics
POSTGRES_USER: sscm
POSTGRES_PASSWORD: sscm1234
volumes:
- pgdata-analytics:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sscm"]
interval: 10s
timeout: 5s
retries: 5
# ── Redis (JWT 블랙리스트 캐시) ────────────────────────────
redis:
image: redis:7-alpine
container_name: sscm-redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ── 모니터링 ────────────────────────────────────────────────
prometheus:
image: prom/prometheus:v2.51.0
container_name: sscm-prometheus
ports:
- "9090:9090"
volumes:
- ./infra/monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
extra_hosts:
- "host.docker.internal:host-gateway"
grafana:
image: grafana/grafana:10.4.0
container_name: sscm-grafana
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- ./infra/monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
- ./infra/monitoring/grafana/dashboards:/var/lib/grafana/dashboards:ro
depends_on:
- prometheus
volumes:
pgdata:
pgdata-analytics: