In a recent article on the MSDN site, Daniel Meixler explores a complete DevOps lifecycle for an Internet of Things (IoT) application using Microsoft frameworks and components. The concepts can be generalized to other IoT platforms with some changes.
Typically, DevOps is most prevalent for web applications but it’s not tied to any specific technology or type of application. The article covers the creation of an end-to-end DevOps lifecycle for a refrigerator control application as a proof of concept. There is a special focus on the fully automated CI/CD chain. Once the challenges are laid out for the specific app, they are addressed using the chosen technology stack. Some of the concepts are general and can be reused irrespective of the technology.
The example application mimics a refrigerator control and run on a Raspberry PI. There are various challenges in the development pipeline for such an IoT application. The pipeline would have to cover automatic building on every check-in, automated UI tests, deployment to various environments including production, and collection of telemetry data. UI testing is generally hard and any kind of automated testing on devices is harder. Some other DevOps challenges in this context include auditability and device compatibility, but they are not addressed in the article.
For the refrigerator app in question, deployment would have to be made to both test devices (QA) as well as customer devices (production). The latter is not easy because there is often no physical access to those devices. In this case, the devices are huge in number, located on the customer’s premises, and spread across a wide geographical area. The last requirement - telemetry - poses a challenge as IoT devices usually operate without much manual intervention and there is no way for the user to send any feedback on the device’s performance. Collecting manual feedback is not an option either.
The technology choices made were to optimize the pipeline without too much customization. The IoT platform was Windows 10 IoT Core, and the application a Windows Universal App (UWP). The orchestration platform was Visual Studio Team Services (VSTS). VSTS has features which aim to make the DevOps process easy. Going along with the Microsoft stack, Azure IoT Hub was the management platform of choice. This was used to manage and configure the IoT app. Azure IoT Hub supports multiple languages, and .NET and node.js were used for this app. HockeyApp, which was acquired by Microsoft a few years ago, was used for collecting usage and error analytics from the devices.
Image from https://blogs.msdn.microsoft.com/dmx/2017/01/26/devops-for-iot-part-1/
When the pipeline executes and a new version of the app is generated, the release process notifies Azure IoT Hub. The Hub’s responsibility is to ensure that the new version gets downloaded and installed on all the IoT devices that are registered with it. This might happen immediately for devices that are online, and in a delayed mode for offline devices.