Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 11. Creating and managing OSTree image updates
You can easily create and manage OSTree image updates for your RHEL for Edge systems and make them immediately available to RHEL for Edge devices. With OSTree, you can use image builder to create RHEL for Edge Commit or RHEL for Edge Container images as .tar files that contain OSTree commits. The OSTree update versioning system works as a “Git repository” that stores and versions the OSTree commits. The rpm-ostree image and package system then assembles the commits on the client device. When you create a new image with RHEL image builder to perform an update, RHEL image builder pulls updates from these repositories.
11.1. Basic concepts for OSTree Copier lienLien copié sur presse-papiers!
Basic terms that OSTree and rpm-ostree use during image updates.
rpm-ostree-
The technology on the edge device that handles how the OSTree commits are assembled on the device. It works as a hybrid between an image and a package system. With the
rpm-ostreetechnology, you can make atomic upgrades and rollbacks to your system. - OSTree
- OSTree is a technology that enables you to create commits and download bootable file system trees. You can also use it to deploy the trees and manage the boot loader configuration.
- Commit
- An OSTree commit contains a full operating system that is not directly bootable. To boot the system, you must deploy it, for example, with a RHEL Installable image.
- Reference
It is also known as
ref. An OSTree ref is similar to a Git branch and it is a name. The following reference names examples are valid:-
rhel/9/x86_64/edge -
ref-name -
app/org.gnome.Calculator/x86_64/stable -
ref-name-2
-
By default, RHEL image builder specifies rhel/8/$ARCH/edge as a path. The "$ARCH" value is determined by the host machine.
- Parent
-
The
parentargument is an OSTree commit to build a new commit with RHEL image builder. It retrieves a parent commit for the new commit that you are building. You can specify the parent commit as arefvalue to be resolved and pulled, for examplerhel/8/x86_64/edge. You can also use theCommit IDthat you can find in the extracted.tarimage file. - Remote
- The http or https endpoint that hosts the OSTree content. This is analogous to the baseurl for a yum repository.
- Static delta
- Static deltas are a collection of updates generated between two OSTree commits. This enables the system client to fetch a smaller amount of files, which are larger in size. The static deltas updates are more network efficient because, when updating an ostree-based host, the system client will only fetch the objects from the new OSTree commit which do not exist on the system. Typically, the new OSTree commit contains many small files, which requires multiple TCP connections.
- Summary
- The summary file is a concise way of enumerating refs, checksums, and available static deltas in an OSTree repo. You can check the state of all the refs and static deltas available in an Ostree repo. However, you must generate the summary file every time a new ref, commit, or static-delta is added to the OSTree repo.
11.2. Creating OSTree repositories Copier lienLien copié sur presse-papiers!
You can create OSTree repos with RHEL image builder by using either RHEL for Edge Commit (.tar) or RHEL for Edge Container (.tar) image types. These image types contain an OSTree repo that contains a single OSTree commit.
-
You can extract the
RHEL for Edge Commit (.tar)on a web server and it is ready to be served. -
You must import the
RHEL for Edge Container (.tar)to a local container image storage or push the image to a container registry. After you start the container, it serves the commit over an integratednginxweb server.
Use the RHEL for Edge Container (.tar) on a RHEL server with Podman to create an OSTree repo:
Prerequisites
-
You created a
RHEL for Edge Container (.tar)image.
Procedure
Download the container image from RHEL image builder:
composer-cli compose image <UUI>
$ composer-cli compose image <UUI>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Import the container into Podman:
skopeo copy oci-archive:<UUI>-container.tar containers-storage:localhost/ostree
$ skopeo copy oci-archive:<UUI>-container.tar containers-storage:localhost/ostreeCopy to Clipboard Copied! Toggle word wrap Toggle overflow Start the container and make it available by using the port
8080:podman run -rm -p 8080:8080 ostree
$ podman run -rm -p 8080:8080 ostreeCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Check that the container is running:
podman ps -a
$ podman ps -aCopy to Clipboard Copied! Toggle word wrap Toggle overflow
11.3. Managing a centralized OSTree mirror Copier lienLien copié sur presse-papiers!
For production environments, having a central OSTree mirror that serves all the commits has several advantages, including:
- Deduplicating and minimizing disk storage
- Optimizing the updates to clients by using static delta updates
- Pointing to a single OSTree mirror for their deployment life.
To manage a centralized OSTree mirror, you must pull each commit from RHEL image builder into the centralized repository where it will be available to your users.
You can also automate managing an OSTree mirror by using the osbuild.infra Ansible collection. See osbuild.infra Ansible.
To create a centralized repository you can run the following commands directly on a web server:
Procedure
Create an empty blueprint, customizing it to use "rhel-94" as the
distro:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the blueprint to the server:
composer-cli blueprints push minimal-rhel94.toml
# composer-cli blueprints push minimal-rhel94.tomlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Build a RHEL for Edge Commit (
.tar) image from the blueprint you created:composer-cli compose start-ostree minimal-rhel94 edge-commit
# composer-cli compose start-ostree minimal-rhel94 edge-commitCopy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the
.tar fileand decompress it to the disk:composer-cli compose image _<rhel-94-uuid> tar -xf <rhel-94-uuid>.tar -C /usr/share/nginx/html/
# composer-cli compose image _<rhel-94-uuid> $ tar -xf <rhel-94-uuid>.tar -C /usr/share/nginx/html/Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
/usr/share/nginx/html/repolocation on disk will become the single OSTree repo for all refs and commits.Create another empty blueprint, customizing it to use "rhel-810" as the
distro:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Push the blueprint and create another RHEL for Edge Commit (
.tar) image:
*composer-cli blueprints push minimal-rhel810.toml* *composer-cli compose start-ostree minimal-rhel810 edge-commit*
# *composer-cli blueprints push minimal-rhel810.toml*
# *composer-cli compose start-ostree minimal-rhel810 edge-commit*
Retrieve the
.tar fileand decompress it to the disk:composer-cli compose image <rhel-810-uuid> tar -xf <rhel-810-uuid>.tar
# composer-cli compose image <rhel-810-uuid> $ tar -xf <rhel-810-uuid>.tarCopy to Clipboard Copied! Toggle word wrap Toggle overflow Pull the commit to the local repo. By using
ostree pull-local, you can copy the commit data from one local repo to another local repo.ostree --repo=/usr/share/nginx/html/repo pull-local repo
# ostree --repo=/usr/share/nginx/html/repo pull-local repoCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Inspect the status of the OSTree repo. The following is an output example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the RHEL 9.4 blueprint to include a new package and build a new commit, for example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the updated blueprint and create a new RHEL for Edge Commit (
.tar) image, pointing the compose to the existing OSTree repo:composer-cli blueprints push minimal-rhel94.toml composer-cli compose start-ostree minimal-rhel94 edge-commit --url http://localhost/repo --ref rhel/9/x86_64/edge
# composer-cli blueprints push minimal-rhel94.toml # composer-cli compose start-ostree minimal-rhel94 edge-commit --url http://localhost/repo --ref rhel/9/x86_64/edgeCopy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the
.tarfile and decompress it to the disk:rm -rf repo composer-cli compose image <rhel-94-uuid> tar -xf <rhel-94-uuid>.tar
# rm -rf repo # composer-cli compose image <rhel-94-uuid> # tar -xf <rhel-94-uuid>.tarCopy to Clipboard Copied! Toggle word wrap Toggle overflow Pull the commit to repo:
ostree --repo=/usr/share/nginx/html/repo pull-local repo
# ostree --repo=/usr/share/nginx/html/repo pull-local repoCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Inspect the OSTree repo status again:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow