<!-- SPDX-License-Identifier: AGPL-3.0-only -->
# Install Hermitbox

```sh
curl -fsSL https://hbx.sh | sh
```

It runs as your own user on Linux (x86_64 or aarch64), asks nothing, and starts Hermitbox. It prints
the API URL and a key, and saves them privately.

Check that it works:

```sh
~/.local/bin/hermitbox run -- echo hello
```

`hermitbox up --check` prints the plan without changing anything. `--preset user|container|server|node`
overrides what the installer detected.

## How the user preset works

The installer takes the release built for the host's machine. On aarch64, `wasm`, `vm` and the
native process tools are off and say why: their pinned agentOS sidecar, VM bundle and tool bundle
are x86_64's.

An ordinary account gets the user preset without sudo, Docker or a system manager.
The release bundle, signed with the ML-DSA-65 release keys, includes PostgreSQL, RustFS, control, edge, hermitboxd and its
agent. Data, configuration, state and runtime sockets follow absolute XDG paths
below home; defaults are `~/.local/share/hermitbox`, `~/.config/hermitbox`,
`~/.local/state/hermitbox` and `~/.cache/hermitbox-runtime/hermitbox`. An XDG path escaping home
is refused; the runtime falls back below home when `/run/user` is outside it.
The service listens on loopback port 7331, or another free unprivileged port when it is busy. Sandboxes use authenticated path aliases;
a domain is optional. Process isolation requires enforceable Landlock ABI 3. On compatible GNU hosts without it, the user preset selects and reports Wasm instead; explicitly selected unsupported backends are refused.

Where the systemd user manager and noninteractive linger authorization work, hermitbox
installs `~/.config/systemd/user/hermitbox.service` and starts it. Otherwise the command
stays in the foreground and explains how to keep it running after logout. In a
second terminal, run `~/.local/bin/hermitbox run -- echo hello`. New POSIX shell sessions
find `hermitbox` through an installed PATH block; linked, unsafe or read-only shell
profiles are left alone. The absolute command works in the current shell.
Process sandboxes share your UID. Use them for work you trust. The setup summary reports whether
the managed service supports [process memory and CPU limits](https://docs.hermitbox.dev/v0.2.0/process-tier.md#limits).

`hermitbox upgrade` authenticates the latest release and retains state and credentials.
With foreground supervision it stays attached to the upgraded service. Deployment
requirements are retained across user-manager restarts and upgrades; a backend
change requires an explicit data migration.
`hermitbox down` stops the service and its retained compute, keeping data.
`hermitbox down --purge` also removes the managed bundle, configuration, state, cache,
bootstrap, CLI shortcut, exact PATH block and user unit, prints the removed paths and reverses linger
only when this installation enabled it. Save backups before purging.

## Server with root

Point a DNS A record at the server and allow inbound TCP 443 for HTTPS and
certificate validation. The edge needs local TCP ports 80 and 443 for its HTTP and TLS fronts.

```sh
curl -fsSL https://hbx.sh | sudo HERMITBOX_DOMAIN=sandboxes.example.com sh
```

A systemd host gets Docker, nftables, persistent database/object-store Docker volumes,
control/edge units and its enrolled local node. Debian and Ubuntu can install missing
packages automatically; other distributions need Docker and nftables installed and
receive their names before any provisioning. Server sandbox placement requires
private network/PID namespaces and enforced CPU/memory limits. The main daemon's
unit hardening remains in force. The API is available at
`https://sandboxes.example.com` with an automatically renewed certificate. Omit
`HERMITBOX_DOMAIN` to install a local server with loopback port 7331 and path aliases.
Existing domains stay immutable. See
[operations](https://docs.hermitbox.dev/v0.2.0/operations.md) for DNS, TLS, server upgrades and explicit data removal.

## Inside a container

```sh
curl -fsSL https://hbx.sh | sh
```

An ordinary account still gets user. Root in a container gets container, with
managed files under `/opt/hermitbox`, `/etc/hermitbox-local`, `/var/lib/hermitbox` and
`/run/hermitbox-local`. Embedded PostgreSQL drops to its dedicated nonzero UID.
Process confinement must actually pass; missing kernel syscalls cause an actionable
refusal. A mounted Docker socket alone does not establish correct host bind paths
or firewall coverage. Use the server preset on the engine host for image workloads.

## Platform that runs images

```sh
docker run -p 8080:8080 -v hermitbox:/var/lib/hermitbox ghcr.io/hermitbox/hermitbox:0.2.0
```

The same supervisor runs inside the release image. The first key appears once in
its log. Keep the named volume; configure a trusted TLS terminator for remote
access. See [deployment](https://docs.hermitbox.dev/v0.2.0/deploy.md) for Render, external stores and image tiers.

## Node joining a fleet

```sh
export HERMITBOX_JOIN_TOKEN='<fleet token>'
curl -fsSL https://hbx.sh | sudo --preserve-env=HERMITBOX_JOIN_TOKEN HERMITBOX_PRESET=node sh
```

The token stays in the environment, which only the account that set it and root can read; a
token in a command's arguments is visible to every account on the host while the command runs.

The node preset uses the existing root/systemd fleet join. It installs the verifier
and uses the supplied fleet token, verifying the signed daemon/agent bootstrap
independently of the fleet before joining.
The token is an operator credential: keep it out of shell history and CI output.

On first enrollment the node denies all container images by default. To allow selected
images, add `HERMITBOX_NODE_ALLOW_IMAGES='alpine:,registry.example/team/'` beside
`HERMITBOX_PRESET=node` in the command above. Separate entries with commas. Each entry has the same meaning
as one `hermitbox node join --allow-image` value. A repository ending in `:` permits its
tags, a namespace ending in `/` permits images under it, and a complete SHA-256 image
reference permits that digest alone. Repeat enrollment keeps the node’s saved policy.
See [operations](https://docs.hermitbox.dev/v0.2.0/operations.md) for issuing a token and node policy.

Set `HERMITBOX_NO_UP=1` on the installer process to install only the CLI. Preview builds
are signed with a separate ML-DSA-65 identity and cannot replace production release keys.

Local installations use every supported tier by default. To serve one backend, set
`HERMITBOX_RUNTIME` to `container`, `process` or `wasm` when installing. Restarts and
upgrades use the saved runtime, and each workload keeps its chosen tier.
The container tier needs a supported engine running on the same host. Installation inside
a container keeps that tier off. `hermitbox doctor` and `hermitboxd doctor` report tier availability.
