feat: add modular RPi4 host bootstrap
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details

This commit is contained in:
juvenal.diaz 2026-10-24 08:35:34 -06:00
parent f9a2ba55ba
commit a90594c8d9
4 changed files with 81 additions and 2 deletions

View File

@ -53,7 +53,7 @@ var allowedCommands = map[string]bool{
"deploy-dex": true, "deploy-matrix": true, "deploy-ai-stack": true,
"deploy-office": true,
"deploy-ai-tools": true, "deploy-omniroute": true, "deploy-hermes": true,
"rpi-services": true, "bootstrap-gitea-repo": true, "backup-gitea": true,
"rpi-services": true, "host-bootstrap": true, "bootstrap-gitea-repo": true, "backup-gitea": true,
"backup": true, "drill-restore": true, "drill-gitea-restore": true,
"drill-pihole-restore": true, "install-gitea-runner": true,
"move-prometheus-stack-workers": true, "doctor-versions": true,

View File

@ -64,6 +64,8 @@ Build And Bootstrap
deploy-hermes Deploy the Hermes agent (git-install + venv + gateway service).
bootstrap-gitea-repo Ensure the Gitea repo and SSH key wiring exist.
rpi-services Deploy Pi-hole, Unbound, and Uptime Kuma on RPi4.
host-bootstrap rpi4 [status|plan|apply --yes]
Provision/check the physical RPi4, then bootstrap host services.
ollama-setup Install/configure Ollama on the Debian host.
artifact-cache {status|up|down|instructions}
Manage optional Debian artifact caches.
@ -475,6 +477,10 @@ case "${1:-}" in
record_change_journal "rpi-services" "$@"
deploy_rpi_services
;;
host-bootstrap)
record_change_journal "host-bootstrap" "$@"
host_bootstrap_manage "${2:-}" "${3:-plan}" "${4:-}"
;;
bootstrap-gitea-repo)
bootstrap_gitea_repo
;;

View File

@ -33,6 +33,72 @@ plan_homelab() {
done
}
host_bootstrap_manage() {
local host_target="${1:-}"
local action="${2:-plan}"
local rpi_host rpi_user rpi_key
if [[ "${host_target}" != "rpi4" ]]; then
echo "Usage: ./jeannie host-bootstrap rpi4 [status|plan|apply --yes]" >&2
return 2
fi
if [[ "${action}" == "--help" || "${action}" == "help" ]]; then
echo "Usage: ./jeannie host-bootstrap rpi4 [status|plan|apply --yes]"
return 0
fi
rpi_host="${LAB_RPI_HOST:-${LAB_RASPBERRY_HOST:-192.168.100.89}}"
rpi_user="${LAB_RPI_USER:-${LAB_RASPBERRY_USER:-jv}}"
rpi_key="${LAB_RPI_SSH_KEY_PATH:-${LAB_RASPBERRY_SSH_KEY_PATH:-${HOME}/.ssh/id_ed25519}}"
case "${action}" in
status)
echo "== RPi4 host bootstrap status =="
echo "target=${rpi_user}@${rpi_host} key=${rpi_key}"
if ssh -i "${rpi_key}" -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new \
"${rpi_user}@${rpi_host}" 'set -eu; . /etc/os-release; printf "hostname=%s\\n" "$(hostname)"; printf "os=%s %s\\n" "${ID}" "${VERSION_ID}"; printf "arch=%s\\n" "$(uname -m)"; printf "kernel=%s\\n" "$(uname -r)"; command -v docker >/dev/null 2>&1 && echo docker=installed || echo docker=missing; test -d /boot && echo boot=present || echo boot=missing'; then
echo "SSH and host inspection succeeded."
else
echo "RPi4 is not reachable over SSH; OS installation cannot be completed by Jeannie yet." >&2
return 1
fi
;;
plan)
cat <<EOF
RPi4 host bootstrap plan
========================
target: ${rpi_user}@${rpi_host}
1. Provision the Raspberry Pi OS image through the configured network-boot or imaging provider.
2. Wait for SSH using ${rpi_key}.
3. Run the idempotent RPi host bootstrap and deploy Pi-hole, Unbound, and Uptime Kuma.
4. Continue the independent edge, cluster, platform, and application stages.
The existing PXE stack provisions Pimox ARM64 VMs; it does not reimage a physical RPi4.
Set LAB_RPI4_OS_PROVISIONER_COMMAND to a reviewed, site-specific imaging/netboot command before using apply.
No disk or OS changes are made by this plan.
EOF
;;
apply)
if [[ "${3:-}" != "--yes" ]]; then
echo "Refusing RPi4 OS/bootstrap changes without --yes." >&2
return 2
fi
if [[ -z "${LAB_RPI4_OS_PROVISIONER_COMMAND:-}" ]]; then
echo "LAB_RPI4_OS_PROVISIONER_COMMAND is required for RPi4 OS installation; refusing to guess a disk or boot target." >&2
return 2
fi
echo "Running the configured RPi4 OS provisioner..."
bash -lc "${LAB_RPI4_OS_PROVISIONER_COMMAND}"
check_rpi_ssh
deploy_rpi_services
;;
*)
echo "Usage: ./jeannie host-bootstrap rpi4 [status|plan|apply --yes]" >&2
return 2
;;
esac
}
cluster_profile_report() {
cat <<EOF
Active cluster profile: ${LAB_CLUSTER_PROFILE:-debian}

View File

@ -8442,11 +8442,18 @@ up() {
echo "Deploying the homelab infrastructure..."
jeannie_log_start "up"
jeannie_step_plan 13
local up_steps=13
if truthy "${LAB_RPI4_HOST_BOOTSTRAP_ENABLED:-false}"; then
up_steps=$((up_steps + 1))
fi
jeannie_step_plan "${up_steps}"
run_step "Early preflight" homelab_preflight early
run_step "Go toolchain" ensure_go_toolchain
run_step "Repo Map (Graphiphy)" graphiphy_map
if truthy "${LAB_RPI4_HOST_BOOTSTRAP_ENABLED:-false}"; then
run_step "RPi4 host bootstrap" host_bootstrap_manage rpi4 apply --yes
fi
run_step "Independent host services" run_up_parallel_stage
run_step "Full preflight" homelab_preflight full
run_step "Pre-apply doctor" doctor_preapply