Share one AI across the mesh instead of confining it to the owner
Curated state copied to every node is state that can disagree, so the index, the model and the shared memory stay on the owner and each node reaches them over the SSH trust onboarding already builds. Chats stay on the node that had them; memory and bug reports stay the owner's to write.
This commit is contained in:
@@ -194,6 +194,19 @@ if [[ "${AI_ENABLED:-false}" != "true" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# The mesh shares one AI, and the index belongs to the node that holds the model. A mirror has the
|
||||
# same checkout and could build one, but nothing there would read it: retrieval happens wherever
|
||||
# generation happens, which is the owner.
|
||||
#
|
||||
# A skip, not an error. This is reached from git_pull_execute.sh on every node after every pull;
|
||||
# before the AI became mesh-wide it ran here too and failed on the empty OLLAMA_URL, nightly and
|
||||
# silently, because the caller discards its output.
|
||||
_ai_owner="${AI_OWNER_HOST:-host1}"
|
||||
if [[ "${MY_ID,,}" != "${_ai_owner,,}" ]]; then
|
||||
log "This node is not the AI owner ($_ai_owner) — the index lives there; skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$DRY_RUN" == false && "$EUID" -ne 0 ]]; then
|
||||
error "Must be run as root"
|
||||
exit 1
|
||||
@@ -204,6 +217,14 @@ acquire_lock
|
||||
command -v node >/dev/null 2>&1 || { error "node not found — required to build the index"; exit 1; }
|
||||
[[ -f "$CLI" ]] || { error "missing $CLI"; exit 1; }
|
||||
|
||||
# The AI owner has had data/ai since the subsystem was built, so nothing ever created it — cli.js
|
||||
# opens the DB by path and does not make the directory. On a first build the failure surfaces as a
|
||||
# sqlite open error rather than as the missing directory it is.
|
||||
if [[ "$DRY_RUN" == false ]] && ! mkdir -p "$(dirname "$DB")"; then
|
||||
error "Cannot create $(dirname "$DB")"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$OLLAMA_URL" ]]; then
|
||||
error "${MY_ID}_OLLAMA_URL is empty — no local Ollama to index against"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user