Files
memind/docs/103-runtime-topology.md
T
john b6def0f25b fix(ops): 自愈 goosed 会话 PostgreSQL,防止 H5 卡在创建新对话
103 Colima goosed 依赖宿主机 postgresql@17;库停止时 /agent/start 会 pool timeout 约 60s。新增 ensure 脚本、接入监控与发布前检查,并补充拓扑文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 16:57:38 +08:00

4.9 KiB
Raw Blame History

Local and 103 runtime topology

Last confirmed: 2026-07-03 15:36 CST.

This is the current topology source of truth for local Memind and 103 production. Prefer this document over older migration notes. Older architecture documents may contain historical paths from before the MindSpace split.

Local Mac

Local Memind connects to native goosed, not Colima/Docker goosed.

Item Value
Runtime type Native launchd process
Service com.tkmind.local-goosed
Binary /Users/john/Project/tkmind_go/target/release/goosed
Command role goosed agent
Port 18006 only
Session store PostgreSQL goose_sessions_dev

Local ports 18007-18009 are not the intended local goosed pool. If they are listening locally, treat that as drift unless a specific local test explicitly opened them.

Local Colima may exist for other workloads, but local Memind/goosed is not supposed to route through the 103-style goosed-prod-1..4 Colima pool.

Portal

Item Value
Host 58.38.22.103
Live directory /Users/john/Project/Memind
Service cn.tkmind.memind-portal
Start script /Users/john/Project/Memind/scripts/run-memind-portal-prod.sh
Port 8081
Health check curl http://127.0.0.1:8081/api/status

Portal must be released as a runtime artifact. Do not edit source directly on 103.

MindSpace Service

Item Value
Live directory /Users/john/MindSpace
Service cn.tkmind.mindspace-service
Start script /Users/john/MindSpace/scripts/run-mindspace-prod.sh
Port 8082
Health check curl http://127.0.0.1:8082/health
Contract check curl http://127.0.0.1:8082/mindspace/v1/contract
Shared Memind root MEMIND_SHARED_ROOT=/Users/john/Project/Memind

/Users/john/MindSpace is the production MindSpace service root. Do not treat /Users/john/Project/Memind/MindSpace as the canonical MindSpace service root after the split.

goosed

103 goosed runs in Colima/Docker, not as native launchd processes.

Item Value
Docker context colima
Compose directory /Users/john/Project/goosed-prod
Compose env /Users/john/Project/goosed-prod/.env
Image pattern tkmind/goosed:prod-${GOOSED_TAG}
Session store PostgreSQL memind_sessions through GOOSE_SESSION_DB_URL
Session PostgreSQL Host postgresql@17 on 127.0.0.1:5432 (/opt/homebrew/var/postgresql@17)

Critical: Colima goosed reaches the session DB via host.docker.internal:5432. If host PostgreSQL is stopped, H5 /agent/start hangs ~60s then fails with pool timed out, and the UI stays on「正在创建新对话…」. Recovery:

ssh john@58.38.22.103 'bash /Users/john/Project/Memind/scripts/ensure-goose-session-postgres.sh'
ssh john@58.38.22.103 '/opt/homebrew/opt/postgresql@17/bin/pg_isready -h 127.0.0.1 -p 5432'

cn.tkmind.goosed-monitor103)运行 goosed-prod/scripts/monitor-goosed-containers.mjs,本地 native goosed 监控用 scripts/monitor-goosed-fds.mjs;两者都会在巡检时调用 ensure-goose-session-postgres.sh

Container layout:

Container Host port Container port
goosed-prod-1 18006 18006
goosed-prod-2 18007 18006
goosed-prod-3 18008 18006
goosed-prod-4 18009 18006

All four ports must return ok from /status.

PostgreSQL rule

Both local native goosed and 103 Colima goosed persist sessions in PostgreSQL:

  • local native goosed: PostgreSQL database goose_sessions_dev
  • 103 Colima goosed: PostgreSQL database memind_sessions

Do not assume a local SQLite session store when debugging current Memind/goosed behavior.

Important path rule

The canonical production MindSpace service root is:

/Users/john/MindSpace

The old monolith path:

/Users/john/Project/Memind/MindSpace

is legacy compatibility/storage context only. If Portal or goosed config still points business MindSpace service behavior at the old path, treat that as configuration drift to fix, not as the desired topology.

In particular, check these before debugging missing folders/pages:

ssh john@58.38.22.103 'grep -E "^(MINDSPACE|MINDSPACE_ROOT|MINDSPACE_SERVICE|MEMIND_SHARED_ROOT)=" /Users/john/Project/Memind/.env /Users/john/Project/goosed-prod/.env 2>/dev/null'
ssh john@58.38.22.103 'launchctl print gui/$(id -u)/cn.tkmind.mindspace-service | grep -E "program =|working directory|MINDSPACE|MEMIND_SHARED"'
ssh john@58.38.22.103 '/opt/homebrew/bin/docker inspect goosed-prod-1 --format "{{json .Mounts}}"'

Current verification commands

ssh john@58.38.22.103 'curl -fsS http://127.0.0.1:8081/api/status'
ssh john@58.38.22.103 'curl -fsS http://127.0.0.1:8082/health'
ssh john@58.38.22.103 'for p in 18006 18007 18008 18009; do curl -kfsS https://127.0.0.1:$p/status; echo; done'