Use Docker for Rapid IoT Deployment
As the number of IoT endpoints multiplies—as do the services that consume their data—there is a need to coordinate and deploy software in a more scalable fashion.
Container technology like Docker can go a long way toward solving the challenge. Containerized code can be centrally orchestrated across distributed systems, making it easier to scale up designs. Containers also provide a layer of hardware abstraction, allowing them to run on the diverse systems common in IoT endpoints.
But this solves only half of the problem. Like IoT endpoints, IoT services are highly diverse, using many different APIs and messaging protocols. To transport data between the heterogeneous mix of devices and services, developers need a communications hub that can translate messages among all these systems.
These challenges have led to the rise of platforms that combine containerization and messaging. With these platforms, developers can create Dockerized workloads in the cloud, deploy them to edge devices, analyze data locally, and respond appropriately. The edge device can then push the data and the results back into the cloud for remote monitoring as needed (Figure 1).
In this article, we will look at one such service, Microsoft Azure IoT.
The Containerization Process
Azure IoT is a cloud platform for developing, deploying, and managing IoT applications. Among other features, the platform offers a variety of service modules that can speed time-to-market, such as machine learning and stream analytics.
While these cloud services are useful, what makes the platform truly valuable is its ability to push workloads out to the edge. Using the recently released Azure IoT Edge 2.0, developers can containerize modules using Docker, and deploy them onto devices running Linux or Windows. In this way, cloud intelligence and analytics can be extended to devices ranging from a Raspberry Pi to a powerful industrial gateway.
To manage these diverse endpoints, IoT Edge works closely with Azure IoT Hub. This service authenticates and establishes communications with IoT devices and automates device registry and provisioning. IoT Hub also serves as a registry for containerized modules, as a conduit for secure messaging, and as a remote management nexus for deployed modules.
As illustrated in Figure 2, the process for using IoT Edge is as follows:
- Create an IoT Hub (or use one that's already established)
- Register an IoT Edge device to that IoT Hub
- Start the IoT Edge runtime
- Remotely deploy a module to an IoT Edge device
An IoT Edge runtime on the edge device is responsible for fundamental services such as security, storing and forwarding data when the edge device is offline, and management of systems otherwise isolated from the Internet (such as sensors connected to the edge device). It also manages communications between modules and the cloud. For instance, a machine learning (ML) module may send only alerts to the cloud, instead of all the data (Figure 3).
IoT Edge uses the same APIs as IoT Hub, so the gateway can act like a local IoT Hub. “In this way, the modules can be pre-configured and living up in the cloud in a repository, waiting to be pulled down,” said Brett Stateham, technical evangelist at Microsoft.
Prepackaged and Custom Services
While prepackaged services are available, developers are free to copy what's there and modify it. Or they can code their own module from scratch using their language of choice, and wrap it using Docker. “So, it's very extensible,” said Stateham.
These services include analytics for business intelligence, AI and machine learning, and mobile services, just to mention a few. But any service can access the data, as Azure IoT Hubs support open APIs and SDKs for Python, Java, PHP, and .Net. “Worst case, some standard REST APIs are able to consume the messages,” said Stateham.
Data is transferred securely from the edge device using secure telemetry messaging, such as AMQPS, MQTTS, and HTTPS, and once stored it is available to any back-end service that may want to read it. IoT Edge and IoT Hubs use the same secured messaging protocols, so communications, provisioning, registration, and overall management are simplified.
Deploying onto Edge Hardware
Although IoT Edge can run on a wide range of devices, many existing systems do not have native support for Internet connectivity. For example, sensor modules may have wired interfaces for Modbus or CAN bus, or a wireless interface for Bluetooth low energy (BLE), but do not have a TCP/IP stack and cannot push data directly to the cloud.
This is where devices such as the Intel® NUC come into play, said Stateham (Figure 4). These can be running Windows 10 or Wind River Linux and be deployed at the edge. “It's got USB ports, and Wi-Fi, and a whole bunch of other cool stuff on it,” he said, “and it can be used to talk to BLE modules, and from there they can connect to the cloud.” Likewise, for any other module or sensor, wired or wireless, they can be connected to the gateway as an aggregation point.
Pushing Intelligence to the Edge
With IoT Edge as an extension of the Azure IoT stack, developers can now quickly and securely add scalable IoT analytics and other services at the edge to connect sensor modules and start applying IoT capabilities toward AI principles.
To learn more about deploying containerized IoT workloads, watch the webinar “Creating Field Gateways with Azure IoT Edge and the Intel® NUC.”