Blog
- Home
- Projects
- Team Break
- vigie: running 150 machines across 13 sites, with no technician on site
vigie: running 150 machines across 13 sites, with no technician on site
In the previous articles I described what runs in our rooms: the overall architecture, the Maestro engine, the Archipel site platform, and the ESP32 firmware base. One question remains: how do you actually operate all of it?
Team Break's fleet has about 150 enrolled machines spread over 13 sites: 4 company-owned and 9 franchised. They include Maestro room servers, Raspberry Pis driving video or sound, Donut Quiz kiosks and desks (nearly half the fleet, 9 machines per site), Heroes Academy installations and our Archipel servers. The target is around 300 machines once the older rooms are migrated.
vigie is the tool I built to operate that fleet from a single VPS. This article covers its design choices and, above all, the incidents that drove them.
The problem isn't technical
vigie's roadmap opens by stating the problem, and I'll quote it because everything else follows from it:
- a room that doesn't start in the morning costs slots. The time between "it's not working" and "it's fixed" is the measure that matters.
- nobody on site is a technician. Any procedure that assumes an operator in front of the screen is a procedure that fails.
- an intervention during opening hours is an incident, even a successful one.
So the goal isn't to have tools but to shorten the time between "it's not working" and "it's fixed", without ever degrading a room in operation. Four principles follow:
- Additive and reversible. Nothing vigie installs may degrade a room: not the DNS, not the routing, not the startup of a business service.
- Two sources of truth, explicitly separate. The Git repository describes the wanted state; the fleet reports the observed state. "The gap between the two is the most useful information in the system."
- Machines are only reachable over the VPN. No edge-point service is published on the Internet.
- No heavy agent. apt, systemd, shell and Docker. Whatever the OS already knows how to do, vigie doesn't reimplement.
And a few refusals, written down in black and white:
- no container orchestration on room machines: "A room runs business software, not a cluster";
- no automatic correction: "Diagnose, alert, suggest the command — deciding stays human as long as an incident costs slots";
- no general configuration management: the day we need one, we'll integrate an existing tool rather than write our own;
- no comfort tooling installed on room machines.
These choices live in a decision log (twelve so far, D1 to D12), each with its context, the choice and the cost of reversing it. The roadmap justifies it in one sentence: "better a debatable, written trajectory than an accumulation of tools."
One VPS, two packages, one script
┌──────────────────────── VPS ─────────────────────────┐
│ "vigie" package │
│ headscale (VPN) webui: PostgreSQL · API · signer │
│ sshca (certificate authority) │
└───────▲───────────────────▲───────────────┬──────────┘
│ reports (push, │ console │ read-only relay
│ ingestion port, │ (browser) │ (video wall)
tailnet │ every minute) │ ▼
┌───────────────────┴──────────┐ humans room cctv-hubs
│ edge points ("vigie-edge" │
│ package): │◄── SSH, 16 h certificate ───── access workstations
│ enroll · report · ssh-trust │ ("vigie-access" script)
│ order execution │
└──────────────────────────────┘
- On the server, the
vigiepackage installs three components: Headscale (the VPN control server), the web console (PostgreSQL, a FastAPI API and a separate container that signs SSH certificates) and the certificate authority. - On the machines, the
vigie-edgepackage can enroll the machine on the VPN, send a state report, trust the SSH authority and execute orders. - On access workstations, a standalone script,
vigie-access, finds a machine from a fragment of its name, maintains a managed block in~/.ssh/configand opens a session.
The server CLI follows a design rule I find healthy: it hardcodes no component. vigie <component> <action> resolves either to a Docker Compose verb (up, down, logs…) or to a script components/<component>/scripts/<action>.sh. Adding a building block means adding a directory. And to stop a human in a hurry from running docker compose -f … by hand with the wrong paths, the Compose files require a variable that only the CLI sets:
- "${VIGIE_VAR:?a lancer via le CLI vigie}/webui/postgres:/var/lib/postgresql/data"
Name a function, not a machine
Each machine gets a node name of the form <product>-<site>[-<level>…]-<function>[<n>], for example maestro-lille-chocolaterie-ascenseur-tv4. The name describes a function at a location, never a machine: when a Pi dies, its replacement takes the same name, and with it the same history and the same access. Segments contain no hyphen, and a number only appears where the field already uses one (tv4, never tv04).
Two decisions frame this name. The first: it is validated, never parsed. "A name must never serve as a database": a machine's site or product comes from the inventory, not from splitting a string.
The second comes from an incident. During enrollment, the tool renamed the system hostname to match the node name. At the end of August, that took rooms out of service for two days, in two ways, both deferred until the next reboot:
- our MQTT agents read the hostname once at startup and ignore messages addressed to any other name;
- Chromium's profile lock contains the hostname, and the kiosk silently refused to start.
Since then, the node name and the hostname are independent. Renaming the system requires an explicit option (--set-hostname), which warns, then purges exactly Chromium's three locks (SingletonLock, SingletonSocket, SingletonCookie), never a broader pattern: "a slightly too wide glob would wipe a 148 MB profile." And no session is restarted: automatic correction on a fleet in operation is ruled out.
A strictly additive VPN
Machines join a WireGuard tailnet managed by a self-hosted Headscale, at a pinned version, with a Tailscale client that is also pinned and frozen with apt-mark hold. "An upgrade is a decision, never a side effect."
The first principle (additive and reversible) shows up very concretely in the enrollment command. Every security option is passed explicitly, even at its default value, to neutralize any leftover preference from a previous install:
tailscale up \
--login-server "$login_server" \
--auth-key "$authkey" \
--hostname "$node_name" \
--accept-dns=false \
--accept-routes=false \
--advertise-routes= \
--advertise-exit-node=false \
--advertise-tags= \
--ssh=false \
--timeout 60s
The VPN touches neither the DNS, nor the routing, nor the machine's interfaces. --reset is banned because it would turn DNS management back on. MagicDNS is disabled on the server, and node keys don't expire: a room machine has nobody in front of its screen, and an expiry would cut remote access without warning and force a trip to the site. The trade-off is a periodic review of the nodes.
Partitioning, for security and for load
The access policy isn't hand-written: it's generated from the inventory. Each site is a Headscale user, and a single rule (autogroup:self) partitions the whole fleet, present and future: a machine only sees the machines of its own site. Three exceptions are added: access workstations see everything, every node can reach the server on the report ingestion port only, and the server can reach the camera hubs.
Partitioning protects franchises from one another, but it also helps with load. In a mesh network, every state change of a node is propagated to every other node, and every machine configures as many WireGuard peers. The roadmap puts it this way: "At 300 nodes, the load point is not the server but the topology pushed to everyone […]. The lever isn't resizing the VPS, it's partitioning." Measured after rollout: a Lille machine sees 37 peers instead of 145.
For the same reason, Headscale stays on SQLite. PostgreSQL was considered for 300 nodes, then dropped: the project discourages it, only documents migration from PostgreSQL to SQLite, and "choosing PostgreSQL would mean picking the least-tested backend, with no migration tool, for a gain the project itself doesn't promise."
The silent failure
One incident shaped how the server is exposed. After a short network cut, a client that reached the server over HTTP on a non-standard port switched to TLS on its own… on that same port, where nothing was listening. The trap: the WireGuard data plane survives, only the control plane breaks. Existing machines keep talking to each other, but new ones become invisible and a revocation is no longer applied. The decision log sums it up: "The failure is silent as long as nothing moves, and reveals itself exactly when you need it."
The server now sits behind a reverse proxy on standard ports (HTTPS on 443, HTTP on 80 relayed without redirect, and a default server that accepts connections without SNI), with Headscale listening only locally.
Push-based monitoring: silence is information
Why push rather than pull
To know a machine's state there are two options: the server fetches it (pull), or the machine sends it (push). The decision log settles it:
At three hundred, pull forces the server into three hundred connections per refresh, and a machine that's off makes everyone wait: the TCP timeout is paid for each one, precisely on the day several are offline, which is the day you look.
Pull would also force the server to hold SSH access to the whole fleet: "compromising the VPS would mean compromising every room." Push reverses every term. The server only receives, the load is spread over time, and "an offline machine signals itself by its silence — which is exactly the information you want, obtained without waiting for anything."
Identity without secrets
A report must be attributed to a machine, and a machine must not be able to pass itself off as another. The usual answer is one token per machine, in other words "a store of three hundred secrets for a read-only service."
The VPN already provides the answer. The ingestion API only listens on the server's tailnet address, and a packet's source address there is guaranteed by WireGuard: it's bound to a private key that never leaves the machine. The ingestion module's header sets three rules (translated):
# 1. the source address must be in the tailnet;
# 2. it must match a node known to Headscale;
# 3. the name sent by the machine is never trusted — it is only used
# to flag an inconsistency.
No secret is distributed, stored or revoked: removing a node from the tailnet is enough to silence it. And the day a machine is replaced, the one that takes over the name takes over the identity.
That elegance has a price. When the server moved in October, the Tailscale client's address translation masked source addresses behind the Docker gateway: every machine got a 403. That behaviour had to be disabled (--snat-subnet-routes=false) for identity to become readable again.
The report
On each machine, a systemd timer triggers a report every minute:
[Timer]
OnBootSec=2min
OnUnitActiveSec=1min
RandomizedDelaySec=20s
AccuracySec=10s
# No catch-up: a missed report describes a state that no longer exists.
Persistent=false
The matching service is a oneshot at Nice=10 with idle I/O scheduling because, as the comment says, "a collection must never compete for the CPU with a mechanism." There's no daemon and no open port on the machine. The report itself is JSON (field names stayed in French for compatibility with machines already in the field):
rapport = {
"version_agent": version_agent,
"hostname": os.uname().nodename,
"demarrage": demarrage(), # boot time (btime)
"systeme": systeme(), # distribution, version, kernel, architecture, model
"paquets": paquets(interessants), # versions of tracked packages, by exact name
"ressources": ressources(), # load, cores, memory, disks, temperature
"conteneurs": conteneurs(), # state, health, exit code, image version
"services": services(declares), # systemd units declared for this product
"ssh": ssh_access(admin_accounts), # port and admin accounts present
}
Three rules govern collection: it never fails as a whole ("a missing source is a missing field"), it modifies nothing, and no secret is read or sent.
One detail cost a few days: the package installs the timer but doesn't enable it. Explicit registration enables it, in line with the rule that "installing a package has no visible effect". A Rouen machine stayed online, healthy… and missing from the console for days, because it had been enrolled but not registered.
From raw state to anomalies
On the server, the analysis distinguishes four situations and never mixes them up:
- offline: Headscale no longer sees the machine;
- silent: it's online but hasn't sent a report in 5 minutes;
- no agent: it doesn't send reports, and that's expected (our last Windows servers): never an anomaly;
- stale report: a nuance among silent machines.
For resources, thresholds are data, in the database, per machine, resolved in the order node → site → product → default. Each resource has two levels, because "a permanent anomaly stops being read": an event threshold ("it's rising"), written once when crossed with an exit margin against flapping, and a stricter anomaly threshold ("it's burning").
| Resource | Event | Anomaly | Exit margin |
|---|---|---|---|
| Temperature | 80 °C | 85 °C | 5 °C |
| Load per core | 2 | 4 | 0.5 |
| Free disk | 15 % | 10 % | 5 % |
| Free memory | 15 % | 5 % | 5 % |
The migration's comment justifies the temperature threshold: Raspberry Pis start throttling around 80 °C; below that, a hot display case is their normal life, not an event. One rule came out of it: the declared inventory stays in Git; per-machine operating settings go in the database.
Monitoring that lies costs more than no monitoring
The sentence comes from the roadmap, and it drove a whole batch of fixes: "Monitoring that displays false information costs more than no monitoring at all." Two examples:
- Console load. The fleet list weighed 176 KB for 146 nodes (around 360 KB at 300), and it was recomputed twice per refresh and per browser. This kind of debt reveals itself as "a VPS that crawls on an opening morning — the worst moment." Today a single shared snapshot (at most 5 s old) serves everyone, and filtering and paging happen in the API.
- Restart loops. In October, a
Restart=alwaysservice on a Donut Quiz server had restarted 4,655 times without vigie showing it: as far as systemd was concerned, it was "active". Containers stuck restarting are flagged, but reportingNRestartsfor systemd units is the next step.
The console
The console is a FastAPI application with PostgreSQL and vanilla JavaScript, no framework, refreshed over SSE. The front end fits in three files, on purpose: "the console stays three files you can read end to end." It covers the fleet, anomalies, events, the video wall, SSH access, assistants, nodes, certificates and users.
Permissions rest on four roles (admin, lead, operator, read-only). Routes name permissions, never roles; a route that declares none prevents the service from starting. An account can be limited to some sites, every action is logged before it runs, and a machine can be put to sleep (24 h by default, 30 days at most) so it doesn't clutter the anomalies while a room is closed.
Acting remotely without ever connecting to the machines
Monitoring isn't enough: you need to read logs, restart a service or a machine. The constraint is strict: the server never connects to an edge point. So actions are pulled orders:
- an order waits in the database;
- the response to the machine's next report carries it (a 200 with
{"orders": […]}instead of a 204); - the machine runs it and posts the result, identified by its tailnet address, so it can only answer its own orders.
Order kinds form a closed list: read logs, restart a unit, restart a container, reboot or shut down the machine, and a few room actions. There are plenty of safeguards:
- arguments are checked on both sides: declared units only, a closed list of containers per product, never a free-form command;
- an action order expires after 2 minutes without an answer, and only one action at a time per machine;
- rebooting a machine requires typing its name, and an order is never run twice;
- a reboot answers first, then runs one minute later (
shutdown -r +1), so the result gets back; - the agent refuses to act unless it runs as root: a test once really rebooted its author's laptop.
These actions are allowed during opening hours: that's precisely when a room needs them. Automatic updates, once they exist, are what will be confined outside opening hours.
SSH: 16-hour certificates
For interactive access, vigie doesn't install keys on the machines: it signs SSH certificates with an authority that lives on the VPS. A certificate lasts 16 hours, "a working day and its overtime." Signing happens in a separate container reached over a Unix socket: the web application never holds the key.
From the console, an operator registers their public key once, then requests access from a node's page. They get a certificate limited to that node, with the ssh command ready to copy. Admins can get a certificate valid for the whole fleet.
Why certificates rather than keys pushed to the machines? Because "a key removed by push stays on a machine that was off." With certificates, revoking means stopping signing, and a still-valid certificate is cut off by expiring the person's VPN node.
Rollout had to cope with the fleet's heterogeneity. Every OpenSSH version present accepts certificates (7.9 and up), but Debian 10's doesn't know the Include directive, and an Include line makes it reject the whole file. So the ssh-trust command writes either an extra configuration file or a marked block at the top of sshd_config. It validates with sshd -t, rolls back on refusal, replaces files atomically, and reloads sshd rather than restarting it. During rollout, 42 kiosks had an /etc owned by the pi user, which makes sshd reject any principals file: ssh-trust now refuses and prints the chown command that fixes it. The authority is in service on 137 machines.
Changing a Pi's OS remotely
Some of our franchises' Pis still run 32-bit Raspbian 10 (armhf). A distribution upgrade keeps the architecture, while our target is Debian 13 on arm64. So the SD card has to be rewritten… with nobody on site.
The vigie-reflash tool does it in six steps:
- a read-only probe checks that the root is on an SD card and that the machine has enough RAM,
sysrq,chrootand a decompressor; - on the workstation, the image is prepared (configuration injected into the FAT boot partition) and recompressed in a format the target can read;
- the image is copied into
/dev/shmand its SHA-256 is checked; - a mini-system is built in RAM:
sh,dd,syncand the decompressor, with their libraries; - a dress rehearsal runs inside the
chrootbefore the point of no return; - the filesystem is remounted read-only (
sysrq u), then the image is written withddfrom RAM, synced, and the machine reboots (sysrq b). Nothing is read from the card being overwritten.
A real write requires confirming the current hostname, --dry-run sends nothing, and the machine doesn't reboot if the write fails. First success on our test bench: a Pi 4 moved from Raspbian 10 armhf to Debian 13 arm64 with the kiosk image, with no physical intervention. The tool is still experimental: the machine comes back without a VPN node, and has to be reached through another machine on the same local network.
Shipping: two Debian packages and a frugal CI
vigie ships the way it deploys: as Debian packages, vigie for the server and vigie-edge for the machines, both Architecture: all. Every design rule has a story:
- no manual step:
apt install ./package.debmust be enough.yqwas dropped forpython3-yamlbecause "two incompatible tools share that name, and the one Ubuntu packages is the wrong one — the read would have been silently wrong"; - dpkg maintainer scripts do no networking and start nothing: installing a package on a machine in operation has no visible effect. The Tailscale client is installed by enrollment, not by the package (dpkg holds its lock during
postinst); --dry-runon every action that changes state, and error messages that give the fixing command: "The users of these scripts are often mid-incident";- xz compression: Ubuntu's default zstd compression couldn't be read by Debian 10's dpkg.
CI is deliberately frugal (free GitHub plan): no cache, no workflow artifacts, a single job. A v* tag builds both packages and publishes a GitHub release whose notes are the first section of the CHANGELOG, extracted with one line of awk. The server package also embeds the edge package of the same version.
The next big piece of work is an internal APT repository (aptly): develop, staging and main channels, GPG-signed, the channel each site follows described in the inventory, and an update on the night from Sunday to Monday, at "a time drawn at random per machine", limited to an explicit list of packages. "Never a system upgrade at the same time."
The video wall
Each room has its own camera hub (3 to 4 cameras per room). vigie doesn't replace it: it relays a few routes read-only (the camera list, a still frame, a live video stream), and the browser never reaches the hub directly. Stills are refreshed every 10 s and cached for 5 s, and a single call goes to the room however many people are watching. Live views are capped per site and stop after 10 minutes. Nothing else is relayed: no camera control, no captures, no admin.
To develop the wall without depending on the real fleet, the repository has a local bench: the real API, plugged into a fake Headscale and fake hubs streaming test patterns, with one pre-seeded account per permission acceptance case.
Operational knowledge, and AI
A knowledge base, not someone's memory
A tool isn't enough: you need to know what to do with it. From two months of interventions I built a maintenance knowledge base in plain Markdown: 58 symptoms, 27 procedures and one sheet per site. The goal: fixing a room shouldn't depend on a single person.
Every ticket starts with the same reflexes: find the real time of the game (the time reported is often wrong), go in directly over the VPN, read the logs before the code, and never act on a room during a game. For that last point, the simplest test depends on no API at all: listen for a few seconds to the room's MQTT countdown topic.
sudo docker exec maestro-mqtt-1 mosquitto_sub -t /timer -C 1 -W 8
Seconds remaining: a game is on. A timeout: the room is free.
Actions are sorted into three levels: read-only diagnosis is free; restarting, re-arming the emergency system after an alarm, or unblocking a room's state requires explicit confirmation; changing code, building a package or migrating a room is forbidden within that framework.
An MCP server that doesn't trust the prompt
The next step was to wire that knowledge into vigie as a maintenance MCP server usable from Claude. The request was demanding: non-technical people with rights on sites A and B must be able to describe a fault and be guided through it, but never be able to break a room, and be able to do nothing on site C, "even when trying to jailbreak: we do not rely on the system prompt alone to block access."
Before building anything, we classified the knowledge base's 58 symptoms:
| What fixes the symptom | Symptoms |
|---|---|
| A closed action the MCP can run | 20 |
| Diagnosis only | 8 |
| Someone on site | 10 |
| A code change or new feature | 16 |
| A decision by the technical lead | 4 |
The MCP helps diagnose 53 of them; plain restarts cover about 7. The value is in the diagnosis, not in the restarts.
The server exposes 24 tools, annotated read-only or destructive: list sites and nodes, read logs, a room's state and its electronics board, a camera frame, search the knowledge base, open and close an intervention case, prepare and run an action. Every safeguard is server-side:
- each call re-reads the account and its rights; a node, room, camera or button on another site answers "not found", without revealing that it exists;
- parameters are resolved against the inventory and the last report, and the machine re-checks its own closed lists;
- an action takes two calls:
prepare_actionreturns a summary in French and a token valid for 5 minutes, thenexecute_actionruns it; - at execution time, the machine itself checks that no game is in progress; an unreadable state blocks too, and overriding requires a reason, which is logged;
- at most 3 restarts per target per hour.
One of the tests is called test_a_prompt_injection_corpus_never_reaches_a_machine_outside_the_closed_lists. That name sums up the philosophy: assume the model can be manipulated, and make sure it doesn't matter.
Testing an operations tool
vigie has 683 tests in 42 suites, discovered automatically by area (core, VPN, SSH, console, edge, access, packaging). They need only bash, coreutils and Python, and start nothing. A sandbox simulates a field machine and records every call, which makes it possible to assert that a command was not run. The enrollment suites, for example, check that every security option is passed to tailscale up and that --reset never is. The vigie-edge package even has a test checking that it installs offline.
What's left
The roadmap is written down and kept up to date. Delivered: the VPN and its partitioning, the console, monitoring at scale, the SSH authority, permissions, remote actions, the video wall, the server move. Still to come, among others: the APT repository and scheduled updates, reporting systemd restarts, fine-grained certificate revocation, disk hardware health, and managing franchise cameras.
What I take away from it
- Measure time to repair, not the number of tools. Everything else follows.
- An operations tool must never cause an outage. Additive, reversible, no effect on install: the hostname incident taught us what forgetting that costs.
- Silence is information. With push, a machine that's off makes nobody wait; its absence is the signal.
- Identity comes from the network, not from distributed secrets. A VPN that guarantees the source address beats a store of 300 tokens.
- The server never connects to the machines. Orders are pulled, results are posted, and a compromised server doesn't become a way into every room.
- Deciding stays human. vigie diagnoses, alerts and suggests the command; it doesn't fix anything on its own.
- Monitoring that lies costs more than no monitoring. An invisible restart loop, a list that crawls: every lie gets paid for on an opening morning.
- Safeguards live in the server, not in the prompt. With an AI assistant as with a human in a hurry.
A good operations tool fades into the background. When a room won't start on a Saturday morning, the operator opens the console, sees what's wrong and gets the command that fixes it. The rest of the time, vigie just listens to the fleet breathe, one minute after another.