-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
288 lines (232 loc) · 8.96 KB
/
docker-compose.dev.yml
File metadata and controls
288 lines (232 loc) · 8.96 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
version: "3.9"
############################################################
# Docker Compose for APILog Dev Environment
# APILog 개발/테스트 환경용 Docker Compose 설정 (DB는 휘발성)
############################################################
services:
############################################################
# 1) InfluxDB 3 Core (dev)
# Time-series DB (HTTP API on port 8181)
# 시간 기반 데이터 저장소 (포트 8181)
############################################################
influxdb3-core:
image: influxdb:3-core
container_name: influxdb3-core
environment:
# Storage type: local filesystem
# 스토리지 타입: 로컬 파일 시스템
INFLUXDB3_OBJECT_STORE: file
# Data directory (컨테이너 내부, 볼륨 X → 휘발성)
# 데이터 디렉터리 (컨테이너 삭제 시 함께 삭제)
INFLUXDB3_DB_DIR: /var/lib/influxdb3
# Node ID (required argument)
# 노드 ID (필수 인자)
INFLUXDB3_NODE_ID: influx-node0
# Log level
# 로그 레벨
LOG_FILTER: info
# Disable authentication for development convenience
# 개발 편의를 위해 인증 비활성화
INFLUXDB3_START_WITHOUT_AUTH: "true"
command:
- influxdb3
- serve
- --log-filter
- info
- --without-auth
- --object-store
- file
- --plugin-dir
- /plugins
- --node-id
- influx-node0
# Host 8181 -> Container 8181 (HTTP API)
# 호스트 8181 포트를 컨테이너 8181로 매핑
ports:
- "8181:8181"
volumes:
# ✅ DB 디렉터리는 더 이상 볼륨 마운트하지 않음 (완전 휘발성)
# - influx-data:/var/lib/influxdb3
# - influx-meta:/home/influxdb3/.influxdb3
# Plugins directory (rollups, custom scripts)
# 플러그인/커스텀 스크립트 디렉터리
- influx-plugins:/plugins
restart: unless-stopped
############################################################
# 2) InfluxDB 3 Explorer (Web UI)
# Manage DBs, tokens, and run queries (port 8888)
# DB/토큰 관리 및 쿼리 실행을 위한 웹 UI (포트 8888)
############################################################
influxdb3-explorer:
image: influxdata/influxdb3-ui:1.3.0
container_name: influxdb3-explorer
command: ["--mode=admin"]
# Host 8888 -> Explorer UI
# 호스트 8888 포트를 UI로 노출
ports:
- "8888:80"
volumes:
# Explorer 내부 상태도 휘발성으로 쓰고 싶다면 별도 볼륨 불필요
# - explorer-data:/db
- ./examples/influxdb3-explorer/config:/app-root/config:ro
depends_on:
- influxdb3-core
restart: unless-stopped
############################################################
# 3) apilog-api (FastAPI backend)
# Event ingestion & query API for APILog
# 이벤트 수집 및 조회를 처리하는 FastAPI 백엔드
############################################################
apilog-api:
container_name: apilog-api
build: ./back/app
environment:
# Influx endpoint for dev API
# 개발용 Influx 연결 정보 (.env에서 설정 권장)
INFLUX_URL: ${INFLUX_URL}
INFLUX_DATABASE: apilog_db
# CORS / LLM / AI widgets
# CORS 및 LLM/AI 위젯 관련 설정
CORS_ALLOW_ORIGIN: ${CORS_ALLOW_ORIGIN}
LLM_PROVIDER: ${LLM_PROVIDER}
LLM_ENDPOINT: ${LLM_ENDPOINT}
LLM_MODEL: ${LLM_MODEL}
LLM_MAX_TOKENS: ${LLM_MAX_TOKENS}
LLM_TEMPERATURE: ${LLM_TEMPERATURE}
LLM_TIMEOUT_S: ${LLM_TIMEOUT_S}
AI_REPORT_LLM_PROVIDER: ${AI_REPORT_LLM_PROVIDER}
AI_REPORT_LLM_ENDPOINT: ${AI_REPORT_LLM_ENDPOINT}
AI_REPORT_LLM_MODEL: ${AI_REPORT_LLM_MODEL}
AI_REPORT_LLM_API_KEY: ${AI_REPORT_LLM_API_KEY}
LLM_API_KEY: ${AI_REPORT_LLM_API_KEY}
AI_REPORT_LLM_MAX_TOKENS: ${AI_REPORT_LLM_MAX_TOKENS}
AI_REPORT_LLM_TEMPERATURE: ${AI_REPORT_LLM_TEMPERATURE}
AI_REPORT_LLM_TIMEOUT_S: ${AI_REPORT_LLM_TIMEOUT_S}
AI_INSIGHTS_CACHE_TTL: ${AI_INSIGHTS_CACHE_TTL}
AI_INSIGHTS_EXPLAIN_CACHE_TTL: ${AI_INSIGHTS_EXPLAIN_CACHE_TTL}
AI_REPORT_FETCH_BASE: ${AI_REPORT_FETCH_BASE}
# Heatmap/snapshot용 대상 사이트
TARGET_SITE_BASE_URL: http://dummy-frontend:3000
depends_on:
- influxdb3-core
- ollama
# Only exposed inside the compose network (Nginx proxies this)
# compose 내부에서만 노출 (Nginx가 프록시)
ports:
- "8000:8000"
volumes:
# Store generated heatmap snapshots
# 생성된 히트맵 스냅샷 저장
- snapshots:/snapshots
restart: unless-stopped
############################################################
# 4) apilog-nginx (Frontend + Reverse Proxy)
# Serves dashboard UI + proxies API
# 대시보드 UI 제공 및 API 리버스 프록시
############################################################
apilog-nginx:
container_name: apilog-nginx
build:
context: .
dockerfile: infra/nginx/Dockerfile
# Host 10000 -> Container 80 (change if collision)
# 호스트 10000 포트 사용 (충돌 시 수정)
ports:
- "10000:80"
depends_on:
- apilog-api
restart: unless-stopped
############################################################
# 5) dummy-frontend (Test site)
# Sample site for heatmap/snapshot testing
# 히트맵/스냅샷 테스트용 샘플 사이트
############################################################
dummy-frontend:
build:
context: ./examples/dummy-frontend
dockerfile: Dockerfile
container_name: dummy-frontend
# Host 80 -> Container 3000 (accessible in browser)
# 호스트 80 포트를 컨테이너 3000에 매핑 (브라우저 접근)
ports:
- "80:3000"
environment:
NODE_ENV: production
restart: unless-stopped
############################################################
# 6) ollama (Local LLM Server)
# Local LLM endpoint for dev widgets
# 개발 환경용 로컬 LLM 서버
############################################################
ollama:
image: ollama/ollama:latest
container_name: ollama
environment:
OLLAMA_HOST: 0.0.0.0
OLLAMA_KEEP_ALIVE: 1h
# Fallback model if not set via .env
# .env에 없으면 llama3:8b 사용
LLM_MODEL: ${LLM_MODEL:-llama3:8b}
# Expose Ollama publicly for dev convenience
# 개발 편의를 위해 호스트에 노출
ports:
- "11434:11434"
volumes:
# Cache downloaded models
# 다운로드한 LLM 모델 캐시
- ollama-data:/root/.ollama
entrypoint:
- /bin/sh
- -c
- |
echo "Bootstrapping Ollama model: $LLM_MODEL"
ollama serve &
PID=$!
sleep 10
if [ -n "$LLM_MODEL" ]; then
ollama pull "$LLM_MODEL" || echo "Warning: failed to pull $LLM_MODEL"
fi
wait $$PID
restart: unless-stopped
gpus: all
############################################################
# 7) apilog-seeder (dev dummy data)
# InfluxDB에 매번 30일치 더미 이벤트 5만개 시드
# - docker compose up 할 때마다 새 DB + 랜덤 데이터 생성
############################################################
apilog-seeder:
image: python:3.12-slim
container_name: apilog-seeder
depends_on:
- influxdb3-core
environment:
# InfluxDB 3 Core 엔드포인트 (컨테이너 이름 기준)
INFLUX_URL: http://influxdb3-core:8181
# 쓸 DB 이름 (없으면 자동 생성)
INFLUX_DATABASE: apilog_db
# 시드 개수 / 기간 설정
SEED_EVENT_COUNT: 50000 # 5만 개
SEED_DAYS: 30 # 최근 30일
SEED_BATCH_SIZE: 5000 # 5k 라인 단위로 나눠서 write
volumes:
# ✅ 예제 디렉터리 전체를 동일 경로 구조(/workspace/examples)로 마운트
# -> 컨테이너 내에서도 /workspace/examples/dummy-influx/seed_influx.py 경로가 유지됨
- ./examples:/workspace/examples:ro
working_dir: /workspace/examples/dummy-influx
# requests 설치 후 스크립트 한 번 실행
command: >
sh -c "pip install --no-cache-dir requests &&
python seed_influx.py"
# 한 번 돌고 끝나는 용도 (DB는 휘발성이라 up 할 때마다 새로 시드)
restart: "no"
##############################################################
# Named Volumes (persistent data)
# 영속 데이터를 위한 볼륨 정의 (DB는 휘발성이라 제외)
##############################################################
volumes:
# influx-data: # dev에서는 사용하지 않음 (DB 휘발성)
# influx-meta: # dev에서는 사용하지 않음
influx-plugins: # 플러그인/스크립트 (필요하면 유지)
snapshots: # 히트맵 스냅샷 파일
ollama-data: # LLM 모델 캐시 (용량 크니까 유지 추천)
# explorer-data: # Explorer 내부 상태도 휘발성으로 쓰려면 제외