Add the foundation for distributing homelab context to every client (LXCs, VMs, workstations including republic-laptop, mac-mini, ludo-mini) with a single source of truth, structured query layer (MCP), and per-client age-key issuance for secrets: - inventory.yaml — canonical topology (hosts, services, mesh addresses) - hosts/*.yaml — per-host identity files generated from inventory by mcp/build_host_files.py; do not edit by hand - AGENTS.md — orientation doc symlinked to /root/AGENTS.md on every client - bootstrap.sh — one-shot enroll (Linux + macOS), clones repo, fetches age key from issuance, installs sync timer/launchd job, drops the homelab CLI - bin/homelab — single-binary Python CLI: whoami, list, ssh, pct, logs, restart, open, status, secret, sync, mcp, client add/remove, nuke - mcp/server.py — FastMCP server: context tools + read-only management tools (no mutations exposed); shell-outs use mcp-reader restricted ssh key - mcp/deploy/ — claudio-monitor-style gitea webhook deploy scaffold for the MCP service on LXC 105 (ports 9810 mcp, 9811 webhook) - secrets-issuance/ — per-client age key auto-provisioning over the mesh; source-IP gated against inventory, with denylist for revoked clients (ports 9820 issue, 9821 webhook) - secrets/, .sops.yaml — SOPS recipient scaffolding; the operator fills in age public keys after Phase 3a generates them - scripts/sync/ — systemd timer (Linux) + launchd plist (macOS) pulling /opt/homelab-context every 5 min Mesh: both Netbird (preferred, 100.122.0.0/16) and Tailscale accepted during the in-flight migration; no client is gated on completing the move. Plan reference: /root/.claude/plans/lets-make-a-plan-fluttering-trinket.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 lines
1.6 KiB
Bash
Executable File
47 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Install/update homelab-mcp on LXC 105 (apps). Idempotent.
|
|
# Triggered by the gitea webhook or run by hand.
|
|
set -euo pipefail
|
|
|
|
REPO_DIR=${REPO_DIR:-/opt/homelab-mcp}
|
|
|
|
cd "$REPO_DIR"
|
|
echo "[deploy] git pull"
|
|
git pull --ff-only
|
|
|
|
echo "[deploy] ensure python venv + deps"
|
|
if [ ! -d /opt/homelab-mcp/.venv ]; then
|
|
python3 -m venv /opt/homelab-mcp/.venv
|
|
fi
|
|
/opt/homelab-mcp/.venv/bin/pip install --quiet --upgrade pip
|
|
/opt/homelab-mcp/.venv/bin/pip install --quiet "mcp[cli]" pyyaml
|
|
|
|
echo "[deploy] install systemd units"
|
|
install -m 644 mcp/deploy/homelab-mcp.service \
|
|
/etc/systemd/system/homelab-mcp.service
|
|
install -m 644 mcp/deploy/webhook/homelab-mcp-deploy.service \
|
|
/etc/systemd/system/homelab-mcp-deploy.service
|
|
|
|
echo "[deploy] context clone for the MCP server"
|
|
# The MCP server reads from a local clone of Homelab-Docs at /opt/homelab-context
|
|
# (the same path every client uses). Bootstrap should already have created this;
|
|
# if not, fail loudly.
|
|
if [ ! -d /opt/homelab-context/.git ]; then
|
|
echo " /opt/homelab-context is not a git clone — run bootstrap.sh first." >&2
|
|
exit 1
|
|
fi
|
|
|
|
systemctl daemon-reload
|
|
if systemctl is-active --quiet homelab-mcp.service; then
|
|
systemctl restart homelab-mcp.service
|
|
fi
|
|
if systemctl is-active --quiet homelab-mcp-deploy.service; then
|
|
systemctl restart homelab-mcp-deploy.service
|
|
fi
|
|
|
|
echo "[deploy] done"
|
|
echo "First-time enable:"
|
|
echo " systemctl enable --now homelab-mcp.service homelab-mcp-deploy.service"
|
|
echo "Webhook first-time setup (generates secret):"
|
|
echo " $REPO_DIR/mcp/deploy/webhook/install.sh"
|