Network monitor: hub, probes, Docker and native installers

Hub (FastAPI + no-build web UI):
- Network health: live probe/target matrix, status strips, incidents
- Probes: add (with install command), rename, remove, latency and throughput charts
- Clients merged from AdGuard, DHCP, query log and probe ARP tables; names,
  categories, suspicious flag, notes, per-client DNS requests
- Query log, domain detail (clients, related subdomains), blocked domains via
  the AdGuard Home /control API

Probe: tests peers (ping, HTTP, throughput), gateway, LAN and public DNS,
internet URLs and an optional VPS; buffers results while the hub is down.
Gateway and ARP from /proc/net on Linux, route/arp on macOS.

Install: install.sh (hub) and install-probe.sh (generated from it), each in
docker mode (compose; default on Linux hosts) or native mode (venv + systemd
or launchd; default on macOS and in LXC). Both modes deploy with an update
command that checks the new commit and rolls back on failure.

CLAUDE.md carries shared context for Claude Code sessions on each machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 18:10:29 -08:00
commit 54a765510a
63 changed files with 6464 additions and 0 deletions

17
native/run.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Starts the app for a native install. systemd (Linux) or launchd (macOS) runs this as the
# service user. It reads .env, keeps the git credentials away from the app, and execs uvicorn.
set -euo pipefail
INSTALL_DIR=$(cd "$(dirname "$0")/.." && pwd)
. "$INSTALL_DIR/native/lib.sh"
. "$INSTALL_DIR/.native"
cd "$INSTALL_DIR"
load_dotenv "$INSTALL_DIR/.env"
unset GIT_TOKEN GIT_USERNAME GIT_SSH_KEY
APP_VERSION=$(git -c safe.directory="$INSTALL_DIR" -C "$INSTALL_DIR" rev-parse --short HEAD 2>/dev/null || echo dev)
PORT=$(app_port)
export ROLE APP_VERSION PORT INSTALL_DIR INSTALL_MODE=native DATA_DIR="$INSTALL_DIR/data" PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
export UPDATE_COMMAND="sudo $NAME-update"
[ "$PLATFORM" = launchd ] && UPDATE_COMMAND="$NAME-update"
exec "$INSTALL_DIR/.venv/bin/uvicorn" app.main:app --host "$(app_host)" --port "$PORT" \
--no-server-header --timeout-graceful-shutdown 10