-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
334 lines (316 loc) · 10.5 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
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# Copyright (c) 2024 smartSense Consulting Solutions Pvt. Ltd.
# Docker Compose configuration for running Chat application using EDC
# This setup includes PostgreSQL, EDC control planes, data planes, backend application and UI for sender and receiver,
# HashiCorp Vault and wallet stub service for operator company(Trusted issuer)
version: "3.8"
services:
# PostgreSQL database service
postgres:
image: postgres:latest
container_name: postgres_multi_db
environment:
# Database credentials and configuration
POSTGRES_USER: root
POSTGRES_PASSWORD: root
# List of databases to be created. It creates database for both EDCs and backend applications
POSTGRES_MULTIPLE_DATABASES: smartsense-edc,catena-x-edc,smartsense-backend,catena-x-backend
volumes:
- ./postgres_data:/var/lib/postgresql/data
# Script to create multiple databases
- ./deployment/env/postgres/create_database.sh:/docker-entrypoint-initdb.d/create_databases.sh
ports:
- "5434:5432"
restart: no
networks:
- edc-network
# Sender Control Plane service
smartsense-controlplane:
image: tractusx/edc-controlplane-postgresql-hashicorp-vault:0.7.7
container_name: smartsense-controlplane
ports:
# Expose Control Plane ports
- "8191:8191"
- "8192:8192"
- "8194:8194"
- "8195:8195"
volumes:
# Mount configuration file
- ./deployment/env/smartsense/edc.properties:/app/configuration.properties
environment:
# Specify the configuration file location
- CONFIGURATION_PROPERTIES_FILE=/app/configuration.properties
depends_on:
postgres:
condition: service_started
smartsense-edc-migration:
condition: service_completed_successfully
# wallet-stub:
# condition: service_healthy
networks:
- edc-network
healthcheck:
test: wget --no-verbose --tries=1 --spider http://smartsense-controlplane:8191/api/check/health || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 30s
# Sender Data Plane service
smartsense-dataplane:
image: tractusx/edc-dataplane-hashicorp-vault:0.7.7
container_name: smartsense-dataplane
ports:
# Expose Data Plane port
- "8196:8193"
volumes:
# Mount configuration file
- ./deployment/env/smartsense/dataplane.properties:/app/configuration.properties
environment:
# Specify the configuration file location
- CONFIGURATION_PROPERTIES_FILE=/app/configuration.properties
depends_on:
postgres:
condition: service_started
smartsense-edc-migration:
condition: service_completed_successfully
# wallet-stub:
# condition: service_healthy
smartsense-controlplane:
condition: service_healthy
networks:
- edc-network
# Receiver Control Plane service
catena-x-controlplane:
image: tractusx/edc-controlplane-postgresql-hashicorp-vault:0.7.7
container_name: catena-x-controlplane
ports:
# Expose Control Plane ports
- "9191:9191"
- "9192:9192"
- "9194:9194"
- "9195:9195"
volumes:
# Mount configuration file
- ./deployment/env/catena-x/edc.properties:/app/configuration.properties
environment:
# Specify the configuration file location
- CONFIGURATION_PROPERTIES_FILE=/app/configuration.properties
depends_on:
postgres:
condition: service_started
catena-x-edc-migration:
condition: service_completed_successfully
# wallet-stub:
# condition: service_healthy
networks:
- edc-network
healthcheck:
test: wget --no-verbose --tries=1 --spider http://catena-x-controlplane:9191/api/check/health || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 30s
# Receiver Data Plane service
catena-x-dataplane:
image: tractusx/edc-dataplane-hashicorp-vault:0.7.7
container_name: catena-x-dataplane
ports:
# Expose Data Plane port
- "9196:8196"
volumes:
# Mount configuration file
- ./deployment/env/catena-x/dataplane.properties:/app/configuration.properties
environment:
# Specify the configuration file location
- CONFIGURATION_PROPERTIES_FILE=/app/configuration.properties
depends_on:
postgres:
condition: service_started
catena-x-edc-migration:
condition: service_completed_successfully
# wallet-stub:
# condition: service_started
catena-x-controlplane:
condition: service_healthy
networks:
- edc-network
# HashiCorp Vault service
vault:
container_name: vault
image: vault:1.13.3
ports:
# Expose Vault API port
- "8200:8200"
environment:
# Vault configuration
VAULT_DEV_ROOT_TOKEN_ID: "root-token"
VAULT_ADDR: "http://127.0.0.1:8200"
cap_add:
- IPC_LOCK
networks:
- edc-network
# Service to prepopulate Vault with initial data
vault-prepopulate:
image: alpine/curl
container_name: vault-prepopulate
depends_on:
- vault
volumes:
# Mount script to prepopulate Vault
- ./deployment/env/vault/prepopulate_vault.sh:/usr/local/bin/prepopulate_vault.sh
command: [ "sh", "-c", "/usr/local/bin/prepopulate_vault.sh" ]
networks:
- edc-network
# We deploy this service at https://wallet.learn.smartsenselabs.com/ and use it from there.
# If anyone wants to deploy this service to their local environment,
# then please use the ngrok service and update the host with the ngrok urls.
# Also, uncomment depends on the controlplane and dataplane services.
# Wallet stub service
# wallet-stub:
# image: tractusx/ssi-dim-wallet-stub:0.0.4
# container_name: wallet-stub
# environment:
# # Wallet configuration
# - SERVER_PORT=80
# - BASE_WALLET_BPN=BPNL0000TRACTUSX
# - DID_HOST=wallet.learn.smartsenselabs.com
# - STUB_URL=https://wallet.learn.smartsenselabs.com
# - SEED_WALLETS_BPN=BPNL0000TRACTUSX,BPNL00SMARTSENSE,BPNL00000CATENAX
# ports:
# # Expose wallet service port
# - "80:80"
# networks:
# - edc-network
# healthcheck:
# # Health check configuration
# test: curl --fail http://wallet-stub/BPNL0000TRACTUSX/did.json || exit 1
# interval: 40s
# timeout: 30s
# retries: 3
# start_period: 30s
smartsense-backend:
build:
dockerfile: ./edc-chat-app-backend/Dockerfile
container_name: smartsense-backend
environment:
- APP_PORT=8080
- BPN=BPNL00SMARTSENSE
- DB_HOST=postgres
- CHAT_DB=smartsense-backend
- DB_USER=root
- DB_PASS=root
- ASSET_ID=edc-chat-app
- EDC_URL=http://smartsense-controlplane:8192
- APP_HOST_URL=http://smartsense-backend:8080
ports:
- "8182:8080"
depends_on:
smartsense-controlplane:
condition: service_healthy
networks:
- edc-network
healthcheck:
test: wget --no-verbose --tries=1 --spider http://smartsense-backend:8080/actuator/health || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 30s
catena-x-backend:
build:
dockerfile: ./edc-chat-app-backend/Dockerfile
container_name: catena-x-backend
environment:
- APP_PORT=8080
- BPN=BPNL00000CATENAX
- DB_HOST=postgres
- CHAT_DB=catena-x-backend
- DB_USER=root
- DB_PASS=root
- ASSET_ID=edc-chat-app
- EDC_URL=http://catena-x-controlplane:9192
- APP_HOST_URL=http://catena-x-backend:8080
depends_on:
catena-x-controlplane:
condition: service_healthy
ports:
- "8181:8080"
networks:
- edc-network
healthcheck:
test: wget --no-verbose --tries=1 --spider http://catena-x-backend:8080/actuator/health || exit 1
interval: 40s
timeout: 30s
retries: 3
start_period: 30s
# Service to register a business partner in the backend application to avoid manual data creation.
# This will register smartSense's EDC into the Catena-X backend and vice versa.
# This could be automated using a central service, i.e., the EDC Discovery Service.
bp-registration:
image: alpine/curl
container_name: bp-registration
volumes:
- ./deployment/env/bp_registration/bp_registration.sh:/usr/local/bin/bp_registration.sh
command: [ "sh", "+x", "/usr/local/bin/bp_registration.sh" ]
depends_on:
smartsense-backend:
condition: service_healthy
catena-x-backend:
condition: service_healthy
networks:
- edc-network
smartsense-ui:
build:
dockerfile: edc-chat-app-ui/Dockerfile-smartsense
container_name: smartsense-ui
depends_on:
smartsense-backend:
condition: service_healthy
bp-registration:
condition: service_completed_successfully
ports:
- "8180:80"
networks:
- edc-network
catena-x-ui:
build:
dockerfile: edc-chat-app-ui/Dockerfile-catena-x
container_name: catena-x-ui
depends_on:
catena-x-backend:
condition: service_healthy
bp-registration:
condition: service_completed_successfully
ports:
- "8280:80"
networks:
- edc-network
# This script creates missing tables in the EDC database.
# Ideally, migrations should handle this, but due to an issue in EDC 0.7.7, some tables were not created.
# To save time, we added this script as a precaution; it will only create tables if they don't exist.
smartsense-edc-migration:
image: flyway/flyway:latest
container_name: smartsense-edc-migration
command: -url=jdbc:postgresql://postgres:5432/smartsense-edc -schemas=public -user=root -password=root -connectRetries=10 migrate
volumes:
- ./deployment/env/postgres/migration.sql:/flyway/sql/V0_0_1_0__create_tables.sql
depends_on:
postgres:
condition: service_started
networks:
- edc-network
catena-x-edc-migration:
image: flyway/flyway:latest
container_name: catena-x-edc-migration
command: -url=jdbc:postgresql://postgres:5432/catena-x-edc -schemas=public -user=root -password=root -connectRetries=10 migrate
volumes:
- ./deployment/env/postgres/migration.sql:/flyway/sql/V0_0_1_0__create_tables.sql
depends_on:
postgres:
condition: service_started
networks:
- edc-network
# Define custom network for inter-service communication
networks:
edc-network:
# Define named volume for persistent PostgreSQL data
volumes:
postgres_data: