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]