-
Notifications
You must be signed in to change notification settings - Fork 23
/
dc-dev.yaml
345 lines (311 loc) · 11.8 KB
/
dc-dev.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
335
336
337
338
339
340
341
342
343
344
345
# Docker Compose (for Development)
version: '3.7'
services:
redis-dev:
image: redis:7.2
deploy:
restart_policy:
condition: on-failure
# delay is time between restart attempts
delay: 10s
max_attempts: 4
window: 120s
replicas: 1
hostname: redis-host-dev
networks:
bridge:
aliases:
- redis-host-dev
# No need to limit resources for now
# deploy:
# resources:
# limits:
# cpus: '0.50'
# memory: 128M
# reservations:
# cpus: '0.25'
# memory: 64M
ports:
- "${REDIS_PORT}:${REDIS_PORT}"
# Saves to disk every 20 seconds (if 1 or more writes done)
# command: redis-server --save 20 1 --loglevel warning --requirepass ${REDIS_PASSWORD}
# mem arg: --maxmemory 50M
command: redis-server --maxmemory-policy allkeys-lru --port ${REDIS_PORT} --save 20 1 --loglevel warning --requirepass ${REDIS_PASSWORD}
environment:
REDIS_HOST: "${REDIS_HOST}"
REDIS_PORT: "${REDIS_PORT}"
REDIS_PASSWORD: ${REDIS_PASSWORD}
# We need to embed the AppVersion into the Redis Records before it makes sense
# to cache them across restarts.
# volumes:
# - ${QUANTA_BASE}/redis:/data
mongo-dev:
# Warning: supposedly starting at Mongo 6.0 this would be the way to do healthcheck
# test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
# --or--
# test: ["CMD","mongosh", "--eval", "db.adminCommand('ping')"]
image: mongo:6.0.8
deploy:
restart_policy:
condition: on-failure
# delay is time between restart attempts
delay: 10s
max_attempts: 4
window: 120s
replicas: 1
hostname: mongo-host-dev
networks:
bridge:
aliases:
- mongo-host-dev
volumes:
- '${MONGO_DATA}:/data/db'
- '${MONGOD_CONF}:/etc/mongod.conf'
- '${MONGO_BACKUP}:/backup'
- '${MONGO_KEY}:/data/mongo-key:ro'
- '${INIT_REPLICA}:/init/init-replica.sh:ro'
command: [
"--config", "/etc/mongod.conf",
"--setParameter", "diagnosticDataCollectionEnabled=false",
"--profile", "0",
"--slowms", "-1"
]
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: ${mongoPassword}
# NOTE: I'm keeping this disabled just because it might interfere with the init-replica.sh script
# and I haven't had time to be sure that it never will.
# healthcheck:
# test: ["CMD", "mongosh",
# "-u", "root",
# "-p", "${mongoPassword}",
# "--port", "${MONGO_PORT}",
# "--host", "${MONGO_HOST}",
# "--quiet", "--eval", "rs.status()"]
# interval: 10s
# timeout: 5s
# retries: 30
pgdb-dev:
image: postgres:16
deploy:
# Don't want a restart policy for DEV!
# restart_policy:
# condition: on-failure
# # delay is time between restart attempts
# delay: 10s
# max_attempts: 4
# window: 120s
replicas: 1
hostname: pgdb-host-dev
networks:
bridge:
aliases:
- pgdb-host-dev
environment:
- POSTGRES_USER=quanta-pg
- POSTGRES_PASSWORD=${pgPassword}
logging:
options:
max-size: 10m
max-file: "3"
# expose to host machine for management.
ports:
- '${POSTGRES_PORT}:5432'
volumes:
- '${POSTGRES_DATA}:/var/lib/postgresql/data'
pgadmin4:
image: dpage/pgadmin4:latest
depends_on:
- pgdb-dev
environment:
PGADMIN_DEFAULT_EMAIL: ${pgAdminEmail}
PGADMIN_DEFAULT_PASSWORD: ${pgAdminPassword}
ports:
- '${PGADMIN_PORT}:80'
networks:
- bridge
volumes:
- '${PGADMIN_DATA}:/var/lib/pgadmin'
quanta-dev:
image: ${DOCKER_IMAGE}
depends_on:
- redis-dev
- mongo-dev
- pgdb-dev
- qai-dev
build:
context: ${PRJROOT}
args:
PORT: "${PORT}"
PORT_DEBUG: "${PORT_DEBUG}"
XMS: "${XMS}"
XMX: "${XMX}"
dockerfile: ./dockerfile-dev
# This is important for DEV environment because we have a script
# we run to deploy new Java Classes, and it works by scaling down
# to zero replicas, doing a build, and then scaling back up, so
# we don't want docker swarm on it's own restarting it during all that.
# restart: "no"
# =================================================================
# DEPLOY REPLICAS
# Enable either one of the two deploy sections below
# =================================================================
# deploy for normal development with single replia
# NOTE: If you don't need Zero Downtime deploy you can just set multiple replias here
deploy:
restart_policy:
condition: on-failure
# delay is time between restart attempts
delay: 10s
max_attempts: 4
window: 120s
replicas: 1
# =================================================================
# This config does a Zero-Downtime Redeploy!!
# deploy:
# replicas: 2
# update_config:
# parallelism: 1
# order: start-first
# failure_action: rollback
# delay: 10s
# rollback_config:
# parallelism: 0
# order: stop-first
# restart_policy:
# condition: any
# delay: 5s
# max_attempts: 3
# window: 120s
# healthcheck:
# test: ["CMD", "curl", "-f", "http://quanta-hos-dev:${PORT}/health"]
# interval: 10m
# timeout: 10s
# retries: 3
# start_period: 30s
# ====================================================================
hostname: quanta-host-dev
networks:
bridge:
aliases:
- quanta-host-dev
# extra_hosts:
# - 'host.docker.internal:host-gateway'
volumes:
- '${QUANTA_BASE}/tmp:/tmp'
- '${QUANTA_BASE}/log:/log'
- '${QUANTA_BASE}/config:/config'
- '${PRJROOT}/target/classes:/loader-path'
ports:
- '${HOST_PORT}:${PORT}'
- '${PORT_DEBUG}:${PORT_DEBUG}'
environment:
# Docker warm vars
X_NODE_ID: "{{.Node.ID}}"
X_NODE_HOSTNAME: '{{.Node.Hostname}}'
X_SERVICE_ID: '{{.Service.ID}}'
X_SERVICE_NAME: '{{.Service.Name}}'
X_TASK_SLOT: "{{.Task.Slot}}"
X_TASK_ID: '{{.Task.ID}}'
X_TASK_NAME: '{{.Task.Name}}'
QUANTA_VER: "${QUANTA_VER}"
logging.config: /log/logback.xml
XMS: "${XMS}"
XMX: "${XMX}"
REDIS_HOST: "${REDIS_HOST}"
REDIS_PORT: "${REDIS_PORT}"
REDIS_PASSWORD: "${REDIS_PASSWORD}"
SPRING_DATASOURCE_URL: "jdbc:postgresql://pgdb-dev:5432/quanta-pg"
SPRING_DATASOURCE_USERNAME: "quanta-pg"
SPRING_DATASOURCE_PASSWORD: ${pgPassword}
# Instead of setting this flag, it may be easier to just click
# "Run JUnit Tests" in the Admin Console of the app
runJUnit: "false"
adminPassword: "${adminPassword}"
mongoPassword: "${mongoPassword}"
devEmail: "${devEmail}"
#ai-model
OPENAI_API_KEY: "${OPENAI_API_KEY}"
PPLX_API_KEY: "${PPLX_API_KEY}"
ANTH_API_KEY: "${ANTH_API_KEY}"
GEMINI_API_KEY: "${GEMINI_API_KEY}"
XAI_API_KEY: "${XAI_API_KEY}"
mongoSecurity: "true"
rssPreCacheEnabled: "false"
aiAgentEnabled: "true"
userGuideUrl: "https://quanta.wiki/pub/user-guide"
# WARNING: Most browsers (other than Firefox) will not support crypto unless you're on HTTPS
# requireCrypto: "true"
# NOTE: '>-' removes all newline characters and makes one long string
# Using '|' there instead would preserve the newlines after read in
# The '-' after either of those removes any trailing newline
testUserAccounts: >-
adam:${testPassword}:${devEmail},
bob:${testPassword}:${devEmail},
cory:${testPassword}:${devEmail},
dan:${testPassword}:${devEmail},
eric:${testPassword}:${devEmail}
testPassword: "${testPassword}"
throttleTime: "0"
spring.config.location: "classpath:/application.properties"
mongodb.host: "${MONGO_HOST}"
mongodb.port: "${MONGO_PORT}"
quantaAI.host: "${QAI_HOST}"
quantaAI.port: "${QAI_PORT}"
instanceId: "dev"
profileName: "dev"
server.port: "${PORT}"
httpProtocol: "http"
metaHost: "${quanta_domain}"
allowFileSystemSearch: "false"
spring.http.multipart.max-file-size: "200MB"
spring.http.multipart.max-request-size: "200MB"
spring.servlet.multipart.max-file-size: "200MB"
spring.servlet.multipart.max-request-size: "200MB"
adminDataFolder: "/tmp"
mail.port: ""
mail.user: "postmaster@quantizr.com"
mail.password: "${emailPassword}"
mail.host: "smtp.mailgun.org"
mail.from: "noreply@quanta.wiki"
JAVA_TOOL_OPTIONS: "-agentlib:jdwp=transport=dt_socket,address=0.0.0.0:${PORT_DEBUG},server=y,suspend=n"
# Quanta AI Microservice (Encapsulates Python LangChain)
qai-dev:
image: ${QAI_IMAGE}
build:
context: ${PRJROOT}
args:
QAI_HOST: "${QAI_HOST}"
QAI_PORT: "${QAI_PORT}"
dockerfile: ./dockerfile-qai
deploy:
# Don't want a restart policy for DEV!
# restart_policy:
# condition: on-failure
# # delay is time between restart attempts
# delay: 10s
# max_attempts: 4
# window: 120s
replicas: 1
hostname: qai-host-dev
networks:
bridge:
aliases:
- qai-host-dev
environment:
QAI_HOST: "${QAI_HOST}"
QAI_PORT: "${QAI_PORT}"
PYTHONUNBUFFERED: 1
logging:
options:
max-size: 10m
max-file: "3"
ports:
- '${QAI_PORT}:${QAI_PORT}'
volumes:
# todo-2: make these two folders visible in Agent Config panel of app (but read-only)
- /home/clay/ferguson/Quantizr/src:/projects
- /home/clay/ai-agent-temp:/data
- '${QUANTA_BASE}/log:/log'
networks:
bridge: