Repository navigation
Description
osapi install sets up osapi on a new host with one command and no config. It replaces osapi start, which this change deletes.
What the owner wants
- One command installs osapi on a host, as services, with a user for each component.
- The defaults are the FHS paths (Run NATS and the controller as their own users #1945), so a host needs no config to work.
- The install is built from osapi's own behaviors, as a chain. osapi does not use a separate installer script.
- Running it again re-installs: it changes only what drifted, and restarts only the components that changed.
Commands
sudo osapi install # NATS, controller and agent on this host
sudo osapi install --agent --join <string> # an agent that joins a controller
sudo osapi install --dry-run # what it would change
sudo osapi install --restart # also restart each component
sudo osapi uninstall # the reverse chainAt the end, the install prints the URL of the UI, and how to get the first admin token.
Design
The install is a chain of the behaviors that osapi already has:
install -> group add (osapi, osapi-admin, osapi-nats, osapi-controller)
-> user add (osapi, osapi-nats, osapi-controller)
-> file (the FHS directories, the configs, the NATS creds, the enabled list)
-> service (the units of NATS, the controller, the agent, and the broker socket)
-> service enable and start
-> agent join
Each step is idempotent, tested and audited, and the chain records it.
At install time no controller, NATS or broker exists yet. sudo osapi install therefore runs the chain in its own process, and gives the providers a runner that runs as root directly in place of the broker. The person ran it with sudo. After the install, root work goes through the broker.
What the chain gives with no more code:
- Re-install and upgrade: run it again after you replace the binary. It changes only what drifted, and restarts each component whose binary, config or unit changed.
- Uninstall: the reverse chain.
- Dry run and status: the chain in read mode.
- A fleet, later: the same behavior runs through the controller on remote hosts, to install and upgrade agents. Track that in its own issue.
The first step of the design: confirm that the providers can run in process with no agent. The fake host of the tests and the root runner of Deps show that it is likely.
In the same change
- Delete
osapi start, and each page and example that uses it. - Write the quickstart again around
sudo osapi install, inintro.md,operate.mdx,concepts.mdandcomponents.md. - The lab hub uses
osapi installwhen it fits, or say why it does not.
Order
Blocked by #1945 (a user for each component, and the FHS directory layout). Blocked by #1943 through #1945.
🤖 Generated with Claude Code
Activity
[-]Bootstrap an all-in-one host with one command[/-][+]osapi install: set up a host with one command, as a chain of osapi's behaviors[/+]retr0h commentedon Dec 6, 2026
Multi-host install and the config from the cluster (owner, 6 December 2026)
osapi is a config management system, so it installs its own stack across hosts in a native way. A person never writes a config file to connect a component.
The rule: a host needs only a join string. After the component connects to NATS, it reads the rest of its config from the cluster: the URLs, the ports, the namespace, the TLS settings and the behaviors to enable. A local config file holds only what the host must know before it connects, and the install writes that file.
One host:
Only what osapi cannot work out is a flag: the public URL or hostname, for the TLS certificate and the UI. A missing required flag fails before the install changes anything, and the error names the flag.
One component on each host: each install prints the join string for the next one.
A join string holds URLs, CA fingerprints and a one-time credential that expires. It never holds a long-lived password. The receiving component uses it one time to get its own credentials, as the agent join does today.
The cluster config: the controller keeps the config of each component in a KV bucket. A component reads its config there when it starts, and watches it for changes. An admin changes it through the API, the CLI or the UI. The config of an agent can depend on its labels, such as the behaviors to enable.
Split:
--nats,--controllerand--agentflags, and their join strings.retr0h commentedon Dec 6, 2026
The install chain must also give the agent an ICMP datagram socket. On osapi#1943,
osapi agent service installreadsnet.ipv4.ping_group_rangeon Linux. When the range does not hold the gid ofosapi, it writes/etc/sysctl.d/60-osapi-ping.confwith the smallest range that holds the range and the gid, and applies it. It never makes a range smaller. Uninstall removes the file, puts back the range from before, and runssysctl --system. Ubuntu keeps the kernel default,1 0, which holds no group, so without this the Go ping of connectivity fails there. The chain does the same through the sysctl behavior: it reads the range, writes the widened range only when the gid is outside, and removes it at uninstall.