-
Notifications
You must be signed in to change notification settings - Fork 22
/
dc-distro_quanta.yaml
322 lines (289 loc) · 10.9 KB
/
dc-distro_quanta.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
version: '3.7'
services:
redis-distro:
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-distro
networks:
bridge:
aliases:
- redis-host-distro
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}
command: redis-server --port ${REDIS_PORT} --loglevel warning --requirepass ${REDIS_PASSWORD}
environment:
REDIS_HOST: "${REDIS_HOST}"
REDIS_PORT: "${REDIS_PORT}"
REDIS_PASSWORD: ${REDIS_PASSWORD}
# todo-a: start using a cache folder
# volumes:
# - cache:/data
mongo-distro:
hostname: mongo-host-distro
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
networks:
bridge:
aliases:
- mongo-host-distro
# WARNING: volumes will not handle '~' character for home folder. Do not use.
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'
command: [
"--config", "/etc/mongod.conf",
"--setParameter", "diagnosticDataCollectionEnabled=false",
"--profile", "0",
"--slowms", "-1"
]
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: ${mongoPassword}
pgdb-distro:
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-distro
networks:
bridge:
aliases:
- pgdb-host-distro
environment:
- POSTGRES_USER=quanta-pg
- POSTGRES_PASSWORD=${pgPassword}
logging:
options:
max-size: 10m
max-file: "3"
# expose to host machine for management.
ports:
- '5432:5432'
volumes:
- '${POSTGRES_DATA}:/var/lib/postgresql/data'
# need to rename MONGO_BACKUP to just DB_BACKUP, since it's used for both mongo+postgres
- '${MONGO_BACKUP}:/backup'
# Disabled just to save server resources
# Simply by uncommening this section you can enable pgadmin4
# pgadmin4:
# image: dpage/pgadmin4:latest
# depends_on:
# - pgdb-distro
# environment:
# PGADMIN_DEFAULT_EMAIL: ${pgAdminEmail}
# PGADMIN_DEFAULT_PASSWORD: ${pgAdminPassword}
# ports:
# - '${PGADMIN_PORT}:80'
# networks:
# - bridge
# volumes:
# - '${PGADMIN_DATA}:/var/lib/pgadmin'
quanta-distro:
image: ${DOCKER_IMAGE}
depends_on:
- redis-distro
- mongo-distro
- pgdb-distro
- qai-distro
build:
context: ${PRJROOT}
args:
PORT_SEC: "${PORT_SEC}"
PORT: "${PORT}"
PORT_DEBUG: "${PORT_DEBUG}"
XMS: "${XMS}"
XMX: "${XMX}"
REDIS_HOST: "${REDIS_HOST}"
REDIS_PORT: "${REDIS_PORT}"
REDIS_PASSWORD: "${REDIS_PASSWORD}"
dockerfile: ./dockerfile-distro
# =================================================================
# 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-host:${PORT}/health"]
# interval: 10m
# timeout: 10s
# retries: 3
# start_period: 20s
# ====================================================================
hostname: quanta-host
networks:
bridge:
aliases:
- quanta-host
volumes:
- '${DATA_FOLDER}/docs:/docs'
- '${DATA_FOLDER}/tmp:/tmp'
- '${DATA_FOLDER}/log:/log'
- '${DEPLOY_TARGET}/config:/config'
- '/etc/letsencrypt/live/${quanta_domain}:/letsencrypt'
ports:
- '${HOST_PORT_SEC}:${PORT_SEC}'
- '${HOST_PORT}:${PORT}'
- '8000:8000'
environment:
# Docker swarm 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-distro:5432/quanta-pg"
SPRING_DATASOURCE_USERNAME: "quanta-pg"
SPRING_DATASOURCE_PASSWORD: ${pgPassword}
adminPassword: "${adminPassword}"
mongoPassword: "${mongoPassword}"
devEmail: "${devEmail}"
OPENAI_API_KEY: "${OPENAI_API_KEY}"
PPLX_API_KEY: "${PPLX_API_KEY}"
ANTH_API_KEY: "${ANTH_API_KEY}"
GEMINI_API_KEY: "${GEMINI_API_KEY}"
mongoSecurity: "true"
rssPreCacheEnabled: "true"
aiAgentEnabled: "false"
# 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}
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: "prod"
profileName: "prod"
server.port: "${PORT_SEC}"
httpProtocol: "https"
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"
# Uncomment for debugging... (don't forget to open ufw firewall for port on server)
JAVA_TOOL_OPTIONS: "-agentlib:jdwp=transport=dt_socket,address=0.0.0.0:8000,server=y,suspend=n"
security.require-ssl: "true"
server.ssl.key-store: "/letsencrypt/keystore.p12"
server.ssl.key-store-password: "${prodKeyStorePassword}"
server.ssl.keyStoreType: "PKCS12"
server.ssl.keyAlias: "tomcat"
mail.port: ""
mail.user: "postmaster@quantizr.com"
mail.password: "${emailPassword}"
mail.host: "smtp.mailgun.org"
mail.from: "noreply@quanta.wiki"
stripe.apiKey: "${stripeApiKey}"
stripe.endpointKey: "${stripeEndpointKey}"
stripe.paymentLink: "${stripePaymentLink}"
# Quanta AI Microservice (Encapsulates Python LangChain)
qai-distro:
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-distro
networks:
bridge:
aliases:
- qai-host-distro
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
- '${DATA_FOLDER}/log:/log'
networks:
bridge: