Chapter 7. Managing applications on an edge device
You can deploy, update, or remove applications on a device by updating the list of applications in the device specification. When the Red Hat Edge Manager agent checks in and detects the change in the specification, the agent downloads any new or updated application packages and images from an Open Container Initiative (OCI)-compatible registry. Then, the agent deploys the packages to the appropriate application runtime or removes them from that runtime.
The Red Hat Edge Manager supports the podman-compose tool as the application runtime and format.
For more information, see Building a bootc operating system image for use with the Red Hat Edge Manager.
7.1. Building an application package image Copy linkLink copied to clipboard!
The Red Hat Edge Manager can download application packages from an Open Container Initiative (OCI) compatible registry. You can build an OCI container image that includes your application package in the podman-compose format and push the image to your OCI registry.
Prerequisites
- You must install the Red Hat Edge Manager CLI.
- You must log in to the Red Hat Edge Manager service.
-
Your device must run an operating system image with the
podman-composetool installed.
Procedure
Define the functionality of the application in a file called
podman-compose.yamlthat follows the Podman Compose specification:Create a file called
Containerfilewith the following content:FROM scratch COPY podman-compose.yaml /podman-compose.yaml LABEL appType="compose"
FROM scratch1 COPY podman-compose.yaml /podman-compose.yaml LABEL appType="compose"2 Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Build and push the container image to your OCI registry:
Define the image repository that you have permissions to write to by running the following command:
OCI_IMAGE_REPO=quai.io/<your_org>/<your_image>
OCI_IMAGE_REPO=quai.io/<your_org>/<your_image>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Define the image tag by running the following command:
OCI_IMAGE_TAG=v1
OCI_IMAGE_TAG=v1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Build the application container image by running the following command:
podman build -t ${OCI_IMAGE_REPO}:${OCI_IMAGE_TAG} .podman build -t ${OCI_IMAGE_REPO}:${OCI_IMAGE_TAG} .Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the container image by running the following command:
podman push ${OCI_IMAGE_REPO}:${OCI_IMAGE_TAG} .podman push ${OCI_IMAGE_REPO}:${OCI_IMAGE_TAG} .Copy to Clipboard Copied! Toggle word wrap Toggle overflow
7.2. Specify applications inline in the device specification Copy linkLink copied to clipboard!
Application manifests are specified inline in a device’s specification, so you do not need to build an OCI registry application package.
The inline application provider accepts a list of application content with the following parameters:
| Parameter | Description |
| Path | The relative path to the file on the device. Note that any existing file is overwritten. |
| Content (Optional) | The plain text (UTF-8) or base64-encoded content of the file. |
| ContentEncoding | How the contents are encoded. Must be either "plain" or "base64". Defaults to "plain". |
Example
Inline compose applications can have two paths at most. You must name the first one podman-compose.yaml, and the second (override) podman-compose.override.yaml.
7.3. Deploying applications to a device using the CLI Copy linkLink copied to clipboard!
Deploy an application package to a device from an OCI registry by using the CLI.
Complete the following steps:
Procedure
Specify the application package that you want to deploy in the
spec.applicationsfield in theDeviceresource:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteFor each application in the
applicationssection of the device specification, you can find the corresponding device status information.Verify the status of an application deployment on a device by inspecting the device status information by running the following command:
flightctl get device/<your_device_id> -o yaml
flightctl get device/<your_device_id> -o yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow See the following example output:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow