-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-compose.yaml
239 lines (226 loc) · 6.81 KB
/
docker-compose.yaml
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
version : '3.7'
services:
# -------- API GATEWAY --------
nginx:
restart: always
container_name: nginx
depends_on:
- chatting-server-2
build:
context: ./nginx
dockerfile: Dockerfile
ports:
- "8060:80"
front-server:
container_name: front-server
build: ./spring-chatting-front-server
ports:
- "8054:8054"
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://chatting-db-2:5434/chat2
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=password
- SPRING_JPA_HIBERNATE_DDL_AUTO=update
- SERVER_PORT=8054
# 내부포트
depends_on:
- auth-server-1
- chatting-db-2
restart: always
# -------- KAFKA --------
zookeeper:
image: confluentinc/cp-zookeeper:7.2.1
container_name: zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
kafka1:
image: confluentinc/cp-kafka:7.2.1
container_name: kafka1
ports:
- "8097:8097"
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: EXTERNAL:PLAINTEXT,INTERNAL:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: EXTERNAL://localhost:8097,INTERNAL://kafka1:9092
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
restart: always
kafka2:
image: confluentinc/cp-kafka:7.2.1
container_name: kafka2
ports:
- "8098:8098"
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 2
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: EXTERNAL:PLAINTEXT,INTERNAL:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: EXTERNAL://localhost:8098,INTERNAL://kafka2:9092
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
restart: always
kafka3:
image: confluentinc/cp-kafka:7.2.1
container_name: kafka3
ports:
- "8099:8099"
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 3
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: EXTERNAL://localhost:8099,INTERNAL://kafka3:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: EXTERNAL:PLAINTEXT,INTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
restart: always
# -------- Chatting Server --------
chatting-db-1:
container_name: chatting-db-1
image: postgres:12-alpine
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=postgres
- POSTGRES_DB=chat1
expose:
- "5433" # Publishes 5433 to other containers but NOT to host machine
ports:
- "5433:5433"
volumes:
- ./backups:/home/backups
command: -c wal_level=logical -p 5433
restart: always
chatting-db-2:
container_name: chatting-db-2
image: postgres:12-alpine
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=postgres
- POSTGRES_DB=chat2
expose:
- "5434" # Publishes 5433 to other containers but NOT to host machine
ports:
- "5434:5434"
volumes:
- ./backups:/home/backups
command: -c wal_level=logical -p 5434
restart: always
chatting-server-1:
container_name: chatting-server-1
build: ./spring-chatting-backend-server
ports:
- "8081:8081"
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://chatting-db-2:5434/chat2
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=password
- SPRING_JPA_HIBERNATE_DDL_AUTO=update
- SERVER_PORT=8081
- KAFKA_BOOTSTRAP=kafka1:9092,kafka2:9092,kafka3:9092 # 내부포트
depends_on:
- kafka1
- kafka2
- kafka3
- chatting-db-2
restart: always
chatting-server-2:
container_name: chatting-server-2
build: ./spring-chatting-backend-server
ports:
- "8084:8084"
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://chatting-db-2:5434/chat2
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=password
- SPRING_JPA_HIBERNATE_DDL_AUTO=update
- SERVER_PORT=8084
- KAFKA_BOOTSTRAP=kafka1:9092,kafka2:9092,kafka3:9092 # 내부포트
depends_on:
- kafka1
- kafka2
- kafka3
- chatting-db-2
restart: always
# -------- Authentication Server --------
auth-db:
container_name: auth-db
image: postgres:12-alpine
environment:
- POSTGRES_PASSWORD=password
- POSTGRES_USER=postgres
- POSTGRES_DB=auth
expose:
- "5435" # Publishes 5433 to other containers but NOT to host machine
ports:
- "5435:5435"
volumes:
- ./backups:/home/backups
command: -p 5435 -c 'max_connections=200'
auth-server-1:
container_name: auth-server-1
build: ./spring-auth-backend-server
expose:
- "8085"
ports:
- "8085:8085"
environment:
- SERVER_PORT=8085
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_URL=jdbc:postgresql://database-1.cyykxhwims2n.ap-northeast-2.rds.amazonaws.com:5432/postgres?serverTimezone=Asia/Seoul&characterEncoding=UTF-8
- SPRING_DATASOURCE_PASSWORD=mypassword
- SPRING_JPA_HIBERNATE_DDL_AUTO=update
- KAFKA_BOOTSTRAP=kafka1:9092,kafka2:9092,kafka3:9092 # 내부포트
depends_on:
- kafka1
- kafka2
- kafka3
- auth-db
restart: always
# auth-server-2:
# container_name: auth-server-2
# build: ./spring-auth-backend-server
# ports:
# - "8072:8072"
# environment:
# - SERVER_PORT=8072
# - SPRING_DATASOURCE_USERNAME=postgres
# - SPRING_DATASOURCE_URL=jdbc:postgresql://database-1.cyykxhwims2n.ap-northeast-2.rds.amazonaws.com:5432/postgres?serverTimezone=Asia/Seoul&characterEncoding=UTF-8
# - SPRING_DATASOURCE_PASSWORD=mypassword
# - SPRING_JPA_HIBERNATE_DDL_AUTO=update
# - KAFKA_BOOTSTRAP=kafka1:9092,kafka2:9092,kafka3:9092 # 내부포트
# depends_on:
# - auth-db
# restart: always
# -------- kafdrop for visualization --------
kafdrop:
image: obsidiandynamics/kafdrop
restart: "no"
environment:
KAFKA_BROKERCONNECT: "kafka1:9092,kafka2:9092,kafka3:9092"
JVM_OPTS: "-Xms16M -Xmx512M -Xss180K -XX:-TieredCompilation -XX:+UseStringDeduplication -noverify"
ports:
- 9000:9000
depends_on:
- kafka1
- kafka2
- kafka3
# -------- postgres -> kafka source connector --------
kafka-source-connector:
image: debezium/connect:1.9
container_name: postgres-kafka-source-connector
ports:
- 8083:8083
environment:
CONFIG_STORAGE_TOPIC: __pg.source.config.storage
OFFSET_STORAGE_TOPIC: __pg.source.offset.storage
STATUS_STORAGE_TOPIC: __pg.source.status.storage
PLUGIN_PATH: /kafka/connect
BOOTSTRAP_SERVERS: kafka1:9092,kafka2:9092,kafka3:9092
depends_on:
- kafka1
- kafka2
- kafka3
- zookeeper
- chatting-db-1
- chatting-db-2