Skip to content

osapi install: set up a host with one command, as a chain of osapi's behaviors #1946

Backlog

Description

@retr0h

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 chain

At 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, in intro.md, operate.mdx, concepts.md and components.md.
  • The lab hub uses osapi install when 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

  1. added
    enhancement
    blocked
    on Dec 5, 2026
  2. changed the title [-]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[/+] on Dec 6, 2026
  3. retr0h commented on Dec 6, 2026

    @retr0h
    CollaboratorAuthor

    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:

    sudo osapi install --url https://ops.example.com

    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.

    sudo osapi install --nats --url nats-a.example.com                    # prints a NATS join string
    sudo osapi install --controller --url ops.example.com --nats-join <s> # prints an agent join string
    sudo osapi install --agent --join <s>

    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:

    • This issue: the all-in-one install, its required flags, the --nats, --controller and --agent flags, and their join strings.
    • The config of a component from the cluster, which follows this issue.
    • The install through the controller on remote hosts (fleet install and upgrade), and a topology file that osapi-orchestrator runs, which follow this issue.
  4. retr0h commented on Dec 6, 2026

    @retr0h
    CollaboratorAuthor

    The install chain must also give the agent an ICMP datagram socket. On osapi#1943, osapi agent service install reads net.ipv4.ping_group_range on Linux. When the range does not hold the gid of osapi, it writes /etc/sysctl.d/60-osapi-ping.conf with 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 runs sysctl --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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions