-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yaml
183 lines (170 loc) · 4.91 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
# Specify the version of the Docker Compose.
version: "3.9"
services:
frontend:
container_name: frontend
build:
context: ./frontend
dockerfile: Dockerfile
environment:
NEXT_PUBLIC_MATCHING_WEBSOCKET_SERVICE_DOMAIN: ${FE_MATCHING_WEBSOCKET_SERVICE_DOMAIN}
NEXT_PUBLIC_COLLAB_SERVICE_DOMAIN: ${FE_COLLAB_SERVICE_DOMAIN}
NEXT_PUBLIC_CHAT_SERVICE_DOMAIN: ${FE_CHAT_SERVICE_DOMAIN}
NEXT_PUBLIC_API_GATEWAY_DOMAIN: ${API_GATEWAY_DOMAIN}
# volumes:
# - ./frontend:/app
ports:
- "3000:3000"
api-gateway:
build:
context: ./backend/api-gateway
dockerfile: Dockerfile
environment:
QUESTION_SERVICE_DOMAIN: ${QUESTION_SERVICE_DOMAIN}
USER_SERVICE_DOMAIN: ${USER_SERVICE_DOMAIN}
COLLAB_SERVICE_DOMAIN: ${COLLAB_SERVICE_DOMAIN}
HISTORY_SERVICE_DOMAIN: ${HISTORY_SERVICE_DOMAIN}
ports:
- "8000:8000"
# volumes:
# - ./backend/api-gateway:/app
question-app:
build:
context: ./backend/question-service
dockerfile: Dockerfile
environment:
MONGODB_URI: ${MONGODB_URI}
MONGODB_NAME: ${MONGODB_NAME}
ports:
- "8001:8001"
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8001/question/health || exit 1"]
interval: 3s
timeout: 3s
retries: 5
start_period: 3s
# volumes:
# - ./backend/question-service:/app
matching-app:
build:
context: ./backend/matching-service
dockerfile: Dockerfile
environment:
KAFKA_BROKER_URI: ${KAFKA_BROKER_URI}
MATCHING_SERVICE_CONSUMER_GROUP_ID: ${MATCHING_SERVICE_CONSUMER_GROUP_ID}
depends_on:
kafka:
condition: service_healthy
ports:
- "8002:8002"
# volumes:
# - ./backend/matching-service:/app
matching-websocket:
build:
context: ./backend/matching-websocket-service
dockerfile: Dockerfile
environment:
KAFKA_BROKER_URI: ${KAFKA_BROKER_URI}
MATCHING_WEBSOCKET_SERVICE_CONSUMER_GROUP_ID: ${MATCHING_WEBSOCKET_SERVICE_CONSUMER_GROUP_ID}
COLLAB_SERVICE_DOMAIN: ${COLLAB_SERVICE_DOMAIN}
REDIS_DOMAIN: ${REDIS_DOMAIN}
depends_on:
kafka:
condition: service_healthy
ports:
- "8008:8008"
# volumes:
# - ./backend/matching-websocket-service:/app
collab-app:
build:
context: ./backend/collab-service
dockerfile: Dockerfile
environment:
QUESTION_SERVICE_DOMAIN: ${QUESTION_SERVICE_DOMAIN}
KAFKA_BROKER_URI: ${KAFKA_BROKER_URI}
COLLAB_SERVICE_CONSUMER_GROUP_ID: ${COLLAB_SERVICE_CONSUMER_GROUP_ID}
depends_on:
question-app:
condition: service_healthy
kafka:
condition: service_healthy
ports:
- "8007:8007"
# volumes:
# - ./backend/collab-service:/app
chat-app:
build:
context: ./backend/chat-service
dockerfile: Dockerfile
environment:
QUESTION_SERVICE_DOMAIN: ${QUESTION_SERVICE_DOMAIN}
ports:
- "8009:8009"
# volumes:
# - ./backend/chat-service:/app
user-app:
build:
context: ./backend/user-service
dockerfile: Dockerfile
environment:
JWT_SECRET: ${JWT_SECRET}
DB_CLOUD_URI: ${DB_CLOUD_URI}
DB_LOCAL_URI: ${DB_LOCAL_URI}
PORT: ${PORT}
ENV: ${ENV}
ports:
- "8003:8003"
# volumes:
# - ./backend/user-service:/app
depends_on:
- user-service-db
user-service-db:
container_name: user-service-db
image: mongo:latest
ports:
- "27017:27017"
healthcheck:
test: ["CMD-SHELL", "pgrep mongod"]
interval: 10s
timeout: 10s
retries: 5
start_period: 40s
command: mongod --quiet --logpath /dev/null
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 8004
ZOOKEEPER_TICK_TIME: 2000
kafka:
image: confluentinc/cp-kafka:latest
hostname: kafka
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:8004
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${KAFKA_BROKER_URI},PLAINTEXT_HOST://localhost:28005
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
healthcheck:
test: ["CMD-SHELL", "nc -z localhost 28005 || exit 1"]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
redis:
container_name: matching-redis
image: redis:latest
# No need to expose the port as it is only used internally (6379)
history-app:
build:
context: ./backend/history-service
dockerfile: Dockerfile
environment:
MONGODB_URI: ${MONGODB_URI}
MONGODB_NAME: ${MONGODB_NAME}
PORT: ${HISTORY_SERVICE_PORT}
HISTORY_SERVICE_MONGODB_URI: ${HISTORY_SERVICE_MONGODB_URI}
ports:
- ${HISTORY_SERVICE_PORT}:${HISTORY_SERVICE_PORT}