-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.prod.yml
187 lines (178 loc) · 5.19 KB
/
docker-compose.prod.yml
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
version: "3"
services:
frontend:
build:
context: ./peerprep_fe
dockerfile: Dockerfile.prod
environment:
- CHOKIDAR_USEPOLLING=false
- NEXT_POLLING_INTERVAL=1000
- FRONTEND_PORT=3000
- API_GATEWAY_PORT=5003
- GATEWAY_SERVICE_ROUTE=gateway-service
ports:
- "3000:3000"
depends_on:
- gateway-service
gateway-service:
build:
context: ./gateway_service
dockerfile: Dockerfile.prod
environment:
- MONGODB_URI=${MONGODB_URI}
- KAFKA_BROKER_PORT=9092
- KAFKA_CONTROLLER_PORT=9093
- JWT_SECRET=${JWT_SECRET}
- GATEWAY_SERVICE_ROUTE=gateway-service
- API_GATEWAY_PORT=5003
- KAFKA_BROKER_ROUTE=kafka-service
- KAFKA_CONTROLLER_ROUTE=kafka-service
- MATCHING_SERVICE_ROUTE=matching-service
- MATCHING_SERVICE_PORT=5004
- COLLAB_SERVICE_ROUTE=collab-service
- COLLAB_SERVICE_PORT=5005
- USER_SERVICE_ROUTE=user-service
- USER_SERVICE_PORT=5001
- QUESTION_SERVICE_ROUTE=question-service
- QUESTION_SERVICE_PORT=5002
- REDIS_ROUTE=redis://redis
- REDIS_PORT=6379
ports:
- "5003:5003"
depends_on:
- kafka-service
- kafka-init
user-service:
build:
context: ./users_service
dockerfile: Dockerfile.prod
environment:
- MONGODB_URI=${MONGODB_URI}
- USER_SERVICE_PORT=5001
- JWT_SECRET=${JWT_SECRET}
ports:
- "5001:5001"
depends_on:
- matching-service
question-service:
build:
context: ./question_service
dockerfile: Dockerfile.prod
environment:
- MONGODB_URI=${MONGODB_URI}
- QUESTION_SERVICE_PORT=5002
ports:
- "5002:5002"
collab-service:
build:
context: ./collab_service
dockerfile: Dockerfile.prod
environment:
- COLLAB_SERVICE_PORT=5005
- MONGODB_URI=${MONGODB_URI}
- MATCHING_SERVICE_PORT=5004
- API_GATEWAY_PORT=5003
- USER_SERVICE_PORT=5001
- QUESTION_SERVICE_PORT=5002
- KAFKA_BROKER_PORT=9092
- KAFKA_CONTROLLER_PORT=9093
- JWT_SECRET=${JWT_SECRET}
- GATEWAY_SERVICE_ROUTE=gateway-service
- USER_SERVICE_ROUTE=user-service
- QUESTION_SERVICE_ROUTE=question-service
- KAFKA_BROKER_ROUTE=kafka-service
- KAFKA_CONTROLLER_ROUTE=kafka-service
ports:
- "5005:5005"
depends_on:
- kafka-service
- kafka-init
matching-service:
build:
context: ./matching_service
dockerfile: Dockerfile.prod
environment:
- MONGODB_URI=${MONGODB_URI}
- MATCHING_SERVICE_PORT=5004
- API_GATEWAY_PORT=5003
- USER_SERVICE_PORT=5001
- QUESTION_SERVICE_PORT=5002
- KAFKA_BROKER_PORT=9092
- KAFKA_CONTROLLER_PORT=9093
- JWT_SECRET=${JWT_SECRET}
- GATEWAY_SERVICE_ROUTE=gateway-service
- USER_SERVICE_ROUTE=user-service
- QUESTION_SERVICE_ROUTE=question-service
- KAFKA_BROKER_ROUTE=kafka-service
- KAFKA_CONTROLLER_ROUTE=kafka-service
- REDIS_ROUTE=redis://redis
- REDIS_PORT=6379
ports:
- "5004:5004"
depends_on:
- kafka-service
- kafka-init
kafka-service:
image: apache/kafka:latest
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker, controller
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-service:9092
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka-service:9093
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_NUM_PARTITIONS: ${KAFKA_NUM_PARTITIONS}
ports:
- "9092:9092"
healthcheck:
test: ["CMD", "nc", "-z", "kafka-service", "9092"]
interval: 30s
timeout: 20s
retries: 3
start_period: 30s
kafka-init:
image: apache/kafka:latest
depends_on:
- kafka-service
command: >
bash -c '
sleep 10 &&
/opt/kafka/bin/kafka-topics.sh \
--create \
--if-not-exists \
--bootstrap-server kafka-service:9092 \
--topic collaboration-events \
--partitions ${KAFKA_NUM_PARTITIONS:-1} \
--replication-factor 1 &&
/opt/kafka/bin/kafka-topics.sh \
--create \
--if-not-exists \
--bootstrap-server kafka-service:9092 \
--topic gateway-events \
--partitions ${KAFKA_NUM_PARTITIONS:-1} \
--replication-factor 1 &&
/opt/kafka/bin/kafka-topics.sh \
--create \
--if-not-exists \
--bootstrap-server kafka-service:9092 \
--topic matching-events \
--partitions ${KAFKA_NUM_PARTITIONS:-1} \
--replication-factor 1
'
environment:
KAFKA_BROKER_PORT: 9092
KAFKA_NUM_PARTITIONS: ${KAFKA_NUM_PARTITIONS:-1}
redis:
image: redis:latest
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3