Seamless Device Updates

circuit-3

In today’s world, it’s essential to update and upgrade the software on your devices to address security vulnerabilities, introduce new features, and enhance overall performance.

Many companies have demonstrated the customer benefits of regularly improving product performance through software updates. While Tesla is perhaps the most notable example, numerous other businesses, both large and small, are enhancing their products’ capabilities and addressing security concerns through software updates.

However, smoothly updating a pool of devices without issues or downtime can be challenging. With the EmbedThis Builder, you can create, deploy, manage, and monitor software updates, ensuring your devices remain secure and up-to-date.

EmbedThis Builder Device Updater

The Builder’s update manager offers the following capabilities:

The Builder’s update manager allows you to selectively distribute updates to any chosen group of devices based on a distribution policy. This enables you to update all your devices or only specific groups as needed.

Components of Device Update

The EmbedThis software update solution has three major components:

ItemDescription
BuilderPortal to create and manage software updates and distribution policies
Ioto Cloud ServiceService to securely store software updates and distribute via a global CDN
Device AgentsDevice-resident software to poll, download and apply software updates to the device

The Builder assists in preparing a software update for distribution, which includes uploading the device software image, specifying the version, and setting a distribution policy. It also offers comprehensive monitoring and reporting of your device population and update performance.

The Ioto Cloud Service hosts the device software images and facilitates communication with devices to deliver the updates to the relevant devices.

The Device Agents contain the necessary logic to interact with the cloud service, enabling them to download and install new software images as they become available.

Device Agent Support

Using the Builder, you can deploy updates to any device, regardless of the device agent you utilize. The Ioto device agent pre-integrates the software update capability. Other device agents can use the stand-alone EmbedThis Updater. The GoAhead and Appweb device agents bundle the Updater code with their release distributions.

The EmbedThis Updater is a command line utility that can request, fetch and apply software updates. Versions are provided in three forms:

For example:

updater -v \
    --device "ABCDEF1234" \
    --host "https://abcdefghij.execute-api.ap-southeast-1.amazonaws.com" \
    --product "000001234567890AAKW996CZHH" \
    --token "00000001234567890AABBEGYJB" \
    --version "1.2.3" \
    --file updater.bin \
    --cmd ./apply.sh \
    model=pro ports=16 memory=256

Regardless of the device agent you use, the underlying update API and Builder Update service is the same.

Creating Device Updates

To define a device software update, you supply the following parameters to the Builder:

software-edit

Product Selection

A Builder account may manage many devices that have different update policies and usually require different firmware. When defining a software update, you nominate a Builder product definition for which the update applies.

For each family of devices that require the same software update images, you should create a Builder product definition. When the product definition is created, the Builder also creates a product ID token. This token is included in the device upgrade request to select the appropriate product and software update. The product token is obtained from the Builder Token List after creating the product definition.

The Builder uses the product ID token paired with the update distribution policy to define the subset of devices that are eligible to receive the update. To receive a software update, a device specifies a Builder Product Token that selects the product for which software updates may be published.

Device Cloud Selection

Software updates are reliably stored in a device cloud and distributed globally via the AWS CDN to local regions. When defining updates, you can select your device cloud to store and manage the updates. Select the device cloud from the pulldown list.

Software Version

The software update version number is your device’s version number. The version numbers must be compatible with the SemVer 2.0 version specification.

For Ioto, the current version for your device is defined via the version property in the ioto.json5 configuration file. For other device agents, the version is provided in the update API request.

The update description can be an informative description for your purposes. It is recommended to describe the purpose and extent of the update.

Software Distribution

At regular intervals, and typically once per day, device agents should connect to the Device Cloud for a “checkin” to see if any update has been published. During the checkin, the device agent will submit the Product ID, Device ID and other device specific information that can be used when evaluating the distribution policy to determine if an update is available and suitable for this device.

