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
# =============================================================================
# brain self-host STARTER — brain-edge (HTTP/JSON) + brain (the database)
# =============================================================================
#
# This is a starting point, not a turnkey deploy. Read the comments and adapt
# to your host (model paths, LLM keys, resource limits) before relying on it.
#
# your app ──HTTP/JSON──▶ brain-edge ──wire/CBOR──▶ brain
#
# Bring it up from THIS directory:
# docker compose up
services:
# ---------------------------------------------------------------------------
# brain-edge — the HTTP/JSON front door. Built from this repo.
# ---------------------------------------------------------------------------
brain-edge:
build:
# This crate is the whole context: brain-db-sdk resolves from crates.io,
# so there is no sibling checkout to reach outside it for.
context: .
dockerfile: Dockerfile
image: brain-edge:latest
ports:
# host:container — the HTTP/JSON API.
- "8080:8080"
environment:
# Env var names + defaults come straight from src/config/mod.rs.
BRAIN_EDGE_POOL_SIZE: "4" # pool width per credential
RUST_LOG: "brain_edge=info" # log filter
# Service DNS name + the port Brain listens on INSIDE the network (8080),
# not the 7878 it is published on. brain-edge defaults to 127.0.0.1:7878,
# which predates Brain settling on 8080 for its data plane.
BRAIN_ADDR: "brain:8080" # Brain wire addr (service DNS name)
BRAIN_EDGE_LISTEN: "0.0.0.0:8080" # HTTP listen addr
depends_on:
- brain
restart: unless-stopped
# ---------------------------------------------------------------------------
# brain — the memory database. NOT built here.
#
# Brain is Linux-only (glommio/io_uring) and lives in a DIFFERENT repo
# (~/Desktop/brain). You must build/provide this image yourself, e.g.:
# cd ~/Desktop/brain && docker build -t brain:latest .
# then re-run `docker compose up`. The `image:` below is a placeholder tag.
# ---------------------------------------------------------------------------
brain:
# The published multi-arch image. This was an `image: brain:latest`
# placeholder you had to build yourself; brain-db is on GHCR now. Pin a
# digest instead of a tag if you want the deploy to be immutable.
image: ghcr.io/arc-labs-ai/brain-db:0.1.0
# io_uring needs an unrestricted seccomp profile or the shard runtime traps.
security_opt:
- "seccomp:unconfined"
# glommio registers io_uring buffers against the memlock rlimit; the Docker
# default is too small and the shard runtime fails to start without this.
ulimits:
memlock: -1
ports:
# The wire port the edge connects to. 8080 inside the container, published
# on 7878 so it does not collide with brain-edge's own 8080 on the host.
# host:container.
- "7878:8080"
environment:
# The ONLY thing Brain needs to boot. Extraction and write-time HyPE are
# mandatory and always-on, so an absent or invalid key is a fatal startup
# error — Brain verifies the credential against the provider at boot
# rather than failing silently on the first write.
BRAIN__LLM__API_KEY: "${BRAIN__LLM__API_KEY:?set BRAIN__LLM__API_KEY in .env}"
volumes:
# Persistent data dir (WAL, arena, redb, indexes) on a named volume.
# The embedding and GLiNER models ship inside the image, so neither needs
# a mount — this used to bind-mount a BGE-small checkout from the host.
- "brain-data:/var/lib/brain/data"
restart: unless-stopped
volumes:
# Brain's durable state. Survives `docker compose down` (use `down -v` to wipe).
brain-data: