Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 26 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
The builder of the RTE images an [AnsibleForms](https://github.com/ansibleforms/ansibleforms) controller defines, written in Go.
It joins the controller, builds each image the Designer asks for with BuildKit, and pushes it to its registry.

The [AnsibleForms Installer](https://github.com/ansibleforms/installer) sets it up: run it on a Linux server and choose the Builder role.

```bash
docker run -d --name af-builder \
--security-opt seccomp=unconfined --security-opt apparmor=unconfined \
-e CONTROLLER_URL=https://forms.example.com -e RTE_TOKEN=<at least 16 characters> \
-e RTE_JOIN_TOKEN=<a join token from the Designer's RTE builders> \
-v af-builder:/home/node/work ghcr.io/ansibleforms/ansibleforms-rte-builder
curl -fsSL https://ansibleforms.com/install | sh
```

## Features
Expand All @@ -30,40 +28,29 @@ The controller decides what to build; the builder builds it, and knows nothing e

## How it works

The RTE images are defined in the controller's Designer, which writes each one's Dockerfile.
A build is a job: the controller hands it to a builder that is online, with the Dockerfile, the reference to push to,
and the registry login and signing key sealed for that builder; the build's log and result come back as the job's.

A runtime environment's `arch` says what it is built for: `amd64`, `arm64` or `all`, one image for both.
The host's own architecture is built natively; the other one is emulated, slower, and needs QEMU registered on the host once:
`docker run --privileged --rm tonistiigi/binfmt --install all`. Without it, such a build stops and says so.

The builder and the controller meet over the controller's runner socket, at a version of its contract.
A builder works with every controller that speaks the same contract, whatever their releases.

## Rootless Podman

Under rootless Podman the builder runs as the container's root, which starts its buildkitd directly instead of through rootlesskit:

```bash
podman run -d --name af-builder --user 0 --privileged \
--security-opt seccomp=unconfined --security-opt apparmor=unconfined \
-e CONTROLLER_URL=https://forms.example.com -e RTE_TOKEN=<at least 16 characters> \
-e RTE_JOIN_TOKEN=<a join token from the Designer's RTE builders> \
-v af-builder:/home/node/work ghcr.io/ansibleforms/ansibleforms-rte-builder
```

A rootless container already lives in a user namespace, where rootlesskit cannot map the image's subordinate ids again.
Its root is the host user's own unprivileged id, and `--privileged` grants capabilities only inside that user's namespace,
so the container gets no more on the host than the user who runs it already has. The builder sees it in `/proc/self/uid_map`.

Its buildkitd then uses the `overlayfs` snapshotter on the work volume; `BUILDKIT_SNAPSHOTTER` names another one
(`native` works anywhere but is slow, `fuse-overlayfs` needs `--device /dev/fuse`). Docker and rootful Podman run it as before.

## Versions

Each AnsibleForms release publishes [`ansibleforms-rte-builder`](https://github.com/ansibleforms/builder/releases) at the same version, for amd64 and arm64.
A builder needs a controller that hands builds to builders (AnsibleForms 7.9.0 and later); [CHANGELOG.md](CHANGELOG.md) lists its own changes.
The controller's Designer defines the RTE images; the builder builds each one as a job:

- **Defined in the Designer:** it writes each runtime environment's Dockerfile
- **A build is a job:** handed to an online builder, its log and result coming back as the job's
- **Sealed secrets:** the registry login and the signing key come sealed for that builder only
- **Architectures:** `amd64`, `arm64` or `all`; the one that is not the host's is emulated with QEMU
- **Any release:** it works with every controller that speaks the same socket contract

## Documentation

The builder's reference lives on [ansibleforms.com](https://ansibleforms.com), with the rest of the AnsibleForms documentation:

| Page | What it covers |
|---|---|
| [The installer](https://ansibleforms.com/installation/installer.html#a-builder) | Installing a builder with the installer's Builder role |
| [Installing it](https://ansibleforms.com/rte/builder.html#installing-it) | The installer, Helm or by hand, and what each needs |
| [Joining the controller](https://ansibleforms.com/rte/builder.html#joining-the-controller) | A join token, or an admin's approval under Connections > Builders |
| [Docker](https://ansibleforms.com/rte/builder.html#docker) | Running it by hand with `docker run`, or as a Docker Compose service |
| [Podman](https://ansibleforms.com/rte/builder.html#podman) | Running it on Podman, rootful or rootless, and `BUILDKIT_SNAPSHOTTER` |
| [amd64 and arm64](https://ansibleforms.com/rte/builder.html#amd64-and-arm64) | Building for the other architecture, with QEMU on the host |
| [Kubernetes with Helm](https://ansibleforms.com/installation/kubernetes.html#a-builder-on-kubernetes) | Installing it with the AnsibleForms chart's builder mode |
| [Settings](https://ansibleforms.com/rte/builder.html#settings) | Every environment variable it reads, and its default |
| [Troubleshooting](https://ansibleforms.com/rte/builder.html#troubleshooting) | What a failed build or a refused push usually means |

## Contributing

Expand Down