From 9efa9b0bf6fa7f1e1fd34187ef3686441100917c Mon Sep 17 00:00:00 2001 From: Daniel Rossier Date: Sat, 14 Nov 2026 16:13:54 +0100 Subject: [PATCH] =?UTF-8?q?scripts:=20bootstrap-buildhost.sh=20=E2=80=94?= =?UTF-8?q?=20turn=20a=20checkout=20into=20a=20build=20host?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit spear-image build reuses the staging scripts, which run python3 from the PATH to read the corpus index; so a checkout cannot build an image until it has three machine-local things the repo does not carry: a client venv, a corpus registry (client/projects.json) and a prebuilt index (client/chromadb). This sets them up idempotently. The default venv installs only chromadb -- the one dependency the staging scripts import, enough to build from an existing index; --full installs requirements.txt (for indexing or native spear-chat), though torch stays manual (CUDA-specific). --index-from copies an index, --projects copies a registry; the index is never built here (hours of GPU embedding) -- spear-corpus / reindex do that, or a copy. Ends by importing chromadb from the venv and saying whether a build would find everything. --- scripts/bootstrap-buildhost.sh | 146 +++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100755 scripts/bootstrap-buildhost.sh diff --git a/scripts/bootstrap-buildhost.sh b/scripts/bootstrap-buildhost.sh new file mode 100755 index 0000000..09a316d --- /dev/null +++ b/scripts/bootstrap-buildhost.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# Turn a fresh SPEAR checkout into an image-build host. +# +# scripts/bootstrap-buildhost.sh +# scripts/bootstrap-buildhost.sh --full +# scripts/bootstrap-buildhost.sh --index-from /path/to/chromadb +# scripts/bootstrap-buildhost.sh --projects /path/to/projects.json +# +# `spear-image build` reuses the staging scripts, and those run `python3` from +# the PATH to read the corpus index -- so a checkout cannot build an image +# until it has three machine-local things the repository deliberately does not +# carry: a client venv, a corpus registry (client/projects.json) and a prebuilt +# index (client/chromadb). This sets them up, idempotently. +# +# What a build actually needs is narrow: the staging scripts import only +# chromadb (they COPY an existing index, they do not embed), so the default +# venv installs chromadb alone -- enough to build an image from an index that +# already exists. --full installs client/deploy/requirements.txt instead, which +# is what BUILDING an index or running spear-chat natively needs. Even --full +# does not install torch: it must come from the CUDA index matching the GPU +# (see the note in requirements.txt), so that stays a manual step. +# +# The index itself is not built here -- that is the corpora's embeddings, hours +# of GPU work. Point --index-from at one to copy (another host's, or a release +# artifact), or build it afterwards with `spear-corpus add --autoindex` / +# `/reindex` (offloading embeddings with SPEAR_EMBED_REMOTE). Likewise the +# registry: --projects copies one, or `spear-corpus add` writes it corpus by +# corpus. +# +# After this, `spear-configure` writes client/local.conf; make sure its PATH +# puts this checkout's client/bin first, and set SPEAR_ENTITY, SPEAR_COMMONS +# and the entity registry there (see client/local.conf.example). + +set -e + +HERE="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)" +# The release this is: "[spear vX.Y.Z]