This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
293 lines (258 loc) · 9.43 KB
/
docker-compose.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
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
version: "3"
services:
router:
image: nginx
depends_on:
- api-doc
- service-recommender-api
- service-recommender-flyway
- profile-management-api
- demo-ui
- digiturva-chat
- suomifi-chat
- dvvfi-chat
- ohjepankki
ports:
- 8080:8080
volumes:
- $PWD/docker-compose-router-nginx.conf:/etc/nginx/nginx.conf:ro
api-doc:
build:
context: .
dockerfile: api_doc/api_doc.Dockerfile
service-recommender-api:
build:
context: .
dockerfile: recommender_api/api.dev.Dockerfile
# by default serve the app through flask dev server
command: ["-m", "recommender_api.debug_main"]
# uncomment to serve the app through gunicorn
# command: [ "/app/recommender_api/start_gunicorn.py", "debug_main:run(True)" ]
environment:
ENVIRONMENT: localcluster
GUNICORN_CMD_ARGS: "--config /app/recommender_api/gunicorn_conf.py"
AWS_REGION: "${AWS_REGION-}"
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID-}"
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY-}"
AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN-}"
AWS_SECURITY_TOKEN: "${AWS_SECURITY_TOKEN-}"
depends_on:
- profile-management-api
volumes:
- $PWD/recommender_api/fasttext:/app/recommender_api/fasttext:ro
service-recommender-db:
image: postgres:13
environment:
POSTGRES_DB: service_recommender
POSTGRES_PASSWORD: dummy
POSTGRES_USER: service_recommender_test
ports:
- "${SERVICE_RECOMMENDER_POSTGRES_PORT-5432}:5432" # for connecting with host clients
service-recommender-flyway:
image: flyway/flyway:8.4.3
depends_on:
- service-recommender-db
environment:
FLYWAY_URL: "jdbc:postgresql://service-recommender-db:5432/service_recommender"
FLYWAY_USER: service_recommender_test
FLYWAY_PASSWORD: dummy
FLYWAY_LOCATIONS: "filesystem:/flyway/sql, filesystem:/test_data"
volumes:
- $PWD/recommender_api/migrations/sql:/flyway/sql
- $PWD/recommender_api/tests/test_data:/test_data # also map test data directory so test data gets applied
command: migrate
profile-management-api:
build:
context: .
dockerfile: profile_management/profile.api.Dockerfile_dev
environment:
ENVIRONMENT: localcluster
PROFILE_MANAGEMENT_COOKIE_PASSWORD: atleast32charslongdummycookiepassword
depends_on:
- profile-management-flyway
volumes:
- ./profile_management/api:/builder/api
- /builder/node_modules
profile-management-db:
image: postgres:13
ports:
- "${PROFILE_MANAGEMENT_POSTGRES_PORT-7001}:5432" # for connecting with host clients
environment:
POSTGRES_DB: "${PROFILE_MANAGEMENT_POSTGRES_DB-profile_management}"
POSTGRES_PASSWORD: "${PROFILE_MANAGEMENT_POSTGRES_PASSWORD-admin}"
profile-management-flyway:
image: flyway/flyway:8.4.3
depends_on:
- profile-management-db
environment:
FLYWAY_URL: "jdbc:postgresql://profile-management-db:5432/${PROFILE_MANAGEMENT_POSTGRES_DB-profile_management}"
FLYWAY_USER: "postgres"
FLYWAY_PASSWORD: "${PROFILE_MANAGEMENT_POSTGRES_PASSWORD-admin}"
FLYWAY_LOCATIONS: "filesystem:/flyway/sql, filesystem:/flyway/test_sql"
FLYWAY_PLACEHOLDERS_BASEURL: "http://localhost:8080"
FLYWAY_PLACEHOLDERS_LOADBALANCER: "http://router:8080"
volumes:
- $PWD/profile_management/api/migrations/sql:/flyway/sql
- $PWD/profile_management/api/migrations/test_sql:/flyway/test_sql # add test data
command: migrate
demo-ui:
build:
context: .
dockerfile: demo_ui/ui.dev.Dockerfile
environment:
ENVIRONMENT: localcluster
ports:
- 1235:1235
volumes:
- ./demo_ui:/ui
- /ui/node_modules
- /ui/build
- /ui/.parcel-cache
- /ui/server/node_modules
- /ui/server/dist
ohjepankki:
build:
context: .
dockerfile: document_assistant/ohjepankki/ohjepankki.dev.Dockerfile
environment:
ENVIRONMENT: localcluster
digiturva-chat:
build:
context: .
dockerfile: document_assistant/digiturva.dev.Dockerfile
environment:
ENVIRONMENT: localcluster
# OpenAI api key can be set explicitly in this environment variable or
# docker compose can be run with aws-vault and the api key is fetched from secrets manager.
OPENAI_API_KEY: "${OPENAI_API_KEY-}"
APP_BASE_PATH: "/digiturva-chat"
AWS_REGION: "${AWS_REGION-}"
AWS_DEFAULT_REGION: "${AWS_DEFAULT_REGION-}"
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID-}"
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY-}"
AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN-}"
AWS_SECURITY_TOKEN: "${AWS_SECURITY_TOKEN-}"
LANGCHAIN_ENDPOINT: "http://langchain-backend:8000"
suomifi-chat:
build:
context: .
dockerfile: document_assistant/suomifi.dev.Dockerfile
environment:
ENVIRONMENT: localcluster
# OpenAI api key can be set explicitly in this environment variable or
# docker compose can be run with aws-vault and the api key is fetched from secrets manager.
OPENAI_API_KEY: "${OPENAI_API_KEY-}"
APP_BASE_PATH: "/suomifi-chat"
AWS_REGION: "${AWS_REGION-}"
AWS_DEFAULT_REGION: "${AWS_DEFAULT_REGION-}"
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID-}"
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY-}"
AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN-}"
AWS_SECURITY_TOKEN: "${AWS_SECURITY_TOKEN-}"
LANGCHAIN_ENDPOINT: "http://langchain-backend-suomifi:8000"
dvvfi-chat:
build:
context: .
dockerfile: document_assistant/dvvfi.dev.Dockerfile
environment:
ENVIRONMENT: localcluster
# OpenAI api key can be set explicitly in this environment variable or
# docker compose can be run with aws-vault and the api key is fetched from secrets manager.
OPENAI_API_KEY: "${OPENAI_API_KEY-}"
APP_BASE_PATH: "/dvvfi-chat"
AWS_REGION: "${AWS_REGION-}"
AWS_DEFAULT_REGION: "${AWS_DEFAULT_REGION-}"
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID-}"
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY-}"
AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN-}"
AWS_SECURITY_TOKEN: "${AWS_SECURITY_TOKEN-}"
LANGCHAIN_ENDPOINT: "http://langchain-backend-dvvfi:8000"
langchain-frontend:
image: notlangchain/langchainplus-frontend:latest
ports:
- 4173:4173
environment:
- BACKEND_URL=http://langchain-backend:8000
- PUBLIC_BASE_URL=http://localhost:8000
- PUBLIC_DEV_MODE=true
depends_on:
- langchain-backend
langchain-backend:
image: notlangchain/langchainplus:latest
environment:
- PORT=8000
- LANGCHAIN_ENV=local
ports:
- 8000:8000
depends_on:
- langchain-db
langchain-db:
image: postgres:14.1
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=postgres
- POSTGRES_DB=postgres
expose:
- 5432
####
# load-ptv-data profile
####
# This migration removes all data rows from the local recommender database, but leaves the table schema intact.
# Currently used by the ptv-data-loader service to delete the test-data from the db before loading in the PTV data.
service-recommender-flyway-clean:
profiles:
- "load-ptv-data"
- "load-ptv-data-debug"
image: flyway/flyway:8.4.3
environment:
FLYWAY_URL: "jdbc:postgresql://service-recommender-db:5432/service_recommender"
FLYWAY_USER: service_recommender_test
FLYWAY_PASSWORD: dummy
FLYWAY_LOCATIONS: "filesystem:/migrations"
volumes:
- $PWD/recommender_api/tests/migrations/:/migrations
depends_on:
- service-recommender-db
command: migrate
ptv-data-loader:
profiles:
- "load-ptv-data"
build:
context: .
dockerfile: recommender_api/api.dev.Dockerfile
command: ["-m", "recommender_api.ptv_data_loader.data_loader"]
environment:
ENVIRONMENT: localcluster
AWS_REGION: "${AWS_REGION-}"
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID-}"
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY-}"
AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN-}"
AWS_SECURITY_TOKEN: "${AWS_SECURITY_TOKEN-}"
DATA_LOADER_MODE: "${DATA_LOADER_MODE-}"
AAI_RECOMMENDER_CONFIG_FILE: "recommender_api/ptv_data_loader/config.yml"
depends_on:
- service-recommender-api
- service-recommender-flyway-clean
# This service can be used to load the PTV data from dev environment S3 dump to the service-recommender-db running
# in docker compose. This is significantly faster than loading the data directly from PTV.
# As it loads data from S3, it requires AWS credentials. Simplest way is to run it with:
# aws-vault exec dvv-suomiai-dev -- docker compose --profile load-ptv-data-s3 up ptv-data-loader-s3
ptv-data-loader-s3:
profiles:
- "load-ptv-data-s3"
build:
context: .
dockerfile: recommender_api/api.dev.Dockerfile
command: ["-m", "recommender_api.ptv_data_loader.data_loader_s3"]
environment:
ENVIRONMENT: localcluster
AWS_REGION: "${AWS_REGION-}"
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID-}"
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY-}"
AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN-}"
AWS_SECURITY_TOKEN: "${AWS_SECURITY_TOKEN-}"
DATA_LOADER_MODE: "full-run"
AAI_RECOMMENDER_CONFIG_FILE: "recommender_api/ptv_data_loader/config.yml"
depends_on:
- service-recommender-api
# - service-recommender-flyway-clean