Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sapcc/fedipa

minimal build of ironic-python-agent created with systemd/mkosi and dracut (fedora based)
https://github.com/sapcc/fedipa

fedora ironic ironic-python-agent openstack python3

Last synced: 11 days ago
JSON representation

minimal build of ironic-python-agent created with systemd/mkosi and dracut (fedora based)

Awesome Lists containing this project

README

        

# fedIPA

## Description

Based upon Fedora this tooling creates with mkosi
- a standard kernel of the OS
- a ramdisk which is enabled to download and boot a rootdisk via HTTPS
- and a squashfs file, which contains the ironic-python-agent

See [mkosi](https://github.com/systemd/mkosi/blob/main/mkosi.md) for
more details on the build-process.

`mkosi.build` takes the (python) sources (ironic-python-agent and extensions,
which are referenced as submodules as input and generates wheels
into the destination image.

The submodules under sources as well `mkosi` and the `requirements`
should capture the exact versions in each commit used.

`mkosi` then generates the output under `mkosi.output/*/`
(`*` depends on the distribution and version chosen)
More specifically:
- `image/`: the directory containing the final image file-system, including the ironic-python-agent + extensions
- `image.vmlinuz`: the (unmodified) kernel of the operating system
- `image.initrd`: the ramdisk as generated by dracut

On top of that, we use `mksquashfs` to generate a `image.squashfs` file
from the `image/` directory.

## Requirements

* git
* python3 >= 3.5
* systemd-nspawn
* dnf
* make
* squashfs-tools
* ovmf
* lighttpd (for testing)
* qemu-kvm (for testing)
* xorriso (for iso creation)

## HowTo

You can simply run the following commands to create the desired output:
```shell
if [ -f /etc/debian_version ]; then
sudo apt install dnf git python3 make systemd-container qemu-kvm lighttpd lighttpd-modules-lua squashfs-tools ovmf
else
sudo dnf install git python3 make systemd-container qemu-kvm lighttpd squashfs-tools xorriso edk2-ovmf
fi
make
```

### How to modify the contents of the image

#### Packages
If packages need to be available during the build they need to be added to the list of `BuildPackages` in [mkosi.files/mkosi.fedora](https://github.com/sapcc/fedIPA/blob/master/mkosi.files/mkosi.fedora),
if they should be in the final image, they need to be under `Packages`.

#### Files

Any file placed under `mkosi.extra` will be placed in the image.
Files/Directories can be removed by adding a glob-expression to `squashfs.exclude`

### How to configure the ramdisk

The whole configuration for the ramdisk is within `mkosi.extra/etc/dracut.conf.d/99-ipa.conf`.
As all files under `mosi.extra` also are added to the build image before the ramdisk
is being created, it serves as the configuration for the build-process.

In particular, you can add/remove kernel-modules / filesystems etc...

### How to develop/debug

If you run `make test`, it will generate all the files mentioned before,
and start a virtual machine with qemu which will boot the generated
kernel and ramdisk, which in turn will load via http the `image.squashfs`.
A http server will serve the generated files, and a mock api server
will be answering the `lookup` and `heartbeat` api calls.

The virtual machine exposes the ironic-python-agent api over port 9999
on the local host.

The api discovery is returning an api-version, which is not secured
by either certificate or token, so you should be able to issue http request /
command with the tool of your choice.