Files
memind/docs/103-runtime-topology.md
T
john 0dfb2e2b82
Memind CI / Test, build, and release guards (pull_request) Has been cancelled
docs(ops): record 103 goosed native migration and add migrate tooling
Document the completed Docker-to-native goosed pool cutover on 103, add the production migrate script with backup/rollback paths, and extend local native pool soak/metrics helpers used as migration gates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 20:24:22 +08:00

7.2 KiB
Raw Blame History

Local and 103 runtime topology

Last confirmed: 2026-07-30 20:20 CST (goosed native migration).

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..9 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
Upstream goosed pool TKMIND_API_TARGETShttps://127.0.0.1:18006180149 targets2026-07-07 确认)

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

User-level canary (when enabled)

Item Value
Stable edge upstream 105 nginx -> 58.38.22.103:8081
Identity router 127.0.0.1:18082
Canary edge tunnel 105 127.0.0.1:19082 -> 103 127.0.0.1:18082
Candidate Portal 127.0.0.1:18081
Candidate goosed 127.0.0.1:18015
Release entry scripts/release-portal-canary-prod.sh
Rollback entry scripts/rollback-portal-canary-prod.sh

The stable Portal stays on 8081 and the normal 105 edge path is a direct upstream, not the retired 19081 tunnel. A canary release starts an isolated 19082 tunnel and changes the two committed 105 nginx upstreams only after the candidate, router, 103/105 backups, immutable identity checks, and tunnel checks pass. It then proves stable fallback before declaring success. Port 18080 is occupied by a separate Memory V2 mock service and must not be reused.

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.

/health and /mindspace/v1/contract expose the MindSpace service contract version and build metadata. Production release scripts must reject a service whose contract version is stale, whose required authority bindings are missing, or whose gitSha does not match the runtime artifact manifest.

goosed

103 goosed runs as native launchd processes (2026-07-30 migrated). Docker/Colima pool is stopped; goosed-prod-1 is kept as emergency standby.

迁移记录与回滚:goosed-native-103-migration-plan.md已执行 2026-07-30)。脚本:scripts/goosed-native-103-migrate.sh

Item Value
Runtime type Native launchd (GOOSED_RUNTIME=native)
Root /Users/john/Project/tkmind_go-native
Binary tkmind_go-native/goosedreleases/goosed-*
Launchd labels cn.tkmind.goosed-native-1800618014
Run script run-goosed-native.sh <port> + .env.<port>
Session store PostgreSQL memind_sessions via GOOSE_SESSION_DB_URL127.0.0.1:5432
FD monitor cn.tkmind.goosed-monitorscripts/monitor-goosed-fds.mjs
Docker standby goosed-prod-1 stopped, restart=no(紧急回滚 18006
DeepSeek no-think cn.tkmind.memind-deepseek-no-think:18036native 必需,MEMIND_DEEPSEEK_PROXY_ENTRYPOINT=1

Critical: Native goosed uses host PostgreSQL on 127.0.0.1:5432. If PostgreSQL stops, H5 /agent/start hangs ~60s. 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'

Port layout (native listens directly on host port):

Port Launchd label
18006 cn.tkmind.goosed-native-18006
18007 cn.tkmind.goosed-native-18007
18014 cn.tkmind.goosed-native-18014

All nine host ports must return ok from /status, and must appear in Portal .env TKMIND_API_TARGETS.

Legacy Docker pool (standby only)

Item Value
Compose directory /Users/john/Project/goosed-prod
Image pattern tkmind/goosed:prod-${GOOSED_TAG}
Containers goosed-prod-1..9stopped, docker update --restart=no

Do not leave cn.tkmind.goosed-monitor on monitor-goosed-containers.mjs with GOOSED_RESTART_UNHEALTHY=1; it will restart Docker and fight native ports.

# Emergency: single Docker instance on 18006 only
launchctl bootout gui/$(id -u)/cn.tkmind.goosed-native-18006
docker update --restart=unless-stopped goosed-prod-1 && docker start goosed-prod-1

PostgreSQL rule

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

  • local native goosed: PostgreSQL database goose_sessions_dev
  • 103 native 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 $(seq 18006 18014); do curl -kfsS https://127.0.0.1:$p/status; echo; done'
ssh john@58.38.22.103 'grep ^TKMIND_API_TARGETS= /Users/john/Project/Memind/.env'