-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
345 lines (330 loc) · 10.8 KB
/
Copy pathdocker-compose.yml
File metadata and controls
345 lines (330 loc) · 10.8 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
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
services:
checks:
build:
context: .
dockerfile: infra/docker/checks.Dockerfile
working_dir: /workspace
entrypoint: ["bash", "/workspace/scripts/docker-check-entrypoint.sh"]
command: ["npm", "run", "check"]
environment:
CI: "1"
npm_config_cache: /root/.npm
volumes:
- .:/workspace
- checks-node-modules:/workspace/node_modules
- checks-npm-cache:/root/.npm
profiles:
- checks
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: testhistory
POSTGRES_USER: testhistory
POSTGRES_PASSWORD: testhistory
ports:
- "127.0.0.1:5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U testhistory -d testhistory"]
interval: 10s
timeout: 5s
retries: 12
start_period: 10s
redis:
image: redis:7-alpine
ports:
- "127.0.0.1:6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 12
start_period: 5s
rabbitmq:
image: rabbitmq:3.13-management-alpine
environment:
RABBITMQ_DEFAULT_USER: testhistory
RABBITMQ_DEFAULT_PASS: testhistory
RABBITMQ_DEFAULT_VHOST: testhistory
ports:
- "127.0.0.1:5672:5672"
- "127.0.0.1:15672:15672"
volumes:
- rabbitmq-data:/var/lib/rabbitmq
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 10s
timeout: 5s
retries: 12
start_period: 20s
minio:
image: minio/minio:RELEASE.2025-04-22T22-12-26Z
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: testhistory
MINIO_ROOT_PASSWORD: testhistory
ports:
- "127.0.0.1:9000:9000"
- "127.0.0.1:9001:9001"
volumes:
- minio-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:9000/minio/health/ready"]
interval: 10s
timeout: 5s
retries: 12
start_period: 10s
minio-init:
image: minio/mc:RELEASE.2025-04-16T18-13-26Z
depends_on:
minio:
condition: service_healthy
environment:
MINIO_ROOT_USER: testhistory
MINIO_ROOT_PASSWORD: testhistory
S3_BUCKET: ${S3_BUCKET:-testhistory-artifacts}
entrypoint:
- /bin/sh
- -ec
- |
mc alias set local http://minio:9000 "$$MINIO_ROOT_USER" "$$MINIO_ROOT_PASSWORD"
mc mb --ignore-existing "local/$$S3_BUCKET"
clickhouse:
image: clickhouse/clickhouse-server:25.4-alpine
ports:
- "127.0.0.1:8123:8123"
- "127.0.0.1:9009:9000"
volumes:
- clickhouse-data:/var/lib/clickhouse
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:8123/ping"]
interval: 10s
timeout: 5s
retries: 18
start_period: 20s
opensearch:
image: opensearchproject/opensearch:2.19.1
environment:
discovery.type: single-node
plugins.security.disabled: "true"
OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m"
ports:
- "127.0.0.1:9200:9200"
volumes:
- opensearch-data:/usr/share/opensearch/data
healthcheck:
test: ["CMD-SHELL", "curl -fsS 'http://127.0.0.1:9200/_cluster/health?local=true' >/dev/null"]
interval: 10s
timeout: 5s
retries: 18
start_period: 30s
api:
build:
context: .
dockerfile: apps/api/Dockerfile
environment:
NODE_ENV: production
API_PORT: 8080
DATABASE_URL: postgres://testhistory:testhistory@postgres:5432/testhistory
REDIS_URL: redis://redis:6379
RABBITMQ_URL: amqp://testhistory:testhistory@rabbitmq:5672/testhistory
S3_ENDPOINT: http://minio:9000
S3_BUCKET: testhistory-artifacts
S3_REGION: us-east-1
S3_FORCE_PATH_STYLE: "true"
S3_ACCESS_KEY_ID: testhistory
S3_SECRET_ACCESS_KEY: testhistory
CLICKHOUSE_URL: http://clickhouse:8123
OPENSEARCH_URL: http://opensearch:9200
UPLOAD_MAX_CONCURRENCY: ${UPLOAD_MAX_CONCURRENCY:-8}
UPLOAD_CHUNK_BYTES: ${UPLOAD_CHUNK_BYTES:-8388608}
ARTIFACT_RETENTION_DAYS: ${ARTIFACT_RETENTION_DAYS:-90}
ARTIFACT_COMPRESSION_MIN_BYTES: ${ARTIFACT_COMPRESSION_MIN_BYTES:-1024}
ARTIFACT_MAX_BYTES: ${ARTIFACT_MAX_BYTES:-536870912}
UPLOAD_SESSION_MAX_BYTES: ${UPLOAD_SESSION_MAX_BYTES:-1073741824}
UPLOAD_MAX_CHUNKS: ${UPLOAD_MAX_CHUNKS:-10000}
UPLOAD_SESSION_TTL_MINUTES: ${UPLOAD_SESSION_TTL_MINUTES:-60}
ARTIFACT_CLEANUP_GRACE_DAYS: ${ARTIFACT_CLEANUP_GRACE_DAYS:-7}
ARTIFACT_CLEANUP_BATCH_SIZE: ${ARTIFACT_CLEANUP_BATCH_SIZE:-1000}
ARTIFACT_CLEANUP_BATCH_INTERVAL_MINUTES: ${ARTIFACT_CLEANUP_BATCH_INTERVAL_MINUTES:-5}
UPLOAD_METADATA_SOURCE: ${UPLOAD_METADATA_SOURCE:-result}
TESTHISTORY_STORE_FILE: /var/lib/testhistory/store/store.json
TESTHISTORY_WORKER_TOKEN: ${TESTHISTORY_WORKER_TOKEN:-local-worker-token-change-me}
TESTHISTORY_BOOTSTRAP_ADMIN_EMAIL: ${TESTHISTORY_BOOTSTRAP_ADMIN_EMAIL:-}
TESTHISTORY_BOOTSTRAP_ADMIN_PASSWORD: ${TESTHISTORY_BOOTSTRAP_ADMIN_PASSWORD:-}
ports:
- "${TESTHISTORY_HOST_BIND:-127.0.0.1}:18080:8080"
volumes:
- api-store:/var/lib/testhistory/store
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://127.0.0.1:8080/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
]
interval: 10s
timeout: 5s
retries: 12
start_period: 15s
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
minio-init:
condition: service_completed_successfully
clickhouse:
condition: service_healthy
opensearch:
condition: service_healthy
api-migrate:
build:
context: .
dockerfile: apps/api/Dockerfile
command:
- node
- --input-type=module
- -e
- |
const {
createPostgresPersistence,
redactPostgresConnectionString,
resolvePostgresPersistenceConfig
} = await import("./apps/api/dist/persistence/postgres.js");
const config = resolvePostgresPersistenceConfig(process.env);
if (config === undefined) {
throw new Error("DATABASE_URL or TESTHISTORY_DATABASE_URL is required for migrations");
}
const persistence = await createPostgresPersistence(config);
try {
const health = await persistence.health();
console.log(JSON.stringify({
event: "testhistory.migration.complete",
driver: health.driver,
migrated: health.migrated,
migrationVersion: health.migrationVersion,
schema: config.schema,
database: redactPostgresConnectionString(config.connectionString)
}));
} finally {
await persistence.close();
}
environment:
NODE_ENV: production
DATABASE_URL: postgres://testhistory:testhistory@postgres:5432/testhistory
depends_on:
postgres:
condition: service_healthy
profiles:
- operations
worker:
build:
context: .
dockerfile: apps/worker/Dockerfile
environment:
NODE_ENV: production
TESTHISTORY_API_URL: http://api:8080
TESTHISTORY_WORKER_TOKEN: ${TESTHISTORY_WORKER_TOKEN:-local-worker-token-change-me}
DATABASE_URL: postgres://testhistory:testhistory@postgres:5432/testhistory
REDIS_URL: redis://redis:6379
RABBITMQ_URL: amqp://testhistory:testhistory@rabbitmq:5672/testhistory
S3_ENDPOINT: http://minio:9000
S3_BUCKET: testhistory-artifacts
S3_REGION: us-east-1
S3_FORCE_PATH_STYLE: "true"
S3_ACCESS_KEY_ID: testhistory
S3_SECRET_ACCESS_KEY: testhistory
CLICKHOUSE_URL: http://clickhouse:8123
OPENSEARCH_URL: http://opensearch:9200
WORKER_HEARTBEAT_MS: ${WORKER_HEARTBEAT_MS:-30000}
UPLOAD_MAX_CONCURRENCY: ${UPLOAD_MAX_CONCURRENCY:-8}
UPLOAD_CHUNK_BYTES: ${UPLOAD_CHUNK_BYTES:-8388608}
ARTIFACT_RETENTION_DAYS: ${ARTIFACT_RETENTION_DAYS:-90}
ARTIFACT_COMPRESSION_MIN_BYTES: ${ARTIFACT_COMPRESSION_MIN_BYTES:-1024}
ARTIFACT_MAX_BYTES: ${ARTIFACT_MAX_BYTES:-536870912}
UPLOAD_SESSION_MAX_BYTES: ${UPLOAD_SESSION_MAX_BYTES:-1073741824}
UPLOAD_MAX_CHUNKS: ${UPLOAD_MAX_CHUNKS:-10000}
UPLOAD_SESSION_TTL_MINUTES: ${UPLOAD_SESSION_TTL_MINUTES:-60}
ARTIFACT_CLEANUP_GRACE_DAYS: ${ARTIFACT_CLEANUP_GRACE_DAYS:-7}
ARTIFACT_CLEANUP_BATCH_SIZE: ${ARTIFACT_CLEANUP_BATCH_SIZE:-1000}
ARTIFACT_CLEANUP_BATCH_INTERVAL_MINUTES: ${ARTIFACT_CLEANUP_BATCH_INTERVAL_MINUTES:-5}
UPLOAD_METADATA_SOURCE: ${UPLOAD_METADATA_SOURCE:-result}
healthcheck:
test:
[
"CMD",
"node",
"-e",
"const required=['DATABASE_URL','REDIS_URL','RABBITMQ_URL','S3_ENDPOINT','S3_BUCKET','TESTHISTORY_API_URL','TESTHISTORY_WORKER_TOKEN']; if(!required.every((key)=>process.env[key]) || !Number.isFinite(Number(process.env.WORKER_HEARTBEAT_MS||30000))) process.exit(1); fetch(new URL('/health',process.env.TESTHISTORY_API_URL)).then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
depends_on:
api:
condition: service_healthy
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
minio-init:
condition: service_completed_successfully
clickhouse:
condition: service_healthy
opensearch:
condition: service_healthy
mcp:
build:
context: .
dockerfile: apps/mcp/Dockerfile
environment:
TESTHISTORY_API_URL: http://api:8080
depends_on:
api:
condition: service_healthy
healthcheck:
test:
[
"CMD-SHELL",
"printf '%s\n' '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"testhistory.health\",\"arguments\":{}}}' | node apps/mcp/dist/server.js | grep -q 'testhistory-mcp'"
]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
profiles:
- mcp
web:
build:
context: .
dockerfile: apps/web/Dockerfile
environment:
TESTHISTORY_API_UPSTREAM: http://api:8080
ports:
- "${TESTHISTORY_HOST_BIND:-127.0.0.1}:5173:80"
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1/"]
interval: 10s
timeout: 5s
retries: 12
start_period: 10s
depends_on:
api:
condition: service_healthy
volumes:
api-store:
checks-node-modules:
checks-npm-cache:
postgres-data:
rabbitmq-data:
minio-data:
clickhouse-data:
opensearch-data: