Add no-cache response header to dashboard for immediate visibility after deploys; enhance Proxmox monitoring documentation and update flash script to allow Backup without a golden image.

This commit is contained in:
nearxos
2026-02-18 14:20:31 +02:00
parent ee1c8f1ea6
commit 1b902d18e6
7 changed files with 146 additions and 8 deletions

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Run on the Proxmox HOST (where USB is connected) to verify the reTerminal in boot mode is seen.
# Usage: ssh root@10.130.60.224 'bash -s' < scripts/check-usb-on-host.sh
# Or copy to host and run: ./check-usb-on-host.sh
echo "=== CM4 boot-mode USB (2b8e = RPi, 0a5c:2711 = Broadcom BCM2711) ==="
lsusb | grep -E "2b8e|0a5c" || echo "None found. Connect reTerminal in boot mode (eMMC disable jumper) and use the USB slave port."
echo ""
echo "=== All USB devices ==="
lsusb
echo ""
echo "=== Provisioning status ==="
cat /var/lib/cm4-provisioning/status.json 2>/dev/null || echo "No status.json (script has not run yet)."
echo ""
echo "=== Last flash log ==="
tail -15 /var/lib/cm4-provisioning/flash.log 2>/dev/null || echo "No flash.log"
echo ""
echo "=== udev rule and rpiboot ==="
test -f /etc/udev/rules.d/90-cm4-boot-mode.rules && echo "90-cm4-boot-mode.rules: present" || echo "90-cm4-boot-mode.rules: MISSING"
test -x /opt/usbboot/rpiboot && echo "rpiboot: present" || echo "rpiboot: MISSING"
test -f /etc/cm4-provisioning/enabled && echo "enabled: yes" || echo "enabled: no (provisioning disabled)"

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Deploy only the dashboard to the LXC by IP (no Proxmox host needed).
# Usage: ./deploy-dashboard-to-lxc.sh [user@lxc_ip]
# Example: ./deploy-dashboard-to-lxc.sh root@10.130.60.119
set -e
LXC="${1:-root@10.130.60.119}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_DIR="$(dirname "$SCRIPT_DIR")"
DASHBOARD_DIR="$REPO_DIR/dashboard"
REMOTE_DIR="/opt/cm4-provisioning/dashboard"
if [[ ! -d "$DASHBOARD_DIR" ]]; then
echo "Error: dashboard dir not found: $DASHBOARD_DIR"
exit 1
fi
echo "Deploying dashboard to $LXC ($REMOTE_DIR) ..."
ssh "$LXC" "mkdir -p $REMOTE_DIR/templates"
rsync -avz \
"$DASHBOARD_DIR/app.py" \
"$DASHBOARD_DIR/cm4-dashboard.service" \
"$LXC:$REMOTE_DIR/"
rsync -avz \
"$DASHBOARD_DIR/templates/" \
"$LXC:$REMOTE_DIR/templates/"
echo "Restarting cm4-dashboard service ..."
ssh "$LXC" "systemctl restart cm4-dashboard && systemctl is-active --quiet cm4-dashboard && echo 'Dashboard restarted and running.'"
echo "Done. Dashboard at http://$(echo "$LXC" | cut -d@ -f2):5000"

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# Run on the Proxmox HOST to see provisioning status, USB, flash job, and logs.
# Usage: ./monitor-from-host.sh or: ssh root@10.130.60.224 'bash -s' < scripts/monitor-from-host.sh
PROV=/var/lib/cm4-provisioning
echo "═══════════════════════════════════════════════════════════════"
echo " CM4 provisioning host monitor"
echo "═══════════════════════════════════════════════════════════════"
echo ""
echo "--- USB (CM4 boot mode: 2b8e or 0a5c:2711) ---"
lsusb | grep -E "2b8e|0a5c" || echo " No CM4 boot device seen."
echo ""
echo "--- Current status (dashboard reads this) ---"
if [[ -f "$PROV/status.json" ]]; then
cat "$PROV/status.json" | python3 -m json.tool 2>/dev/null || cat "$PROV/status.json"
else
echo " No status.json (no run yet)."
fi
echo ""
echo "--- Flash job (systemd unit) ---"
systemctl show cm4-flash-once --property=ActiveState,SubState,ExecMainPID 2>/dev/null || echo " Unit not run yet."
echo ""
echo "--- Last 20 lines of flash.log ---"
tail -20 "$PROV/flash.log" 2>/dev/null || echo " No flash.log"
echo ""
echo "--- Provisioning dir ---"
ls -la "$PROV/" 2>/dev/null || echo " Dir missing."
echo ""
echo "--- Block devices (eMMC appears here after rpiboot) ---"
lsblk -d -o NAME,SIZE,MODEL,TRAN 2>/dev/null | head -15
echo ""
echo "--- Config ---"
echo " enabled: $([ -f /etc/cm4-provisioning/enabled ] && echo yes || echo no)"
echo " rpiboot: $([ -x /opt/usbboot/rpiboot ] && echo /opt/usbboot/rpiboot || echo MISSING)"
echo " golden: $([ -f $PROV/golden.img ] && echo present || echo not set)"
echo " backups: $(ls "$PROV/backups" 2>/dev/null | wc -l) file(s)"