-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.codebase-memory.yaml
More file actions
118 lines (107 loc) · 4.71 KB
/
Copy pathdocker-compose.codebase-memory.yaml
File metadata and controls
118 lines (107 loc) · 4.71 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
#ddev-generated
# Codebase Memory MCP server for DDEV
# Runs the codebase-memory-mcp binary in its own container, behind a small
# stdio->Streamable HTTP bridge, so agents register it with a plain URL.
# Install: ddev add-on get IT-Cru/ddev-codebase-memory-mcp
services:
codebase-memory:
container_name: ddev-${DDEV_SITENAME}-codebase-memory
hostname: codebase-memory
build:
context: .
dockerfile: codebase-memory-build/Dockerfile.codebase-memory
args:
USER_UID: ${DDEV_UID:-1000}
USER_GID: ${DDEV_GID:-1000}
CBM_VERSION: ${CBM_VERSION:-latest}
CBM_VARIANT: ${CBM_VARIANT:-ui}
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: ${DDEV_APPROOT}
restart: "no"
user: "${DDEV_UID:-1000}:${DDEV_GID:-1000}"
working_dir: /var/www/html
volumes:
# Same mount point as the web and AI agent containers. This is required,
# not cosmetic: file paths stored in the graph are only meaningful to
# Claude Code / OpenCode if they resolve identically on both sides.
- ../:/var/www/html
# Persist the knowledge graph across restarts and rebuilds — a full
# re-index of a large repository is expensive.
- codebase-memory-cache:/home/cbm/.cache/codebase-memory-mcp
- ddev-global-cache:/mnt/ddev-global-cache
environment:
- DDEV_SITENAME
- IS_DDEV_PROJECT=true
- TZ=${TZ:-UTC}
- VIRTUAL_HOST=${DDEV_HOSTNAME}
# Graph UI, served through ddev-router at https://<project>.ddev.site:9761.
# The bridge reverse-proxies it and rewrites the Host header, which is what
# makes a *.ddev.site URL work at all — the UI itself answers 403 to any
# host but localhost. Override both if 9760/9761 are taken on your machine:
# ddev dotenv set .ddev/.env.codebase-memory --cbm-ui-http-expose=9860:9760
- HTTP_EXPOSE=${CBM_UI_HTTP_EXPOSE:-9760:9760}
- HTTPS_EXPOSE=${CBM_UI_HTTPS_EXPOSE:-9761:9760}
# --- codebase-memory-mcp configuration ---
# One canonical cache root per container: every MCP session, CLI command
# and the daemon must agree on it, or CBM rejects the mismatch.
- CBM_CACHE_DIR=/home/cbm/.cache/codebase-memory-mcp
# Refuse to index anything outside the project. The server is driven by an
# AI agent, so the blast radius of a bad repo_path is worth bounding.
- CBM_ALLOWED_ROOT=/var/www/html
# CBM's own UI port (127.0.0.1-only inside the container) and the routable
# port the bridge proxies it onto. The UI runs whenever an MCP session is
# open, so there is nothing to switch on.
- CBM_UI_PORT=9749
- CBM_UI_PROXY_PORT=9760
- CBM_AUTO_INDEX=${CBM_AUTO_INDEX:-true}
- CBM_REGISTER_MCP=${CBM_REGISTER_MCP:-true}
# --- HTTP bridge ---
# Reachable as http://codebase-memory:9750/mcp on the project network.
- CBM_BRIDGE_PORT=9750
- CBM_BRIDGE_PATH=/mcp
# Optional shared secret. When set, the bridge requires
# `Authorization: Bearer <token>`; both clients support custom headers.
- CBM_BRIDGE_TOKEN
- CBM_BRIDGE_IDLE_TIMEOUT
- CBM_BRIDGE_REQUEST_TIMEOUT
# Optional tuning — passed through only when set in .ddev/.env.codebase-memory,
# so CBM applies its own detection by default.
- CBM_WORKERS
- CBM_MEM_BUDGET_MB
- CBM_LOG_LEVEL
- CBM_DIAGNOSTICS
# The entrypoint execs the HTTP bridge, which is the long-running process.
# Deliberately no `tty: true`: a TTY makes Docker emit a non-multiplexed log
# stream, which breaks `ddev logs -s codebase-memory` ("unrecognized stream")
# — and that is where first-run indexing progress is reported. Interactive
# use (`ddev cbm shell`) allocates its own TTY and is unaffected.
expose:
- "9750"
- "9760"
healthcheck:
# Both halves of the contract: the binary runs, and the bridge serves HTTP.
test: ["CMD", "bash", "-c", "codebase-memory-mcp --version >/dev/null 2>&1 && curl -fsS http://127.0.0.1:9750/health >/dev/null"]
interval: 15s
timeout: 10s
retries: 5
start_period: 20s
networks:
- default
- ddev_default
x-ddev:
describe-info: |
Codebase Memory MCP (knowledge graph, Streamable HTTP)
Endpoint: http://codebase-memory:9750/mcp (project network)
Registered in: .mcp.json (Claude Code), opencode.json (OpenCode)
CLI: ddev cbm <tool> | Re-index: ddev cbm index
Graph UI: https://${DDEV_HOSTNAME}:9761 (while an agent session is open)
networks:
ddev_default:
name: ddev_default
external: true
volumes:
codebase-memory-cache:
name: ddev-${DDEV_SITENAME}-codebase-memory-cache
ddev-global-cache:
external: true