-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
265 lines (240 loc) · 7.67 KB
/
docker-compose.yml
File metadata and controls
265 lines (240 loc) · 7.67 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
name: devicehub
services:
postgres_auth:
image: postgres:16
environment:
POSTGRES_DB: ems_auth
POSTGRES_USER: ${PG_USER:-postgres}
POSTGRES_PASSWORD: ${PG_PASSWORD:-postgres}
volumes:
- pgdata_auth:/var/lib/postgresql/data
ports:
- "54321:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 3s
retries: 10
networks: [devicehub-network]
postgres_user:
image: postgres:16
environment:
POSTGRES_DB: ems_user
POSTGRES_USER: ${PG_USER:-postgres}
POSTGRES_PASSWORD: ${PG_PASSWORD:-postgres}
volumes:
- pgdata_user:/var/lib/postgresql/data
ports:
- "54322:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 3s
retries: 10
networks: [devicehub-network]
postgres_device:
image: postgres:16
environment:
POSTGRES_DB: ems_device
POSTGRES_USER: ${PG_USER:-postgres}
POSTGRES_PASSWORD: ${PG_PASSWORD:-postgres}
volumes:
- pgdata_device:/var/lib/postgresql/data
ports:
- "54323:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 3s
retries: 10
networks: [devicehub-network]
postgres_monitoring:
image: postgres:16
environment:
POSTGRES_DB: ems_monitoring
POSTGRES_USER: ${PG_USER:-postgres}
POSTGRES_PASSWORD: ${PG_PASSWORD:-postgres}
volumes:
- pgdata_monitoring:/var/lib/postgresql/data
ports:
- "54324:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 3s
retries: 10
networks: [devicehub-network]
postgres_communication:
image: postgres:16
environment:
POSTGRES_DB: ems_communication
POSTGRES_USER: ${PG_USER:-postgres}
POSTGRES_PASSWORD: ${PG_PASSWORD:-postgres}
volumes:
- pgdata_communication:/var/lib/postgresql/data
ports:
- "54325:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" ]
interval: 5s
timeout: 3s
retries: 10
networks: [ devicehub-network ]
auth-service:
build: ./auth-service
environment:
SPRING_PROFILES_ACTIVE: docker
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres_auth:5432/ems_auth
SPRING_DATASOURCE_USERNAME: ${PG_USER:-postgres}
SPRING_DATASOURCE_PASSWORD: ${PG_PASSWORD:-postgres}
SPRING_JPA_HIBERNATE_DDL_AUTO: update
SPRING_KAFKA_BOOTSTRAP_SERVERS: kafka:9092
SECURITY_JWT_SECRET_KEY: ${SECURITY_JWT_SECRET_KEY}
SECURITY_JWT_EXPIRATION_TIME: ${SECURITY_JWT_EXPIRATION_TIME:-3600000}
SERVICES_USER_URL: http://user-service:8082
depends_on:
postgres_auth:
condition: service_healthy
ports:
- "8081:8081"
networks: [ devicehub-network ]
user-service:
build: ./user-service
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres_user:5432/ems_user
SPRING_DATASOURCE_USERNAME: ${PG_USER:-postgres}
SPRING_DATASOURCE_PASSWORD: ${PG_PASSWORD:-postgres}
SPRING_JPA_HIBERNATE_DDL_AUTO: update
depends_on:
postgres_user:
condition: service_healthy
ports:
- "8082:8082"
networks: [devicehub-network]
device-service:
build: ./device-service
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres_device:5432/ems_device
SPRING_DATASOURCE_USERNAME: ${PG_USER:-postgres}
SPRING_DATASOURCE_PASSWORD: ${PG_PASSWORD:-postgres}
SPRING_JPA_HIBERNATE_DDL_AUTO: update
SECURITY_JWT_SECRET_KEY: ${SECURITY_JWT_SECRET_KEY}
SECURITY_JWT_EXPIRATION_TIME: ${SECURITY_JWT_EXPIRATION_TIME:-3600000}
depends_on:
postgres_device:
condition: service_healthy
ports:
- "8083:8083"
networks: [devicehub-network]
gateway-service:
build: ./gateway-service
environment:
SPRING_PROFILES_ACTIVE: docker
SECURITY_JWT_SECRET_KEY: ${SECURITY_JWT_SECRET_KEY}
INTERNAL_SECRET: ${INTERNAL_SECRET}
AUTH_URI: http://auth-service:8081
USER_URI: http://user-service:8082
DEVICE_URI: http://device-service:8083
MONITORING_URI: http://monitoring-service:8084
COMMUNICATION_URI: http://communication-service:8085
ports:
- "8080:8080"
depends_on:
- auth-service
- user-service
- device-service
- communication-service
networks: [devicehub-network]
monitoring-service:
build: ./monitoring-service
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres_monitoring:5432/ems_monitoring
SPRING_DATASOURCE_USERNAME: ${PG_USER:-postgres}
SPRING_DATASOURCE_PASSWORD: ${PG_PASSWORD:-postgres}
SPRING_JPA_HIBERNATE_DDL_AUTO: update
SPRING_KAFKA_BOOTSTRAP_SERVERS: "kafka:9092"
SPRING_KAFKA_PRODUCER_BOOTSTRAP_SERVERS: "kafka:9092"
SPRING_KAFKA_CONSUMER_BOOTSTRAP_SERVERS: "kafka:9092"
depends_on:
postgres_monitoring:
condition: service_healthy
kafka:
condition: service_healthy
ports:
- "8084:8084"
networks: [devicehub-network]
communication-service:
build: ./communication-service
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres_communication:5432/ems_communication
SPRING_DATASOURCE_USERNAME: ${PG_USER:-postgres}
SPRING_DATASOURCE_PASSWORD: ${PG_PASSWORD:-postgres}
SPRING_JPA_HIBERNATE_DDL_AUTO: update
SPRING_KAFKA_BOOTSTRAP_SERVERS: "kafka:9092"
SECURITY_JWT_SECRET_KEY: ${SECURITY_JWT_SECRET_KEY}
GEMINI_API_KEY: ${GEMINI_API_KEY}
depends_on:
postgres_communication:
condition: service_healthy
kafka:
condition: service_healthy
ports:
- "8085:8085"
networks: [ devicehub-network ]
frontend:
build: ./frontend
ports:
- "4200:80"
depends_on:
- gateway-service
networks: [devicehub-network]
kafka-ui:
image: provectuslabs/kafka-ui:latest
container_name: kafka-ui
ports:
- "8090:8080"
environment:
KAFKA_CLUSTERS_0_NAME: local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092
KAFKA_CLUSTERS_0_ZOOKEEPER: ""
networks:
- devicehub-network
kafka:
user: root
image: apache/kafka:3.9.1
container_name: kafka
ports:
- "29092:29092"
- "9092:9092"
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: "broker,controller"
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka:9093"
KAFKA_LISTENERS: "PLAINTEXT_INTERNAL://0.0.0.0:9092,PLAINTEXT_EXTERNAL://0.0.0.0:29092,CONTROLLER://0.0.0.0:9093"
KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT_INTERNAL://kafka:9092,PLAINTEXT_EXTERNAL://localhost:29092"
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "PLAINTEXT_INTERNAL:PLAINTEXT,PLAINTEXT_EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT"
KAFKA_INTER_BROKER_LISTENER_NAME: "PLAINTEXT_INTERNAL"
KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
CLUSTER_ID: "5L6g3nShT-eMCtK--X86sw"
KAFKA_LOG_DIRS: "/tmp/kraft-combined-logs"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
healthcheck:
test: [ "CMD", "bash", "-c", "echo > /dev/tcp/localhost/9092" ]
interval: 5s
timeout: 3s
retries: 10
volumes:
- kafka_data:/tmp/kraft-combined-logs
networks: [devicehub-network]
networks:
devicehub-network:
volumes:
pgdata_auth:
pgdata_user:
pgdata_device:
pgdata_monitoring:
pgdata_communication:
kafka_data: