Mender integration

Mender is an open source solution to manage a fleet of targets, including deploying software updates to them, in a reliable manner. This page details the instructions needed to perform an application deployment and update via Mender using the redpesk local builder and the hosted Mender infrastructure, which comprises the Mender-maintained servers.

In addition to requiring your redpesk local builder setup, you will need to open an account on so that you can connect your target there.

Hosted Mender account

The very first step is to proceed over to and follow the instructions there to open an account.

Target setup

The next part of the setup takes place on the target itself, as we will configure the Mender client included in the image to connect to the Hosted Mender servers at The following commands, unless noted, will thus be run in your target SSH connection.

Your account on gave you access to a tenant token. Under the UI, under the top-right menu, ‘My organization’ submenu. Update the one below with yours (no spaces or newlines should be inserted).

tenant token


Next, configure the Mender client to connect to the server:

mender setup \
  --device-type mb-box \
  --hosted-mender \
  --tenant-token $TENANT_TOKEN \
  --retry-poll 30 \
  --update-poll 5 \
  --inventory-poll 5 && \
systemctl enable --now mender-client

The board will then connect to the hosted Mender servers. Go into your account UI and under the ‘Devices’ tab, pick up the new entry corresponding to your board and authorize the device. The inventory information (i.e extended target information) will typically load after 5 minutes.

Base localbuilder setup

Now go into your redpesk local builder SSH shell and perform the following steps.

First, check you are able to login to the Mender server on the commandline. This is done via the /home/devel/bin/mender-cli binary by specifying your account username and password.

mender-cli login --server --username $MENDER_IO_USERNAME --password $MENDER_IO_PASSWORD

You should get a login successful answer.

Artifact generation

All of Mender artifact generation is performed in the redpesk local builder console shell.

The /home/devel/bin/make-mender-artifact script can be used to generate Mender artifacts. Those are special tar archives which Mender uses for deployments to the managed targets.

We will use mustach, a sample application, to demo a typical Mender application deployment. Please follow the standard instructions in the Local Builder section to build the application once.

Once built, the mustach RPM will be available under /home/devel/build/RPMS/mustach-0.0.1-0.rpd28.aarch64.rpm. It is the one we will package into a Mender artifact.

Create the directory used to hold all artifacts so that we do not pollute the RPM build output:

export MENDER_DIR=/home/devel/build/MENDER
mkdir -p $MENDER_DIR

Generate a mender artifact for the RPM. By default, the artifact will be created in the same directory as the RPM. We override this behavior via the --output|-o option to point to our artifact directory:

make-mender-artifact -o ~/build/MENDER ~/build/RPMS/mustach-0.0.1-0.rpd28.aarch64.rpm

Next, upload the artifact to the Mender server. As you previously logged in, you should not be asked for your password again.

upload-mender-artifact -u $MENDER_IO_USERNAME ~/build/MENDER/mustach-0.0.1-0.rpd28.aarch64.mender

The final step is to go to the web UI. The newly uploaded package will be available under the Releases tab:

Artifact release

One can then create a new Deployment targeting their device using it.

For more information on how to manage releases and create deployments for them, please see the hosted Mender documentation

Application updates

The next step is to modify the mustach app, for instance to add a version information switch as per this diff:

diff --git a/mustach-tool.c b/mustach-tool.c
index 364e34a..bdfa6f7 100644
--- a/mustach-tool.c
+++ b/mustach-tool.c
@@ -122,6 +122,10 @@ int main(int ac, char **av)
        if (*++av) {
                if (!strcmp(*av, "-h") || !strcmp(*av, "--help"))
+               if (!strcmp(*av, "-v") || !strcmp(*av, "--version")) {
+                       printf ("Mustach v0.0.2\n");
+                       exit(0);
+               }
                if (av[0][0] == '-' && !av[0][1])
                        o = json_object_from_fd(0);

Next, rebuild the application as per the Local Builder instructions. Do not forget to update the Version: field in mustach.spec as well.

Make a new artifact using make-mender-artifact and upload it to the server:

make-mender-artifact ~/build/RPMS/mustach-0.0.2-0.rpd28.aarch64.rpm -o ~/build/MENDER
upload-mender-artifact -u $MENDER_IO_USERNAME ~/build/MENDER/mustach-0.0.2-0.rpd28.aarch64.mender

The newly uploaded artifact will be present in the UI to create a new deployment on the target.

New artifact release

Once deployment is done, one can verify the new package has been uploaded by querying the RPM database on the target itself:

$ rpm -q mustach

In case the deployment fails, the Mender UI provides access to the Mender client log from the target, which can also be obtained via journalctl -u mender-client -e -f (this is useful to monitor a deployment too).