Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
257 lines (244 loc) · 7.76 KB
/
Copy pathdocker-compose.yml
File metadata and controls
257 lines (244 loc) · 7.76 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
services:
elasticsearch:
build: ./elasticsearch
container_name: sobee-elasticsearch
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- ES_JAVA_OPTS=-Xms512m -Xmx512m
ports:
- "9200:9200"
volumes:
- es_data:/usr/share/elasticsearch/data
networks:
- sobee-net
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
ssh-tunnel:
image: alpine:latest
container_name: sobee-ssh-tunnel
volumes:
- ${SSH_KEY_PATH}:/root/.ssh/id_rsa:ro
ports:
- "3307:3306"
environment:
- DB_HOST=${DB_HOST}
- SSH_USER=${SSH_USER}
- SSH_JUMP_HOST=${SSH_JUMP_HOST}
command: >
sh -c "apk add --no-cache openssh-client netcat-openbsd &&
cp /root/.ssh/id_rsa /tmp/id_rsa &&
chmod 600 /tmp/id_rsa &&
ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o ExitOnForwardFailure=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -N -T -L 0.0.0.0:3306:10.250.3.155:3306 -i /tmp/id_rsa ${SSH_USER}@${SSH_JUMP_HOST}"
networks:
- sobee-net
healthcheck:
test: ["CMD-SHELL", "nc -z 127.0.0.1 3306 || exit 1"]
interval: 5s
timeout: 5s
retries: 20
start_period: 30s
dashboard:
build:
context: ./dashboard
ports:
- "5174:80"
restart: unless-stopped
depends_on:
- fastapi
networks:
- sobee-net
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- frontend
- spring
- fastapi
networks:
- sobee-net
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.dev
volumes:
- ./frontend/src:/app/src
expose:
- "3000"
environment:
- SPRING_PROXY_TARGET=http://spring:8080
- FASTAPI_PROXY_TARGET=http://fastapi:8000
- VITE_FASTAPI_BASE_URL=http://localhost:8000
depends_on:
- spring
- fastapi
networks:
- sobee-net
spring:
build:
context: ./backend/spring
dockerfile: Dockerfile
ports:
- "8080:8080"
env_file:
- .env # 공통 (RDS, SSH)
- backend/spring/.env # Spring 전용 (JWT, API Key)
environment:
- DB_HOST=ssh-tunnel
- DB_PORT=3306
- FASTAPI_BASE_URL=http://fastapi:8000
- ES_URI=http://elasticsearch:9200
- CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173,https://sobee-logs.duckdns.org
- TZ=Asia/Seoul
- JAVA_TOOL_OPTIONS=-Duser.timezone=Asia/Seoul
restart: on-failure
depends_on:
elasticsearch:
condition: service_healthy
ssh-tunnel:
condition: service_healthy
networks:
- sobee-net
fastapi:
build:
context: ./backend/fastapi
dockerfile: Dockerfile
ports:
- "8000:8000"
env_file:
- backend/fastapi/.env # FastAPI 전용 (AI, Codef)
environment:
- DB_HOST=${DB_HOST}
- DB_PORT=3306
- ENV=prod
- TZ=Asia/Seoul
restart: unless-stopped
networks:
- sobee-net
postgres-airflow:
image: postgres:15
container_name: sobee-postgres-airflow
environment:
POSTGRES_USER: airflow
POSTGRES_PASSWORD: ${AIRFLOW_POSTGRES_PASSWORD}
POSTGRES_DB: airflow
volumes:
- postgres_airflow_data:/var/lib/postgresql/data
networks:
- sobee-net
healthcheck:
test: ["CMD", "pg_isready", "-U", "airflow"]
interval: 5s
timeout: 5s
retries: 10
airflow-init:
image: apache/airflow:3.0.0
env_file: airflow/.env
environment:
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:${AIRFLOW_POSTGRES_PASSWORD}@postgres-airflow/airflow
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
SOBEE_FASTAPI_URL: http://fastapi:8000
TZ: Asia/Seoul
command: airflow db migrate
restart: on-failure
depends_on:
postgres-airflow:
condition: service_healthy
networks:
- sobee-net
# [Airflow UI] api-server. 접속 주소/계정 정보는 airflow/.env 참고 (gitignore)
airflow-api-server:
image: apache/airflow:3.0.0
container_name: sobee-airflow
env_file: airflow/.env
environment:
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:${AIRFLOW_POSTGRES_PASSWORD}@postgres-airflow/airflow
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
AIRFLOW__CORE__AUTH_MANAGER: airflow.api_fastapi.auth.managers.simple.simple_auth_manager.SimpleAuthManager
AIRFLOW__CORE__SIMPLE_AUTH_MANAGER_ALL_ADMINS: 'false'
AIRFLOW__CORE__SIMPLE_AUTH_MANAGER_PASSWORDS_FILE: /opt/airflow/passwords.json
# Airflow 3.0.0 SimpleAuthManager 무한 리다이렉트 버그 우회 (issue #49495):
# AIRFLOW__API__BASE_URL 을 실제 접속 주소로 지정해야 함. 값은 airflow/.env 에 설정
# (Public IP 변경 시 .env만 수정. .env 는 gitignore 되어 IP가 git에 노출되지 않음)
AIRFLOW__CORE__EXECUTION_API_SERVER_URL: http://airflow-api-server:8080/execution/
SOBEE_FASTAPI_URL: http://fastapi:8000
TZ: Asia/Seoul
command: api-server
ports:
- "8082:8080"
volumes:
- ./airflow/dags:/opt/airflow/dags
- ./airflow/logs:/opt/airflow/logs
- ./airflow/plugins:/opt/airflow/plugins
- ./airflow/passwords.json:/opt/airflow/passwords.json:ro
depends_on:
postgres-airflow:
condition: service_healthy
airflow-init:
condition: service_completed_successfully
networks:
- sobee-net
airflow-scheduler:
image: apache/airflow:3.0.0
env_file: airflow/.env
environment:
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:${AIRFLOW_POSTGRES_PASSWORD}@postgres-airflow/airflow
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
AIRFLOW__CORE__AUTH_MANAGER: airflow.api_fastapi.auth.managers.simple.simple_auth_manager.SimpleAuthManager
AIRFLOW__CORE__SIMPLE_AUTH_MANAGER_ALL_ADMINS: 'false'
AIRFLOW__CORE__EXECUTION_API_SERVER_URL: http://airflow-api-server:8080/execution/
SOBEE_FASTAPI_URL: http://fastapi:8000
TZ: Asia/Seoul
command: scheduler
volumes:
- ./airflow/dags:/opt/airflow/dags
- ./airflow/logs:/opt/airflow/logs
- ./airflow/plugins:/opt/airflow/plugins
depends_on:
postgres-airflow:
condition: service_healthy
airflow-init:
condition: service_completed_successfully
networks:
- sobee-net
airflow-dag-processor:
image: apache/airflow:3.0.0
env_file: airflow/.env
environment:
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:${AIRFLOW_POSTGRES_PASSWORD}@postgres-airflow/airflow
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
AIRFLOW__CORE__AUTH_MANAGER: airflow.api_fastapi.auth.managers.simple.simple_auth_manager.SimpleAuthManager
AIRFLOW__CORE__SIMPLE_AUTH_MANAGER_ALL_ADMINS: 'false'
AIRFLOW__CORE__EXECUTION_API_SERVER_URL: http://airflow-api-server:8080/execution/
SOBEE_FASTAPI_URL: http://fastapi:8000
TZ: Asia/Seoul
command: dag-processor
volumes:
- ./airflow/dags:/opt/airflow/dags
- ./airflow/logs:/opt/airflow/logs
- ./airflow/plugins:/opt/airflow/plugins
depends_on:
postgres-airflow:
condition: service_healthy
airflow-init:
condition: service_completed_successfully
networks:
- sobee-net
networks:
sobee-net:
driver: bridge
volumes:
es_data:
driver: local
postgres_airflow_data:
driver: local