Automated remote updates
If you have multiple gateways you plan to update on a regular basis, you will probably be interested in automating this process.
The LORIX One is compatible with mender, which provides a powerful infrastructure to manage the updates for your devices.
Overview
Updating with mender requires two parts:
- The gateways you want to update
- A server that will send the update to the gateway
The gateway already has everything needed installed. As for the server, you will need one for your own deployments.
The gateways will contact the server, this means your gateway doesn't need to be accessible from the outside world.
You can find advanced information regarding mender on the official website or on the mender documentation: https://docs.mender.io/. When reading the documentation, please keep in mind that the LORIX is already totally compatible. This means the device side part of the documentation can be skipped.
Setup the server
To setup your server, you have two possibilities:
- Hosted mender: subscribe for a server as a cloud service (SaaS)
- On premise: install the Open Source or the Enterprise mender server stack on your infrastructure
Subscribe a hosted mender plan
You can find all details regarding the available plans, pricing and features on the mender website.
Install an on premise mender server
Mender server is available in two flavors: the Open Source and the Enterprise version. You can check on they differ in features on the mender website.
The mender software stack is composed of multiple services that run together. Installing it on your servers requires some devops knowledge, particularly to configure the platform correctly regarding security.
All information regarding the installation can be found on the official documentation: https://docs.mender.io/2.5/server-installation/overview.
Register the gateways
Now that you have a running server, you can connect the gateways to the server.
Configure the gateway
The gateway runs the mender daemon that will contact the update server. The daemon must be configured correctly regarding the update server configuration.
Edit the configuration
The configuration is located at /etc/mender/mender.conf
. You can use nano to edit the configuration:
sudo nano /etc/mender/mender.conf
{
"ArtifactVerifyKey": "/etc/mender/artifact-verify-key.pem",
"InventoryPollIntervalSeconds": 28800,
"RetryPollIntervalSeconds": 300,
"ServerURL": "https://docker.mender.io",
"UpdatePollIntervalSeconds": 1800
}
Hosted mender
Parameter | Value | Comment |
---|---|---|
ServerURL | https://hosted.mender.io/ | |
TenantToken | Get it from https://hosted.mender.io/ui/#/settings/my-organization | This token is private to your organization. It allows mender to know to which account it should associate the device. |
On premise
Set the ServerURL to your own instance URL. E.g. https://update.mycompagny.com.
You can find more details regarding the configuration options in the documentation.
Start the mender daemon
To start the daemon, run:
sudo rc-service menderd start
Output
menderd | * Starting Mender OTA update service ... [ ok ]
The daemon will automatically contact the server within the configured interval.
Auto start the daemon at boot
To make the daemon start after each reboot, we have to tell the init system:
sudo rc-update add menderd default
Output
* service menderd added to runlevel default
Disable the daemon
If you would like to disable the daemon totally after that, you can run the opposite commands:
sudo rc-service menderd stop
sudo rc-update delete menderd default
The mender configuration is not yet available through the Manager UI.
Accept the device in the server
When the daemon contacts the server, it will be in a "pending" state until it is accepted. You can see the pending devices on this page: https://hosted.mender.io/ui/#/devices/pending.
By clicking on the device, you access the details panel where you can accept the device:
Once accepted, it will be listed in the devices page:
Deploy an update
To deploy an update, these two steps must be done:
- Upload the release artifact to the server
- Create a new deployment
Upload the release artifact to the server
Load the release page: https://hosted.mender.io/ui/#/releases.
Download the update artifact of the version you want to upgrade to at https://download.wifx.net/lorix-os/. The artifacts are stored in the image
folder and have a .mender
extension. E.g. https://download.wifx.net/lorix-os/1.1.1/images/lorix-os-1.1.1+ca3d814_lorix-one-512.mender.
Rename the file by replacing the "+" character by a "-" character (special characters are not supported): lorix-os-1.1.1+ca3d814_lorix-one-512.mender
→ lorix-os-1.1.1-ca3d814_lorix-one-512.mender
.
On the release page, click on the "Upload an Artifact" link and drag the file in the upload window. Press upload.
If you have 256MB gateways, upload the 256 artifact in the exact same way.
You will then have the new release available in the Releases page:
Create a new deployment
Load the deployments page: https://hosted.mender.io/ui/#/deployments.
Click the "Create deployment" button:
Select the release to deploy and the device group on which to deploy the release.
On the next pages, configure your deployment strategy. Once validated, you'll see your active deployment on the deployment page:
At this point, the release will be deployed on the gateways within the configured interval in a fully automated manner. The gateways will automatically restart in the new version.
The gateway contacts the server on a regular basis to know if an update is available. To save bandwidth and reduce server load, this is only done every 30 minutes (by default). You can configure this interval in the mender daemon configuration with the UpdatePollIntervalSeconds
option.
As the gateway restarts, the packets forwarding is not active and packets will not be received for a few minutes.
If you have coverage redundancy with your gateways, you may want to create two device groups and update them one after the other so you can keep a complete coverage during the updates.
Going further with mender
To learn more about fleet update management, you can check the mender documentation or check their online videos and webinars that cover this subject in depth.
If you have a large fleet of gateways to handle with mender, please do not hesitate to contact us at support@iot.wifx.net to get more information about mender and the LORIX gateways.