Add mini/mid/gaming hardware profiles and always-on full stack

Profiles select CPU vs Vulkan and Bonsai-27B vs Qwen3.5-9B Abliterated
Q4_K_M. OpenHands is no longer optional; compose deploys every service.
download-models.sh fetches both GGUF families as the profile requests.
This commit is contained in:
tim 2026-07-22 19:00:59 -07:00
parent 3bf1726a99
commit a729ff14e9
11 changed files with 333 additions and 171 deletions

View file

@ -38,7 +38,17 @@ BONSAI_BACKEND="${BONSAI_BACKEND:-vulkan}"
export STACK_DIR CONFIG_DIR DATA_DIR BONSAI_MODELS_DIR AI_WORKSPACE_DIR
log "STACK_DIR=$STACK_DIR host=$STACK_HOST demo_user=$DEMO_USER"
log "STACK_DIR=$STACK_DIR host=$STACK_HOST demo_user=$DEMO_USER profile=${STACK_PROFILE:-unset}"
# Optional: re-apply named profile before bootstrap
if [[ -n "${STACK_PROFILE:-}" && -f "$STACK_DIR/profiles/${STACK_PROFILE}.env" ]]; then
log "Re-applying profile ${STACK_PROFILE}"
"$SCRIPT_DIR/apply-profile.sh" "$STACK_PROFILE"
set -a
# shellcheck disable=SC1091
source "$STACK_DIR/.env"
set +a
fi
# ---------------------------------------------------------------------------
# Directories
@ -76,43 +86,25 @@ fi
# Model download
# ---------------------------------------------------------------------------
if [[ "${DOWNLOAD_MODEL}" == "true" || "${DOWNLOAD_MODEL}" == "1" ]]; then
if [[ ! -f "$BONSAI_MODELS_DIR/${BONSAI_MAIN_FILE:-Ternary-Bonsai-27B-Q2_0.gguf}" ]]; then
log "Downloading Ternary-Bonsai GGUF (~7GB)…"
MODEL_DIR="$BONSAI_MODELS_DIR" \
BONSAI_HF_REPO="${BONSAI_HF_REPO:-prism-ml/Ternary-Bonsai-27B-gguf}" \
BONSAI_MAIN_FILE="${BONSAI_MAIN_FILE:-Ternary-Bonsai-27B-Q2_0.gguf}" \
DOWNLOAD_VISION="${DOWNLOAD_VISION:-1}" \
DOWNLOAD_DRAFTER="${DOWNLOAD_DRAFTER:-0}" \
"$SCRIPT_DIR/download-bonsai-model.sh"
else
log "Model already present — skip download"
fi
log "Downloading models for profile (see DOWNLOAD_BONSAI27 / DOWNLOAD_QWEN)…"
MODEL_DIR="$BONSAI_MODELS_DIR" "$SCRIPT_DIR/download-models.sh"
else
log "DOWNLOAD_MODEL=false — skip model download"
fi
# ---------------------------------------------------------------------------
# Docker compose
# Docker compose — always deploy the full stack (no optional profiles)
# ---------------------------------------------------------------------------
PROFILES=()
if [[ -n "${COMPOSE_PROFILES:-}" ]]; then
# shellcheck disable=SC2206
PROFILES=(--profile ${COMPOSE_PROFILES//,/ --profile })
fi
if [[ "$START_OPENHANDS" == "true" || "$START_OPENHANDS" == "1" ]]; then
PROFILES+=(--profile coding)
fi
if [[ "$COMPOSE_PULL" == "true" || "$COMPOSE_PULL" == "1" ]]; then
log "docker compose pull"
docker compose "${PROFILES[@]}" pull || true
docker compose pull || true
fi
log "Building bonsai (BONSAI_BACKEND=$BONSAI_BACKEND)"
log "Building bonsai (BONSAI_BACKEND=$BONSAI_BACKEND NGL=${BONSAI_NGL:-} model=${BONSAI_MAIN_FILE:-})"
docker compose build bonsai
log "docker compose up -d"
docker compose "${PROFILES[@]}" up -d
log "docker compose up -d (all services)"
docker compose up -d
# ---------------------------------------------------------------------------
# Heal gluetun if needed