Run OCI backup timers as the operator and clarify backup diagnostics
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-11-04 09:29:05 -06:00
parent e9ecd68070
commit f912456297
7 changed files with 40 additions and 6 deletions

View File

@ -504,6 +504,10 @@ func diagnoseReportRow(row reportRow) reportDiagnosis {
}
switch {
case strings.Contains(strings.ToLower(row.Check), "backup freshness"):
diagnosis.Cause = "Review the individual backup checks for stale or missing archives and unverified coverage. The reported result does not establish why the upload failed."
diagnosis.Mitigate = "Check OCI backup freshness and the scheduled upload service; verify native K3s datastore and volume coverage separately."
diagnosis.Redesign = "Run encrypted uploads under the configured operator account and monitor upload failures and restore verification."
case containsAny(text, "connection refused", "connect: connection refused", "couldn't connect to server", "no route to host", "network is unreachable", "timed out", "i/o timeout"):
diagnosis.Cause = "The target is not accepting traffic from this network path. The usual break is service down, wrong backend IP/port, route advertisement, firewall/NAT, or MetalLB address ownership."
diagnosis.Mitigate = "Test the next hop directly from the host that failed, then restart or reapply the owning layer shown by the check. For public URL failures, compare Debian -> Traefik and OCI edge -> Traefik before changing app code."

View File

@ -1,5 +1,14 @@
# Application Operations
## OCI backup scheduling
Run `./jeannie backup oci schedule` as the Debian operator to install the daily
upload and freshness timers under that account. Run `./jeannie backup oci upload`
for a fresh encrypted archive, then `./jeannie backup oci freshness` and
`./jeannie backup oci restore-verify` to check upload age and archive recovery.
The profile archive contains inventory, Gitea backup, and OpenTofu state; it
does not establish coverage of the native K3s datastore or PVC data.
## Profile-aware diagnostics and healing
Persist the operational cluster on the Debian deployment host with

View File

@ -1,5 +1,14 @@
# Application Operations
## OCI backup scheduling
Run `./jeannie backup oci schedule` as the Debian operator to install the daily
upload and freshness timers under that account. Run `./jeannie backup oci upload`
for a fresh encrypted archive, then `./jeannie backup oci freshness` and
`./jeannie backup oci restore-verify` to check upload age and archive recovery.
The profile archive contains inventory, Gitea backup, and OpenTofu state; it
does not establish coverage of the native K3s datastore or PVC data.
## Profile-aware diagnostics and healing
Persist the operational cluster on the Debian deployment host with

View File

@ -1472,10 +1472,12 @@ status_cascade_check() {
status_cascade_warn() {
local description="$1"
local output
local fix="./jeannie explain status"
shift
if truthy "${JEANNIE_REPORT_MODE:-false}"; then
report_ui_check warn "${STATUS_CURRENT_SECTION:-Status}" "${description}" "./jeannie explain status" "" "" "$@"
[[ "${description}" != "Backup freshness" ]] || fix="./jeannie backup oci freshness"
report_ui_check warn "${STATUS_CURRENT_SECTION:-Status}" "${description}" "${fix}" "" "" "$@"
return 0
fi
@ -4777,7 +4779,6 @@ install_homelab_backup_timer() {
# Optional offsite target examples:
# HOMELAB_BACKUP_OFFSITE_URI=file:///mnt/git-backups/homelab-profile
# HOMELAB_BACKUP_OFFSITE_URI=ssh://ubuntu@100.118.255.19/mnt/git-backups/homelab-profile
LAB_CLUSTER_PROFILE=pimox
KUBECONFIG_PATH=${kubeconfig}
ENV_EOT
if [[ -n "${offsite_uri}" ]]; then
@ -4799,6 +4800,8 @@ Wants=network-online.target
[Service]
Type=oneshot
User=$(id -un)
Environment=JEANNIE_SERVICE_CONTEXT=true
EnvironmentFile=-${env_file}
WorkingDirectory=${REPO_ROOT}
ExecStart=${REPO_ROOT}/jeannie backup

View File

@ -62,7 +62,7 @@ upload_archive() {
object="${PREFIX%/}/$(basename "${archive}")"
checksum_file="$(mktemp)"
trap 'rm -f "${checksum_file}"' RETURN
sha256sum "${archive}" >"${checksum_file}"
printf '%s archive.tgz.age\n' "$(sha256sum "${archive}" | awk '{print $1}')" >"${checksum_file}"
"${oci_bin}" os object put --config-file "${OCI_CONFIG}" --profile "${OCI_PROFILE}" \
--region "${OCI_REGION}" --namespace-name "${NAMESPACE}" --bucket-name "${BUCKET}" \
--name "${object}" --file "${archive}" --force >/dev/null

View File

@ -6,6 +6,11 @@ service=/etc/systemd/system/homelab-oci-backup.service
timer=/etc/systemd/system/homelab-oci-backup.timer
fresh_service=/etc/systemd/system/homelab-oci-backup-freshness.service
fresh_timer=/etc/systemd/system/homelab-oci-backup-freshness.timer
service_user="$(id -un)"
if [[ "$(id -u)" == 0 ]]; then
echo 'Run this command as the Debian operator, not root, so the timers use the correct OCI credentials and state.' >&2
exit 1
fi
sudo tee "${service}" >/dev/null <<EOF
[Unit]
@ -15,6 +20,8 @@ Wants=network-online.target
[Service]
Type=oneshot
User=${service_user}
Environment=JEANNIE_SERVICE_CONTEXT=true
WorkingDirectory=${repo_root}
ExecStart=${repo_root}/jeannie backup oci upload
EOF
@ -38,6 +45,8 @@ Description=Check freshness of the latest OCI backup
[Service]
Type=oneshot
User=${service_user}
Environment=JEANNIE_SERVICE_CONTEXT=true
WorkingDirectory=${repo_root}
ExecStart=${repo_root}/jeannie backup oci freshness
EOF

View File

@ -208,7 +208,7 @@ report_ui_local_rca() {
fi
model="${LAB_DOCTOR_LOCAL_MODEL:-${LAB_AI_GATEWAY_MODEL:-${AI_STACK_AGENT_SMART_MODEL:-${LAB_OLLAMA_MODEL:-llama3.2:3b}}}}"
printf '\n== AI RCA ==\n'
printf '\n== AI hypothesis (unverified) ==\n'
if ! command -v curl >/dev/null 2>&1 || ! command -v jq >/dev/null 2>&1; then
printf 'skipped: curl and jq are required to ask the AI gateway for RCA.\n'
printf 'fix: install curl jq, or rerun with --no-local-rca.\n'
@ -217,11 +217,11 @@ report_ui_local_rca() {
prompt="$(cat <<EOF
You are Jeannie, a local homelab SRE assistant. Use only the evidence below.
Homelab topology: Kubernetes runs on Pimox VMs; Debian hosts external services like Gitea, Dex, registry, Ollama, backups, and Jeannie; OCI edge proxies public traffic; RPi provides DNS/support services.
Active cluster profile: ${LAB_CLUSTER_PROFILE:-unknown}; runtime: ${LAB_CLUSTER_RUNTIME:-unknown}. Debian hosts external services; OCI edge proxies public traffic; RPi provides DNS/support services.
Task:
1. Pick the single highest-impact issue to focus first.
2. Give likely root cause, evidence, immediate mitigation, and long-term redesign.
2. Describe only evidence-supported causes; state when the cause is unknown. Give evidence, immediate mitigation, and long-term redesign.
3. Return exactly four bullets: Focus, Root cause, Mitigation, Redesign.
4. For Kubernetes pod/node issues, prefer read-only Holmes triage before mutation.
5. Keep it concise and practical. Do not invent commands not implied by the fix field.