Open main menu

DAVE Developer's Wiki β

Changes

SBCX-TN-002: Running Microsoft Azure IoT Edge runtime

7,099 bytes added, 11:35, 5 January 2021
no edit summary
{{InfoBoxTop}}
{{AppliesToSBCX}}
{{AppliesToAxel}}
{{AppliesToAxelEsatta}}
{{AppliesToAxelLite}}
{{AppliesToAxelEsattaAppliesToAXEL Lite TN}}{{AppliesToSMARX TN}}{{AppliesToSBCX}}{{AppliesToSBC Axel TN}}{{AppliesToIoT}}{{AppliesTo IoT TN}}
{{InfoBoxBottom}}
{{WarningMessage|text=This technical note was validated against specific versions of hardware and software. It may not work with other versions.}}
|August 2019
|First public release
|-
|1.1.0
|August 2019
|Added gateway ''patterns''
|}
==Introduction==
As stated in [[MISC-TN-005:_Running_AWS_Greengrass_Core_on_SBCSPG|this Technical Note]],nowadays several cloud platforms are available to implement advanced (Industrial) IoT systems. This Technical Note illustrates how to use the [[:Category:SBC-AXEL|SBC Axel]] (SBCX for short) to implement a [https://docs.microsoft.com/it-it/azure/iot-edge/about-iot-edge Microsoft Azure IoT Edge]-enabled device. Thanks to its flexibility and to its rich set of I/O interfaces, the SBCX single-board computer can be leveraged to implement an IoT gateway with good processing power. This combination makes this board particularly suited for the applications where significant computations have to be [[MISC-TN-005:_Running_AWS_Greengrass_Core_on_SBCSPG#Introduction|deployed on the edge]]. [[File:Edge-as-gateway.png|thumb|center|600px|Gateway ''patterns'' as defined by Microsoft Azure (image source: [https://docs.microsoft.com/en-us/azure/iot-edge/iot-edge-as-gateway ''How an IoT Edge device can be used as a gateway''])]]  It is worth to remember that this Technical Note is not a step-by-step guide to set up the edge device and the cloud platform to implement an Azure-based system. Azure documentation is rich and detailed in this regard. Rather, this document aims to underline some specific SBCX-related steps required to run the Azure IoT Edge runtime on this device successfully. Nevertheless, in the following sections, several relevant links to the Azure documentation will be provided. ==Testbed configuration==Regarding the hardware, the testbed used for this Technical Note (TN) consists of an SBCX single-board computer equipped with a quad-core i.MX6Q system-on-chip (SoC). For what concerns software, the following configuration was used:* Linux kernel: <code>4.9.11-xelk-4.0.0</code> (see [[Axel_Embedded_Linux_Kit_(XELK)#XELK_4.0.0|XELK 4.0.0]])* Debian Strech root file system (armbian)**The root file system is the same used for this [[MISC-TN-004:_Running_Debian_(armbian)_on_SBCSPG|TN]]. ==Install the Azure IoT Edge runtime==In essence, to install Azure IoT Edge runtime to the SBCX, the procedure described in the [https://docs.microsoft.com/en-us/azure/iot-edge/how-to-install-iot-edge-linux ''Install the Azure IoT Edge runtime on Debian-based Linux systems''] guide was followed.  ===Linux kernel configuration===The Azure IoT Edge runtime is released as a [https://www.docker.com/resources/what-container Moby/Docker container]. As such, the Linux kernel must be configured appropriately in order to provide all the functionalities required to support containerization. Starting from the default configuration file (<code>imx_v7_axel_defconfig</code>), a new kernel configuration was set up providing all the required options. This configuration is available for download [http://mirror.dave.eu/axel/SBCX-TN-002/imx_v7_axel_iotedge_defconfig here]. To verify what options are missing, [https://raw.githubusercontent.com/moby/moby/master/contrib/check-config.sh this script] is very useful. Some of the checked functionalities are relevant for x86 architectures, however. ===Root file system configuration===After setting up the Linux kernel properly, issue the following command to mount the cgroupfs hierarchy.<pre class="board-terminal">armbian@sbcx:~# sudo aptitude install cgroupfs-mount</pre> ===Azure IoT Edge runtime installation===The system is now ready to install the runtime as described in the guide mentioned previously. The last step should procude an output like this:<pre class="board-terminal">armbian@sbcx:~/devel/azure-iot-edge$ sudo apt-get updateGet:1 http://security.debian.org stretch/updates InRelease [94.3 kB]Hit:6 https://deb.nodesource.com/node_10.x stretch InReleaseIgn:3 http://cdn-fastly.deb.debian.org/debian stretch InReleaseGet:4 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease [91.0 kB]Get:5 http://cdn-fastly.deb.debian.org/debian stretch-backports InRelease [91.8 kB]Hit:8 https://packages.microsoft.com/debian/stretch/multiarch/prod stretch InReleaseHit:7 http://cdn-fastly.deb.debian.org/debian stretch ReleaseHit:2 https://apt.armbian.com stretch InReleaseFetched 277 kB in 5s (50.2 kB/s)Reading package lists... Donearmbian@sbcx:~/devel/azure-iot-edge$ sudo apt-get install iotedgeReading package lists... DoneBuilding dependency treeReading state information... DoneThe following additional packages will be installed: libiothsm-stdThe following NEW packages will be installed: iotedge libiothsm-std0 upgraded, 2 newly installed, 0 to remove and 10 not upgraded.Need to get 4663 kB of archives.After this operation, 22.4 MB of additional disk space will be used.Do you want to continue? [Y/n]Get:1 https://packages.microsoft.com/debian/stretch/multiarch/prod stretch/main armhf libiothsm-std armhf 1.0.8-2 [501 kB]Get:2 https://packages.microsoft.com/debian/stretch/multiarch/prod stretch/main armhf iotedge armhf 1.0.8-2 [4162 kB]Fetched 4663 kB in 3s (1380 kB/s)Selecting previously unselected package libiothsm-std.(Reading database ... 53013 files and directories currently installed.)Preparing to unpack .../libiothsm-std_1.0.8-2_armhf.deb ...Unpacking libiothsm-std (1.0.8-2) ...Selecting previously unselected package iotedge.Preparing to unpack .../iotedge_1.0.8-2_armhf.deb ...Adding system user `iotedge' (UID 110) ...Adding new user `iotedge' (UID 110) with group `nogroup' ...Creating home directory `/var/lib/iotedge' ...Adding group `iotedge' (GID 116) ...Done.Adding user `iotedge' to group `docker' ...Adding user iotedge to group dockerDone.Unpacking iotedge (1.0.8-2) ...Processing triggers for systemd (232-25+deb9u11) ...Setting up libiothsm-std (1.0.8-2) ...Processing triggers for man-db (2.7.6.1-2) ...Setting up iotedge (1.0.8-2) ...===============================================================================  Azure IoT Edge  IMPORTANT: Please update the configuration file located at:  /etc/iotedge/config.yaml  with your device's provisioning information. You will need to restart the 'iotedge' service for these changes to take effect.  To restart the 'iotedge' service, use:  'systemctl restart iotedge'  - OR -  /etc/init.d/iotedge restart  These commands may need to be run with sudo depending on your environment. ===============================================================================Created symlink /etc/systemd/system/sockets.target.wants/iotedge.mgmt.socket -> /lib/systemd/system/iotedge.mgmt.socket.Created symlink /etc/systemd/system/multi-user.target.wants/iotedge.service -> /lib/systemd/system/iotedge.service.Created symlink /etc/systemd/system/sockets.target.wants/iotedge.socket -> /lib/systemd/system/iotedge.socket.Processing triggers for systemd (232-25+deb9u11) ...</pre>   After the Azure IoT Edge runtime is started, the IoT hub dashboard on cloud side should look like this:[[File:SBCX-Azure-IoT-hub.png|thumb|center|600px|Azure IoT hub dashboard]]
dave_user, Administrators
5,184
edits