A registry of the home fleet: what goes down together with this service
121 documentation files described every node, but the dependency graph was not assembled anywhere. How a machine-readable registry appeared, and the three checks that keep it from lying.
By the end of the summer I had accumulated 121 documentation files for the home and the country house. Every node was described in detail: what runs on it, what pitfalls there were, how to fix it.
But this documentation answered simple questions only by rereading:
- what goes down together with this service;
- which ports are already taken on this node;
- where this tool is deployed and under what name.
That is how the registry appeared, which answers such questions right away.
Structure apart from prose
The registry takes the structure of the setup out of the prose: sites, nodes, services, ports, names, dependencies, hardware. History and repair procedures stay in the prose.
I took the model from the data center world, where equipment inventory has long been a solved problem:
registry/
sites/<site>/nodes/ nodes: we run things on them and manage them ourselves
sites/<site>/devices/ devices: on the network, but not managed by us
sites/<site>/power/ utility hardware without a network
networks.yaml segments and names
Only nodes have services. A TV or a vacuum cleaner has, instead of services, what it is controlled by, and a distribution board or a generator has what it consists of.
The main rule: one fact is written in one place. Structure in the registry, prose in the documentation.
What is generated from the registry
From the registry I generate a "what lives where" summary, a dependency diagram with a "what goes down together" table, and a single page with search across the whole fleet.
The page opens with a double click and works without a network: it is needed most often when something is already down. Typing a port, a name or a piece of a title is enough. A click on a service shows what it depends on and what will fall together with it.
Three checks
A registry filled in by hand drifts away from reality over time. So three checks hold it in place:
| Check | What is compared with what | When |
|---|---|---|
| first | the registry and the configuration repositories | automatically, before every commit |
| second | the registry and what is actually running on the nodes | by hand, periodically |
| third | the service tables in the node documentation | generated from the registry |
The first check does not let me commit a new service or name that is missing from the registry, so the registry is updated in the same change, not "later".
The second one is safe by design. It reaches the nodes through a proxy on which all modifying requests are forbidden: it is physically unable to start or stop anything.
What the first run found
The very first run of the second check found five containers on the home server that were not in any documentation file, this blog among them.
This is what it was all done for: the documentation and the live nodes drift apart silently. A container is started, it works, and nobody remembers it until the first incident.
Where the registry is incomplete
The routers did not make it into the live check: containers on them are visible over a different protocol, and for now I compare the list by hand. Some of the services that were found are still without a description. They are in the table, but what they are and what they are for is not written anywhere.
Names turned up that lead nowhere: there is an entry in the documentation, but no such name on the network, and the other way round. Household devices had to be entered in groups based on the router's records, and for some of them I do not know the exact models.
What the registry costs
- it is one more repository that has to be maintained;
- the first check gets in the way. Quickly fixing something and committing no longer works, the registry comes first;
- the second check is run by hand, and so it is easy to forget about;
- the registry describes structure, not state. It does not know whether a service is alive, monitoring is there for that.
Keeping a registry makes sense when there are many nodes and they are on different sites: then it quickly answers the question "what goes down together with this". For a single server one file is enough.
Tags: Architecture, Automation, Documentation, Self-hosting
Read next
Two Home Assistants with nothing between them
The apartment and the country house each got their own Home Assistant with no bridge between them. How one vendor account is split into two homes, why the country house stood without devices for twenty-five days, and what layered diagnostics does about it.
A home event bus: why have one when notifications already exist
One stream of events for the phone, voice and the bot. Why an event describes a fact, not a text, and how the broker died for twelve days unnoticed.
A gateway for local models: device tokens instead of ssh tunnels
An OpenAI-compatible gateway in front of mlx_lm and Ollama on a Mac mini - a token per device, a round-robin queue and the right to switch models.
Comments