homelab infrastructure services
Machine Registry#
The machine registry is a simple key-value mapping that assigns machine numbers to machine names within a sheet.
Location#
The machine registry is stored in the sheet station NFS export:
- Production:
/volume1/{sheet}/station/prod/machines - Test:
/volume1/{sheet}/station/test/machines
Implementation: The machine registry is automatically created by machine/scripts/setup_station.sh:create_machine_registry() during the machine setup process. This function:
- Scans existing system UIDs to discover deployed machines
- Creates the registry file with proper ownership (station-prod user)
- Populates it with discovered machine mappings
Access Paths:
- NFS location:
/volume1/{sheet}/station/prod/machines - Local mount:
/mnt/station-prod/data/machines(accessed bylib/uid.sh:calculate_machine_uid()) - XDG access:
~/.local/share/{sheet}/@station/machines
Format#
The registry uses a simple key=value format, one machine per line:
# Example Machine Registry for a sheet
# Format: machine_name=machine_number
# Machine 0 is reserved for station (sheet infrastructure)
gazette=1
lldap=2
redis=3
prometheus=4
grafana=5
Rules#
- Machine 0 is reserved for the sheet station (infrastructure)
- Machine names must be lowercase alphanumeric with hyphens allowed
- Machine numbers must be unique within a sheet (1-99)
- Comments start with
#and are ignored - Empty lines are ignored
Usage#
Reading the Registry#
Machines and tools read the registry to determine their machine number:
# Get machine number for 'lldap' in topsheet
machine_num=$(grep "^lldap=" /volume1/topsheet/station/prod/machine-registry | cut -d= -f2)
Adding a New Machine#
- Edit the registry file on the NAS
- Add a new line with the next available machine number
- Ensure no conflicts with existing machines
Example Workflow#
# SSH to NAS
ssh admin@nas.local
# Edit registry for topsheet
sudo vi /volume1/topsheet/station/prod/machine-registry
# Add new machine
echo "caddy=6" >> /volume1/topsheet/station/prod/machine-registry
Integration with tinsnip#
The lib/uid.sh script automatically consults the machine registry when calculating UIDs:
- If machine name is "station", use machine number 0
- Otherwise, check the registry file
- If not found in registry, auto-assign next available number
- If still not found, return an error
Future Enhancements#
The station machine (M=0) could eventually provide:
- REST API for machine registration
- Web UI for registry management
- Machine discovery endpoints
- Port allocation tracking