InfrastructureCase study 13 / 20
Sentry
One dashboard that keeps the bare-metal server running all of this healthy, secure and recoverable, and the LLM router that routes the rest of the fleet.
Role
Sole designer and engineer
Status
● Running in production
Models
LLM router · Claude + local models on Ollama (server and MacBook) · token visibility
Stack
Next.js + React · TypeScript · systemd · LLM proxy · ntfy · Netdata
The short version
- Wraps proven engines (Netdata, ClamAV, rkhunter, Lynis, AIDE, CrowdSec) into one alert centre with phone push.
- Backs up every app (source to GitHub, databases and media to a separate cold disk) with safe, versioned restore.
- Runs the LLM router: Claude by default, local open-weight models when needed, and which model each app uses and how many tokens it spends.
01Why I built it
Seventeen apps on one physical server means one bad disk, one runaway log or one intrusion can take out everything I've built. I needed to know before that happens, and to be able to roll back when it does.
And once a whole fleet runs on AI, model choice and token spend become operational concerns, not just code details. They belong on the same dashboard as disk and CPU.
02How it works
- CollectEvery ~3 minutes: health (Netdata), storage and SMART wear, pm2, services, logins, incidents and git-sync status.
- ScanNightly ClamAV, rkhunter, AIDE and Lynis, plus 15-minute access, CrowdSec, open-port and SMART sweeps.
- PredictForecasts component end-of-life and flags memory climbs before they take a service down. Detects unexpected reboots and logs the probable cause.
- Back upSource pushed to private GitHub every 3 minutes; databases and media to a separate physical disk nightly at 03:15, with daily, weekly and monthly retention.
- RestoreAny part of any app, or all of it, to a chosen version: snapshot current, stop, restore, restart.
- RouteThe LLM proxy injects per-app routing config, fails over between providers, and falls back to local models on the server's Ollama. Heavier local jobs can run on a 64 GB MacBook Pro, shared to the server over Tailscale.
- AlertOne alert log, pushed to my phone with ntfy. Butler can read and acknowledge alerts, and approve a restart from a whitelist.
03Model choices, and why
Fleet-wide inference
Claude through the Claude Code subscription, behind an in-house router
No per-token API keys scattered across apps. One place to change routing, and per-project visibility of which model each tool uses (an alias that follows “latest”, or a pinned version).
Fallback
OpenAI-compatible providers
If the primary is down or rate-limited, work continues rather than failing.
Local inference
Open-weight models on Ollama: on the server, and on an M1 Max MacBook Pro with 64 GB, shared over Tailscale
Local models cost nothing per token and keep private data on hardware I own. The MacBook's unified memory (about 48 GB usable by the GPU) fits the 20–35B class of models, so the heavier local jobs go there instead of competing with 17 apps on the server.
Weekly usage audit (scheduled alongside Sentry)
Claude Fable, headless, in a default-deny sandbox
Every Wednesday it audits how each app is used and posts a summary to Discord. It can read the fleet but write only to the paths it has been granted.
04Context: what the audit agent sees
- Read-only by default. The audit agent can inspect processes, logs and file timestamps, and write only to the paths it has been granted.
- Facts, not guesses. Its report flagged an empty database being faithfully backed up, a 4-core CPU hog and backup drift, all from evidence it could point to.
- It caught its own bug. The sandbox's write rules used the wrong path syntax, and the agent reported the exact fix.
05Token and cost visibility
- Per-project token usage and model pinning, visible in one place, so a regression in any one app's spend is obvious.
- Model updates are automated (Claude Code weekly, the content apps’ model lists daily), with pinning available when an app needs stability.
- Anything routed to a local model has zero marginal cost and doesn't count against the subscription's usage limits.
06Performance
- Collects every ~3 minutes and pushes alerts in real time.
- Three layers of reboot survival: systemd, user systemd with linger, and pm2 resurrect.
- Local model files live on the server's NVMe fast-data disk, off the root drive.
07Trade-offs I made
Chose
Wrap proven engines
Over
Write my own scanners
Chose
Read-only by default
Over
One-click everything
Chose
A non-root app reading root-generated reports
Over
Running the dashboard as root
Chose
Tailscale only
Over
Public exposure
Chose
Claude by default, local models when needed
Over
Local-first for everything
Chose
Share the MacBook only on mains power
Over
Always-on remote inference
08Guardrails
- Never publicly exposed.
- Restore and service control are off by default and audit-logged.
- Nightly backup-coverage check that fails loudly on drift and re-privatises any repo that goes public.
09What I'd do next
- Close the backup drift the audit found, so the nightly coverage check goes green and any new drift is obvious.
10What this shows
Applied AI engineering
LLM routing, failover, model pinning and token visibility treated as production operations.
Product
One pane over a dozen tools, built for a single operator's phone.
Solutions
Linux security, backup and recovery designed least-privilege from the start.
Across the fleet: every build runs on one self-hosted Linux server, binds to localhost and is reached only over a private Tailscale network. AI inference runs on a Claude subscription through one in-house router rather than per-token API keys, with open-weight models on Ollama as the local layer: on the server, and on a 64 GB MacBook Pro shared over Tailscale for heavier local work. Everything is backed up to GitHub and a separate cold disk, and nothing reaches another person without a human tap.
Hiring for applied AI, product or solutions work? I'd like to hear about it.