pi-register (a register of the services on a Linux server)
pi-registeris a small Rust command-line tool that reads a hand-kept list of the services a Debian/Ubuntu systemd machine runs and why, and compares it with what systemd reports. The trackedregister.tomlis a generic example only. It is an operations tool that supports Sovereign Intelligence (SI), the whole system; AienOS is the operating-system layer and Aienux is the AienOS kernel. The tool is not part of Sovereign Intelligence itself. Shared rules: read https://www.aienos.com/agents/RULES.md first. This file adds what is specific to this repository; where the two differ, this file wins here.
Scope
- Applies to the whole repository:
src/main.rs(the whole program, unit tests included),register.toml,Cargo.toml,Cargo.lock. - Keep
register.tomlgeneric. Real inventories belong in ignoredregister.local.tomlor/etc/pi-register/register.toml, never tracked files. .crumbis compiled crumb metadata. Do not edit it by hand..crumb.localis local-only and ignored by git.- CI (
.github/workflows/ci.yml) runscargo build --locked --all-targetsandcargo test --lockedon every pull request and push tomain. Checks against a live systemd machine stay local.
Installation
git clone https://github.com/aien-dev/pi-register.git
cd pi-register
cargo build --release
Needs a stable Rust toolchain. Dependencies are clap, serde and toml. The binary is target/release/pi-register.
Configuration
- Register location:
--register <path>, else/etc/pi-register/register.toml, else./register.toml. - The ignored
register.local.tomlrequires an explicit--register register.local.toml; it is not an automatic fallback. Preserve an existing deployment's full register privately before updating, then migrate checkout-path callers or install it at the existing/etcdefault. See README for the migration procedure. - Each service is a
[[service]]table. Required fields:name,purpose,unit,category,owner,boot. Optional:port,depends_on,files,secrets,health,notes. - A
unitwithout a suffix means<unit>.service; write.timer,.socketand other suffixes in full. secretsholds a path only, never a secret value.healthis a shell command that exits 0 when the service is healthy. It runs throughsh -cwith the caller's privileges.depends_onandfilesare recorded and shown, not enforced. A name that appears twice is a load error.
Usage
# Unit tests (no systemd access needed)
cargo test
# Help for every command
./target/release/pi-register --help
# Markdown page describing the machine; reads the register only
./target/release/pi-register --register register.toml doc
Commands that touch the live machine. Run them only on the server the register describes, never on a development host:
pi-register status: every service with its active state, boot state and health. Callssystemctland runs everyhealthcommand.pi-register show <name>: everything known about one service, plus its live state and health.pi-register check: every registered unit must exist; enabled service units missing from the register are listed as UNREGISTERED. Exits non-zero on any problem.pi-register start|stop|enable|disable <name>: wrapssystemctl; names not in the register are refused. These change the machine and usually need root.
Conventions
- One source file,
src/main.rs. Tests live in its#[cfg(test)]module; add one when a parsing or validation rule can regress silently. pi-registeritself makes no network calls. Keep it that way; network access belongs in a service'shealthcommand.- Base-system units that
checkignores come from a built-in list insrc/main.rs. Extend that list rather than registering base-system units. - Keep
README.mdin step with the commands and fields the code accepts.
Safety and approvals
- Never run
status,show,check,start,stop,enableordisableagainst the example register on a machine it does not describe:statusandshowexecute the register'shealthcommands, and the control commands change systemd state. - Ask before running
start,stop,enableordisableon the real server, and before changing anybootvalue. Some entries are deliberately left stopped or disabled; theirnotessay why. - Never put secret values, tokens, keys, private network addresses, internal hosts, personal home paths or deployment inventories in tracked files. Keep names and attribution intact.
- Work on a branch and merge through a pull request with the
cargo testresult in its body.
Further reading
README.md: field reference and command list.register.toml: a generic worked example, never the live inventory.- https://github.com/aien-dev/sovereign-intelligence: the integration, release and install center of Sovereign Intelligence (SI), where the signed Spark test runs.