-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
266 lines (257 loc) · 7.47 KB
/
docker-compose.yml
File metadata and controls
266 lines (257 loc) · 7.47 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
services:
mysql:
image: mysql:9.4.0 # 실행할 이미지 및 버전
container_name: mysql # 컨테이너 이름 설정
ports:
- "3307:3306" # 로컬 호스트 포트와 가상 컨테이너의 포트를 연결
environment:
MYSQL_ROOT_PASSWORD: admin # MySQL root 계정 암호 설정
TZ: Asia/Seoul
volumes:
- ./docker/mysql/data:/var/lib/mysql # 로컬저장경로:도커저장경로 - 컨테이너 종료 후에도 데이터를 로컬에 저장하여 유지 (로컬 경로변경 가능)
- ./docker/mysql/init:/docker-entrypoint-initdb.d # 로컬저장경로:도커저장경로 - 해당 경로에 작성된 DDL 컨테이너 생성 시 자동실행 (.sql .sh 파일 실행) (로컬 경로변경 가능)
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] # 실행할 명령어 - MySQL에 ping 전송
interval: 10s # 10초마다 헬스체크
timeout: 5s # 5초 안에 응답이 없을 시 실패 처리
retries: 3 # 3번 연속 헬스체크 실패 시 unhealthy
start_period: 30s # 시작 후 30초는 실패해도 카운트 하지 않음
deploy:
resources:
limits:
cpus: '1' # CPU 1코어
memory: 512M # 메모리 512MB (256M도 가능하지만 안정성 고려)
reservations:
cpus: '0.25' # 최소 보장 CPU
memory: 128M # 최소 보장 메모리
networks:
- app-network # 컨테이너 통신을 위한 가상 네트워크 지정
restart: unless-stopped # 재시작 정책
oracledb:
image: zzzzseong/oracle-db:19.3.0
container_name: oracledb
ports:
- "1521:1521"
environment:
ORACLE_PASSWORD: admin
TZ: Asia/Seoul
volumes:
- ./docker/oracledb/data:/opt/oracle/oradata
deploy:
resources:
limits:
cpus: '1'
memory: 2G # Oracle은 최소 2G 권장
reservations:
cpus: '0.5'
memory: 512M
networks:
- app-network
restart: unless-stopped
postgresql:
image: postgres:17.2
container_name: postgresql
ports:
- "5432:5432"
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
POSTGRES_DB: postgres # 기본 데이터베이스
TZ: Asia/Seoul
PGDATA: /var/lib/postgresql/data/pgdata # 데이터 저장 경로
volumes:
- ./docker/postgresql/data:/var/lib/postgresql/data
- ./docker/postgresql/init:/docker-entrypoint-initdb.d # 초기화 SQL 스크립트
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U admin -d postgres" ]
interval: 10s
timeout: 5s
retries: 3
deploy:
resources:
limits:
cpus: '1'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
networks:
- app-network
restart: unless-stopped
redis:
image: redis:8.2.1
container_name: redis
ports:
- "6379:6379"
volumes:
- ./docker/redis/data:/data
# Redis 설정 파일 추가 가능
# command: redis-server /usr/local/etc/redis/redis.conf
restart: unless-stopped
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 3s
retries: 3
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M # Redis는 가볍게
reservations:
cpus: '0.1'
memory: 64M
networks:
- app-network
valkey:
image: valkey/valkey:8.1.3
container_name: valkey
ports:
- "6380:6379"
volumes:
- ./docker/valkey/data:/data
# Valkey 설정 파일 추가 가능
# command: valkey-server /usr/local/etc/valkey/valkey.conf
healthcheck:
test: [ "CMD", "valkey-cli", "ping" ]
interval: 10s
timeout: 3s
retries: 3
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.1'
memory: 64M
networks:
- app-network
restart: unless-stopped
mongodb:
image: mongo:8.0.13-noble
container_name: mongodb
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
volumes:
- ./docker/mongodb/data:/data/db # 데이터 영구 저장을 위한 볼륨
# 설정 파일 추가 가능
# - ./docker/mongodb/mongod.conf:/etc/mongod.conf
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 3
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
networks:
- app-network
restart: unless-stopped
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: rabbitmq
ports:
- "5672:5672"
- "15672:15672"
environment:
RABBITMQ_ERLANG_COOKIE: rabbitmq
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: admin
TZ: Asia/Seoul
volumes:
# RabbitMQ 설정을 따로 커스터마이징할 게 아니라면, 그냥 아래처럼 /etc/rabbitmq/ 마운트를 삭제하는 게 깔끔함
# - ./docker/rabbitmq/etc/:/etc/rabbitmq/
- ./docker/rabbitmq/data/:/var/lib/rabbitmq/
- ./docker/rabbitmq/logs/:/var/log/rabbitmq/
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 10s
timeout: 5s
retries: 3
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
networks:
- app-network
restart: unless-stopped
prometheus:
image: prom/prometheus:v3.8.0
container_name: prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- ./prometheus/alert_rules.yml:/etc/prometheus/alert_rules.yml
- ./docker/prometheus/data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:9090/-/healthy"]
interval: 10s
timeout: 5s
retries: 3
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
networks:
- app-network
restart: unless-stopped
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- "3000:3000"
volumes:
- ./docker/grafana/data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
- GF_SERVER_ROOT_URL=http://localhost:3000
healthcheck:
test: ["CMD-SHELL", "wget --spider -q http://localhost:3000/api/health || exit 1"]
interval: 10s
timeout: 5s
retries: 3
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
networks:
- app-network
restart: unless-stopped
depends_on:
- prometheus
# 네트워크 설정 추가
networks:
app-network:
driver: bridge
name: playground-network