-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
200 lines (187 loc) · 4.96 KB
/
docker-compose.yml
File metadata and controls
200 lines (187 loc) · 4.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
version: '3.8'
networks:
flash-sale-network:
driver: bridge
services:
# Eureka 서버 정의
eureka:
build:
context: ./com.flash.eureka
env_file:
- ${EUREKA_ENV}
ports:
- ${EUREKA_PORT}:${EUREKA_PORT} # 애플리케이션 포트 매핑 설정 (수정 가능)
networks:
- flash-sale-network
healthcheck:
test: [ "CMD", "curl", "-f", "${DOMAIN}:${EUREKA_PORT}/actuator/health" ]
interval: 10s
timeout: 5s
retries: 5
# Gateway 서버 정의
gateway:
build:
context: ./com.flash.gateway
env_file:
- ${GATEWAY_ENV}
ports:
- ${GATEWAY_PORT}:${GATEWAY_PORT} # 애플리케이션 포트 매핑 설정 (수정 가능)
depends_on:
eureka:
condition: service_healthy
networks:
- flash-sale-network
healthcheck:
test: [ "CMD", "curl", "-f", "${DOMAIN}:${GATEWAY_PORT}/actuator/health" ]
interval: 10s
timeout: 5s
retries: 5
restart: on-failure
# Auth 서버 정의
auth:
build:
context: ./com.flash.auth
env_file:
- ${AUTH_ENV}
ports:
- ${AUTH_PORT}:${AUTH_PORT} # 애플리케이션 포트 매핑 설정 (수정 가능)
depends_on:
gateway:
condition: service_healthy
redis:
condition: service_healthy
networks:
- flash-sale-network
restart: on-failure
# User 서버 정의
user:
build:
context: ./com.flash.user
env_file:
- ${USER_ENV}
ports:
- ${USER_PORT}:${USER_PORT} # 애플리케이션 포트 매핑 설정 (수정 가능)
depends_on:
gateway:
condition: service_healthy
networks:
- flash-sale-network
restart: on-failure
# Flash-Sale 서버 정의
flash-sale:
build:
context: ./com.flash.flashsale
env_file:
- ${FLASH_SALE_ENV}
ports:
- ${FLASH_SALE_PORT}:${FLASH_SALE_PORT} # 애플리케이션 포트 매핑 설정 (수정 가능)
depends_on:
gateway:
condition: service_healthy
redis:
condition: service_healthy
networks:
- flash-sale-network
restart: on-failure
# Order 서버 정의
order:
build:
context: ./com.flash.order
env_file:
- ${ORDER_ENV}
ports:
- ${ORDER_PORT}:${ORDER_PORT} # 애플리케이션 포트 매핑 설정 (수정 가능)
depends_on:
gateway:
condition: service_healthy
redis:
condition: service_healthy
networks:
- flash-sale-network
restart: on-failure
# Vendor 서버 정의
vendor:
build:
context: ./com.flash.vendor
env_file:
- ${VENDOR_ENV}
ports:
- ${VENDOR_PORT}:${VENDOR_PORT} # 애플리케이션 포트 매핑 설정 (수정 가능)
depends_on:
gateway:
condition: service_healthy
redis:
condition: service_healthy
networks:
- flash-sale-network
restart: on-failure
#Alarm 서버 정의
alarm:
build:
context: ./com.flash.alarm
env_file:
- ${ALARM_ENV}
ports:
- ${ALARM_PORT}:${ALARM_PORT} # 애플리케이션 포트 매핑 설정 (수정 가능)
depends_on:
gateway:
condition: service_healthy
networks:
- flash-sale-network
restart: on-failure
redis: # container name
image: redis:latest
ports: # 바인딩할 포트:내부 포트
- ${REDIS_OUTER_PORT}:${REDIS_INNER_PORT}
volumes: # 마운트할 볼륨 설정
- redis_data:/var/lib/redis/user/data
- ./redis.conf:/usr/local/etc/redis/redis.conf # 파일 경로 수정
networks:
- flash-sale-network
healthcheck:
test: [ "CMD", "redis-cli", "ping" ] # redis-cli ping 명령어로 상태 확인
interval: 30s # 헬스 체크 간격
timeout: 10s # 응답 대기 시간
retries: 5 # 실패 후 재시도 횟수
start_period: 10s # 컨테이너 시작 후 첫 헬스 체크까지 대기 시간
restart: always
zookeeper:
image: wurstmeister/zookeeper:3.4.6
container_name: flash-zookeeper
ports:
- "2181:2181"
networks:
- flash-sale-network
kafka:
image: wurstmeister/kafka:2.13-2.7.0
container_name: flash-kafka
ports:
- "9092:9092"
environment:
KAFKA_ZOOKEEPER_CONNECT: flash-zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${KAFKA_LISTENERS_URL}:9092 # 외부 클라이언트가 접근할 주소
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 # 모든 인터페이스에서 수신 가능
networks:
- flash-sale-network
depends_on:
- zookeeper
prometheus:
image: prom/prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
networks:
- flash-sale-network
grafana:
image: grafana/grafana
ports:
- "3000:3000"
networks:
- flash-sale-network
depends_on:
- prometheus
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
volumes:
redis_data: