developers · guide · shipped
guide-07
01about
Chapter 7 of 12 -- An immutable Linux built for machines where software writes software. Your agent becomes three lines in a Dockerfile.
About 45 minutes. Read online: https://aitherium.github.io/awknowledge/path/07-deploy-on-awnix.html
What "immutable" means
An immutable Linux is one where /usr — the folder containing all system software — cannot be changed at runtime. A traditional computer is like a notebook: you write in it, erase things, write over them. An immutable system is like a printed book: the words never change by hand, and the only way to make a new version is to print a new book and keep the old one.
Every time your agent runs code that changes the system — installs a package, updates a config, patches a binary — that change becomes a NEW IMAGE. You can compare the two, see exactly what changed, and if something went wrong you can bootc rollback back to the printed book you trusted.
Cloud-init makes key-only login actually usable
An awnix machine has NO PASSWORD. Access is by SSH key only. You might think that sounds impossible — what if you lose the key? The answer is cloud-init: a service that runs once on first boot and injects whatever SSH keys you tell it to. On a cloud image you launched, your launch keypair arrives automatically. On bare metal you place a key yourself. Either way, nobody ever types a password, which means there is nothing to leak.
Two things must be true together or the whole idea breaks:
- cloud-init must run and inject the key
- NOPASSWD sudo must be enabled, so the account can administer the box without a password (the same setup
ec2-userandubuntuuse)
What bootc does
bootc — the bootable container system — moves a container image from podman run to bare metal. You build an image on your laptop, push it to a registry, and a machine boots it directly. Every boot is atomic: the system either completes or rolls back, never a partial state. An update that goes wrong is bootc rollback, not an afternoon of recovery.
The aw tools are preinstalled
awnix ships 19 of the aw* tools ready to import: awgit (leases), awgraph (call graphs), awrelay (messaging), awseal (signing), and 15 others. Your agent does not have to install them — they are already there. That is the point of a base image: the guarantees are built in, and every agent on top gets them for free.
Layering an agent on top
An agent is three things:
- The awnix base (immutable, atomic updates, built-in tools)
- awdk — the agent runtime
- Your skills, packs and credentials
A Dockerfile that layers on top looks like:
FROM awnix:latest
RUN pip3 install --no-cache-dir awdk
#... your packs and credentials
The base is read-only. Your agent runs as a service (using the unit template in the awnix repo), and when it needs a new version, you rebuild the image and bootc upgrade.
DO
- $ git clone https://github.com/Aitherium/awnix you should see: a folder named awnix with a Containerfile inside if not: Install git (git-scm.com) and open a new terminal.
- $ cd awnix you should see: your prompt shows the awnix folder; the build below runs here if not: The Containerfile is in this folder; the build must run from inside it.
- $ podman build -t awnix:latest -f Containerfile .
you should see: an image named awnix:latest, built from the awnix repo you cloned
if not: Install podman (or Docker -
docker buildworks the same). Clone https://github.com/Aitherium/awnix first and run this inside it. - $ podman run --rm awnix:latest awgit --version you should see: a version - proof the aw* tools are preinstalled in the base if not: If the command is not found inside the image, the build used a different Containerfile. Rebuild from the repo root.
- (optional) $ bootc status you should see: on a machine BOOTED from the image: the running image and the rollback target if not: Only meaningful on a box that booted from awnix (the ISO or a cloud image). Inside a container it is absent, and that is expected.
- (optional) $ curl -fsSL https://raw.githubusercontent.com/Aitherium/awnix/main/awnix-aws-ami.sh | sh -s -- --region us-east-1 you should see: an AMI id, its snapshot id, and a ready aws ec2 run-instances command if not: Add --dry-run to see every AWS command without calling AWS. The script needs the aws CLI, credentials, podman or docker, and about 20 GiB free; it creates the bucket and the vmimport role itself.
done when: $ podman run --rm awnix:latest awgit --version you should see: a version string
WHAT YOU LEARNED
- Immutable means /usr cannot change at runtime; every change is a new image you can diff and roll back.
- No password exists on the box; keys only. NOPASSWD sudo is what makes key-only login usable.
- Your agent layers ON TOP (FROM awnix, pip install awdk, add your pack) - the guarantees stay in the base.