If you are running the Ioto agent, it will automatically perform a checkin according to the schedule defined in the ioto.json5 configuration file. If you are using the EmbedThis Update utility, you should schedule that to run regularly using Cron or a similar facility.

The device cloud service will evaluate the distribution policy expression when the device checks-in. The device cloud will retrieve the most recent updates and check the updates in reverse version order and select the first matching update for the device. If the policy matches for the device, the URL for the update image will be returned to the device agent.

The device agent will then download the update image and verify the integrity of the update image. If verified, an update script is invoked to apply the update.

If you are running the Ioto agent, the “scripts/update” script will be invoked to apply the update. You should customize this script to suit your device. If you are running Ioto on an RTOS, without scripting, you will need to watch and react to the Ioto event device:update using the rWatch API.

If you are running the EmbedThis updater, you should customize the apply.sh script to apply the update to your device.

Software Distribution Policy

The update distribution policy enables you to target specific relevant subsets of your device populations.

The distribution policy is a simple JavaScript-like expression that is evaluated by the device cloud at runtime to determine if the update is relevant for a specific device. If you leave the policy blank, then all devices with a version that is earlier than the software update version will be updated.

Here is a sample policy expression:

major >= 1 && minor >= 1 && patch >= 5 && memory >= 256 && ports == 32

The device properties submitted with the update request are made available as expression variables. In this case, the “memory” and “ports” variables are supplied with the update request. If you are using the Ioto device agent, these variable can be defined in the device.json5 file.

The full device version is accessible as the policy variable “version” and the version of the software update is provided via the “newVersion” variable. The device version string is also split into SemVer components: major, minor and patch.

The default policy is uses the inbuilt function semver which compares two version strings. This default policy compares if the current version is earlier than the new update version using the following expression.

semver(version, "<", newVersion)

The policy expression language understands the types: Numbers, Boolean, String literals, Regular Expressions and null. Strings are quoted with either single or double quotes.

Sub-expressions can be grouped with parenthesis and the boolean operators && and || can group conditional operands. Regular expressions (delimited by slashes) may be used with the “==” and “!=” operators. The regular expression can be on either side of the operator.

The policy expression is run-time limited to evaluate up to 50 expression terms. This is to protect the device cloud and service against denial of service attacks.

Update Rollout Limits

Implementing a gradual update strategy can help minimize load and risk. Updating a large number of devices simultaneously can impose an excessive burden on your service, so staggering the rollout can distribute the load more evenly.

Despite thorough testing, some updates might still be considered “risky.” To minimize this risk, you can update a small subset of your device population first to see if the update causes any issues.

The update service provides update limits and gradual rollout factors that allow you to control the rate of updates. The following mechanisms are supported:

If a device meets the distribution policy and rollout limits, the URL for the update image will be returned to the update agent.

Metrics & Reports

The Builder provides extensive metrics to track the progress and performance of updates.

software-metrics

Each metric is uniquely tracked per-product and for each product update version.

MetricDimensionsDescription
UpdateTotalProduct, Product/VersionTotal number of devices
UpdateDeferredProduct, Product/VersionNumber of updates temporarily deferred due to rollout policies
UpdateStartedProduct, Product/VersionNumber of updates started
UpdateSuccessProduct, Product/VersionNumber of successful updaes
UpdateFailedProduct, Product/VersionNumber of failed updates

The Builder Update list also includes metrics for tracking how many devices are using each update:

software-list-metrics

Summary

With the EmbedThis Builder and Updater, you can seamlessly update your devices to quickly and reliably address security issues and deliver increased functionality and performance to your users.

The EmbedThis Builder update facility is designed to scale and will handle device populations up to and beyond 10,000,000 devices.

Want More Now?

To learn more about EmbedThis Ioto, please read:

Comments

{{comment.name}} said ...

{{comment.message}}
{{comment.date}}

Make a Comment

Thank You!

Messages are moderated.

Your message will be posted shortly.

Sorry

Your message could not be processed at this time.

Error: {{error}}

Please retry later.

OK