-
Notifications
You must be signed in to change notification settings - Fork 172
Expand file tree
/
Copy pathcompose.yml
More file actions
437 lines (413 loc) · 13.6 KB
/
compose.yml
File metadata and controls
437 lines (413 loc) · 13.6 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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
name: bento
# GPU Configuration:
# The gpu_prove_agent service automatically detects all available GPUs using nvidia-smi
# and spawns a prove agent process for each GPU. No manual configuration needed.
#
# To check available GPUs:
# nvidia-smi --list-gpus
# Anchors:
x-base-environment: &base-environment
DATABASE_URL: postgresql://${POSTGRES_USER:-worker}:${POSTGRES_PASSWORD:-password}@${POSTGRES_HOST:-postgres}:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-taskdb}
# With Redis auth set REDIS_PASSWORD; URL is redis://:password@host:6379 (empty password OK when no auth)
REDIS_URL: redis://:${REDIS_PASSWORD:-}@${REDIS_HOST:-redis}:6379
S3_URL: http://${MINIO_HOST:-minio}:9000
S3_BUCKET: ${MINIO_BUCKET:-workflow}
S3_ACCESS_KEY: ${MINIO_ROOT_USER:-admin}
S3_SECRET_KEY: ${MINIO_ROOT_PASS:-password}
NO_COLOR: 1
RUST_LOG: ${RUST_LOG:-info}
RISC0_HOME: /usr/local/risc0
RUST_BACKTRACE: 1
POVW_LOG_ID: ${REWARD_ADDRESS:-${POVW_LOG_ID:-}}
x-cpu-agent-common: &cpu-agent-common
image: ${CPU_AGENT_IMAGE:-ghcr.io/boundless-xyz/boundless/bento-agent-cpu:latest}
runtime: runc
build:
context: .
dockerfile: ${CPU_AGENT_DOCKERFILE:-dockerfiles/agent.cpu.dockerfile}
restart: always
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
environment:
<<: *base-environment
x-gpu-agent-common: &gpu-agent-common
image: ${AGENT_IMAGE-ghcr.io/boundless-xyz/boundless/bento-agent:latest}
runtime: ${DOCKER_RUNTIME:-nvidia}
build:
context: .
dockerfile: ${GPU_AGENT_DOCKERFILE:-dockerfiles/agent.dockerfile}
args:
BLAKE3_GROTH16_ARTIFACTS_URL: ${BLAKE3_GROTH16_ARTIFACTS_URL:-https://staging-signal-artifacts.beboundless.xyz/v3/proving/blake3_groth16_artifacts.tar.xz}
USE_LOCAL_BLAKE3_GROTH16_SETUP: ${USE_LOCAL_BLAKE3_GROTH16_SETUP:-0}
restart: always
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
environment:
<<: *base-environment
x-exec-agent-common: &exec-agent-common
<<: *cpu-agent-common
mem_limit: 4G
cpus: 3
environment:
<<: *base-environment
RISC0_KECCAK_PO2: ${RISC0_KECCAK_PO2:-17}
SEGMENT_SIZE: ${SEGMENT_SIZE:-21}
REDIS_TTL: ${REDIS_TTL:-57600}
entrypoint:
[
"/bin/sh",
"-c",
"/app/agent -t exec --segment-po2 $$SEGMENT_SIZE --redis-ttl $$REDIS_TTL",
]
x-broker-environment: &broker-environment
NO_COLOR: 1
RUST_LOG: ${RUST_LOG:-info,broker=debug,boundless_market=debug}
# RUST_BACKTRACE: 1
PROVER_PRIVATE_KEY: ${PROVER_PRIVATE_KEY:-${PRIVATE_KEY}}
PROVER_RPC_URL: ${PROVER_RPC_URL:-${RPC_URL}}
PROVER_RPC_URLS: ${PROVER_RPC_URLS}
# Per-chain RPC URLs for multichain broker (set only the chains you want to operate on)
PROVER_RPC_URL_8453: ${PROVER_RPC_URL_8453:-}
PROVER_RPC_URL_167000: ${PROVER_RPC_URL_167000:-}
PROVER_RPC_URL_11155111: ${PROVER_RPC_URL_11155111:-}
PROVER_RPC_URL_84532: ${PROVER_RPC_URL_84532:-}
BOUNDLESS_MARKET_ADDRESS:
SET_VERIFIER_ADDRESS:
ORDER_STREAM_URL:
# TODO these env vars are temporary for handling cancellations. These should be removed when
# updated.
POSTGRES_HOST:
POSTGRES_DB:
POSTGRES_PORT:
POSTGRES_USER:
POSTGRES_PASS:
x-gpu-prove-agent: &gpu-prove-agent
<<: *gpu-agent-common
environment:
<<: *base-environment
REDIS_TTL: ${REDIS_TTL:-57600}
# Detect GPUs and spawn one agent per GPU, then wait for all
entrypoint:
[
"/bin/sh",
"-c",
"for gpu in $(nvidia-smi --query-gpu=index --format=csv,noheader,nounits); do CUDA_VISIBLE_DEVICES=$$gpu /app/agent -t prove --redis-ttl $$REDIS_TTL & done; wait",
]
# When USE_LOCAL_BLAKE3_GROTH16_SETUP=1 the image has no artifacts; set BLAKE3_GROTH16_SETUP_DIR
# to the host path containing verify_for_guest_final.zkey and verify_for_guest_graph.bin.
# When using Ansible, BLAKE3_GROTH16_SETUP_DIR is set in .env and this dir is populated.
volumes:
- type: bind
source: ${BLAKE3_GROTH16_SETUP_DIR}
target: /.blake3_groth16_artifacts/
read_only: true
x-broker-common: &broker-common
image: ${BROKER_IMAGE-ghcr.io/boundless-xyz/boundless/broker:latest}
restart: always
depends_on:
rest_api:
condition: service_healthy
gpu_prove_agent:
condition: service_started
exec_agent:
condition: service_started
aux_agent:
condition: service_started
redis:
condition: service_healthy
postgres:
condition: service_healthy
profiles: [broker]
build:
context: .
dockerfile: ${BROKER_DOCKERFILE:-dockerfiles/broker.dockerfile}
mem_limit: 2G
cpus: 2
stop_grace_period: 3h
network_mode: host
services:
redis:
hostname: ${REDIS_HOST:-redis}
image: ${REDIS_IMG:-valkey/valkey:9.0}
restart: always
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
ports:
- 6379:6379
volumes:
- redis-data:/data
command:
[
"sh",
"-c",
'exec valkey-server --maxmemory-policy allkeys-lru --save 900 1 --appendonly yes $$(test -n "$$REDIS_PASSWORD" && echo "--requirepass $$REDIS_PASSWORD")',
]
healthcheck:
test:
[
"CMD",
"sh",
"-c",
'redis-cli $$(test -n "$$REDIS_PASSWORD" && echo "-a $$REDIS_PASSWORD") ping',
]
interval: 5s
timeout: 3s
retries: 5
start_period: 10s
postgres:
hostname: ${POSTGRES_HOST:-postgres}
image: ${POSTGRES_IMG:-postgres:16.3-bullseye}
restart: always
environment:
POSTGRES_DB: ${POSTGRES_DB:-taskdb}
POSTGRES_USER: ${POSTGRES_USER:-worker}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
ports:
- "${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}"
volumes:
- postgres-data:/var/lib/postgresql/data
command:
["postgres", "-p", "${POSTGRES_PORT:-5432}", "-c", "max_connections=500"]
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-worker} -d ${POSTGRES_DB:-taskdb}",
]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
minio:
hostname: ${MINIO_HOST:-minio}
image: ${MINIO_IMG:-minio/minio:RELEASE.2024-05-28T17-19-04Z}
restart: always
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio-data:/data
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-admin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASS:-password}
MINIO_DEFAULT_BUCKETS: ${MINIO_BUCKET:-workflow}
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 5
minio-init:
image: ${MINIO_IMG:-minio/minio:RELEASE.2024-05-28T17-19-04Z}
depends_on:
minio:
condition: service_healthy
restart: "no"
entrypoint:
- /bin/bash
- -c
- |
if [ "$${INPUT_TTL_DAYS:-0}" -le 0 ] 2>/dev/null; then
echo "INPUT_TTL_DAYS is 0 or unset, skipping lifecycle rule"
exit 0
fi
mc alias set local http://$${MINIO_HOST}:9000 $${MINIO_ROOT_USER} $${MINIO_ROOT_PASSWORD} &&
if [[ "$$(mc ilm rule list local/$${MINIO_BUCKET} --json 2>/dev/null)" == *'"Prefix":"inputs/"'* ]]; then
echo "Lifecycle rule for inputs/ already exists, skipping"
else
mc ilm rule add local/$${MINIO_BUCKET} --prefix "inputs/" --expire-days "$${INPUT_TTL_DAYS}" &&
echo "Lifecycle rule set: inputs/ objects expire after $${INPUT_TTL_DAYS} day(s)"
fi
environment:
MINIO_HOST: ${MINIO_HOST:-minio}
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-admin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASS:-password}
MINIO_BUCKET: ${MINIO_BUCKET:-workflow}
INPUT_TTL_DAYS: ${INPUT_TTL_DAYS:-0}
prometheus:
image: ${PROMETHEUS_IMG:-prom/prometheus:v2.53.0}
restart: unless-stopped
ports:
- "9091:9090"
volumes:
- ./dockerfiles/prometheus:/etc/prometheus:ro
- prometheus-data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.retention.time=30d"
grafana:
image: ${GRAFANA_IMG:-grafana/grafana:11.0.0}
restart: unless-stopped
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_LOG_LEVEL=WARN
- POSTGRES_HOST=${POSTGRES_HOST:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-taskdb}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- POSTGRES_USER=${POSTGRES_USER:-worker}
- POSTGRES_PASS=${POSTGRES_PASSWORD:-password}
- GF_INSTALL_PLUGINS=frser-sqlite-datasource
volumes:
- ./dockerfiles/grafana:/etc/grafana/provisioning/
- grafana-data:/var/lib/grafana
- broker-data:/db
depends_on:
- postgres
- redis
- minio
- prometheus
exec_agent:
<<: *exec-agent-common
deploy:
replicas: ${BENTO_EXECUTOR_COUNT:-4}
aux_agent:
<<: *cpu-agent-common
mem_limit: 256M
deploy:
replicas: ${BENTO_AUX_WORKER_COUNT:-2}
cpus: 1
environment:
<<: *base-environment
# Default to 4 max client connections if not set (work, poll for requeue, completed cleanup, stuck tasks cleanup)
DB_MAX_CONNECTIONS: ${DB_MAX_CONNECTIONS:-4}
CLEANUP_POLL_INTERVAL:
STUCK_TASKS_POLL_INTERVAL:
BENTO_DISABLE_COMPLETED_CLEANUP:
BENTO_DISABLE_STUCK_TASK_CLEANUP:
REDIS_TTL: ${REDIS_TTL:-57600}
entrypoint:
[
"/bin/sh",
"-c",
"/app/agent -t aux --monitor-requeue --redis-ttl $$REDIS_TTL",
]
# GPU Prover Agent - automatically detects and uses all available GPUs
# Uses nvidia-smi to detect GPUs and spawns one agent process per GPU
gpu_prove_agent:
<<: *gpu-prove-agent
deploy:
resources:
reservations:
devices:
- driver: nvidia
# No device_ids restriction - all GPUs are accessible
# The entrypoint script will detect and use all available GPUs
capabilities: [gpu]
rest_api:
image: ${REST_API_IMAGE-ghcr.io/boundless-xyz/boundless/bento-rest-api:latest}
build:
context: .
dockerfile: ${REST_API_DOCKERFILE:-dockerfiles/rest_api.dockerfile}
restart: always
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
mem_limit: 4G
cpus: 1
environment:
<<: *base-environment
ports:
- "8081:8081"
entrypoint: /app/rest_api --bind-addr 0.0.0.0:8081 --snark-timeout ${SNARK_TIMEOUT:-180}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
broker:
<<: *broker-common
volumes:
- type: bind
source: ./broker.toml
target: /app/broker.toml
- type: bind
source: ./chain-overrides
target: /app/chain-overrides
read_only: true
- broker-data:/db/
# Uncomment when using locally built set-builder and assessor guest programs
# - type: bind
# source: ./target/riscv-guest/guest-set-builder/set-builder/riscv32im-risc0-zkvm-elf/release/set-builder.bin
# target: /target/riscv-guest/guest-set-builder/set-builder/riscv32im-risc0-zkvm-elf/release/set-builder.bin
# - type: bind
# source: ./target/riscv-guest/guest-assessor/assessor-guest/riscv32im-risc0-zkvm-elf/release/assessor-guest.bin
# target: /target/riscv-guest/guest-assessor/assessor-guest/riscv32im-risc0-zkvm-elf/release/assessor-guest.bin
environment:
<<: *broker-environment
entrypoint: ["/bin/sh", "-c", "exec /app/broker --db-url 'sqlite:///db/broker.db' --config-file /app/broker.toml --bento-api-url http://localhost:8081 ${BROKER_EXTRA_ARGS:-}"]
# # Example second broker with different configuration
# broker2:
# <<: *broker-common
# volumes:
# - type: bind
# source: ./broker2.toml
# target: /app/broker.toml
# - broker2-data:/db/
# environment:
# <<: *broker-environment
# # Note: use a different variable if you want to use different private keys in each broker
# PRIVATE_KEY: ${PROVER_PRIVATE_KEY:-${PRIVATE_KEY}}
# RPC_URL: ${RPC_URL_2}
# entrypoint: /app/broker --db-url 'sqlite:///db/broker2.db' --config-file /app/broker.toml --bento-api-url http://localhost:8081
miner:
image: ${BENTO_CLI_IMAGE:-ghcr.io/boundless-xyz/boundless/bento-cli:latest}
build:
context: .
dockerfile: ${BENTO_CLI_DOCKERFILE:-dockerfiles/bento_cli.dockerfile}
restart: always
depends_on:
rest_api:
condition: service_healthy
profiles: [miner]
mem_limit: 2G
cpus: 2
network_mode: host
environment:
<<: *base-environment
RUST_LOG: ${RUST_LOG:-info}
entrypoint: /bin/bash -c "while sleep 1; do /app/bento_cli --iter-count 500000; done"
caddy:
image: caddy:2-alpine
restart: always
depends_on:
rest_api:
condition: service_healthy
profiles: [caddy]
network_mode: host
environment:
CADDY_DOMAIN: ${CADDY_DOMAIN:-:80}
CADDY_API_HOST: ${CADDY_API_HOST:-127.0.0.1}
CADDY_API_PORT: ${CADDY_API_PORT:-8081}
CADDY_ACME_EMAIL: ${CADDY_ACME_EMAIL:-}
CADDY_API_KEY: ${CADDY_API_KEY:-}
volumes:
- caddy-data:/data
- caddy-config:/config
- ./caddy/${CADDYFILE:-Caddyfile}:/etc/caddy/Caddyfile:ro
volumes:
redis-data:
postgres-data:
minio-data:
prometheus-data:
grafana-data:
broker-data:
caddy-data:
caddy-config:
# broker2-data: