May 22, 2022

Run Linux edge applications on Windows PCs and servers with EFLOW

[ad_1] WSL isn’t the only official way to run Linux code on Windows systems. Find…

[ad_1]

WSL isn’t the only official way to run Linux code on Windows systems. Find out how to take advantage of Azure IoT Edge for Linux on Windows.

Image: Shutterstock/TippaPatt

Microsoft has been clear for some time that the edge is as important to it as the cloud, with CEO Satya Nadella regularly talking about “the intelligent cloud and the intelligent edge.” Much of its focus has been on bringing Azure to that edge, in all its many forms. Part of that is support for Linux containers and devices as part of Azure IoT Edge.

There’s a lot of Linux-based edge code out there, tooling for processing and managing your data, so it makes sense to reuse that on your own hardware. Microsoft has made it easy to work with both Windows and Linux code on its hardware, with containers its key deployment model. There’s one problem though: Its Windows Subsystem for Linux isn’t intended to be used for applications that need to run for months, or even years.

It’s now launched an alternative that’s intended for just that purpose: EFLOW.

SEE: A guide to The Open Source Index and GitHub projects checklist (TechRepublic Premium)

Understanding EFLOW

EFLOW is Azure IoT’s Edge for Linux on Windows. Like WSL it builds on concepts that Docker introduced with its Linux Containers on Windows, with its LinuxKit minimal kernel and userland. Here, though, EFLOW uses Microsoft’s own CBL-Mariner Linux distribution, an increasingly important tool for Microsoft. The “CBL” in CBL-Mariner stands for Common Base Linux, and it’s Microsoft’s standard Linux for its own applications, used as a container host for Azure Linux containers as well as hosting the tools used to deliver Linux graphics apps in WSLg. EFLOW builds on it with Docker’s moby-engine to host and run application containers.

As a result, there are similarities between EFLOW and WSL, but the two implementations are designed for very different use cases and very different modes of deployment and operation. It’s perhaps best to think of WSL as the place you build and test Linux code (as well as run user applications), while EFLOW is a specific deployment target for Azure IoT Edge modules running in containers. It’s very much a production platform, with what Microsoft calls a “curated Linux” intended for code that runs for months or even years.

edge-linux.jpg

Image: Microsoft

With the two Windows Linux approaches sharing a common approach, you can use WSL as your development environment, working with familiar Windows development tooling by using Visual Studio remoting. Once your code is ready for use, all you need to do is package it in an Azure IoT Edge container and deploy it to EFLOW.

Setting up EFLOW

EFLOW is designed to run on a subset of Windows environments, supporting Windows 10 and 11 Pro and Enterprise, as well as IoT Enterprise, and currently supported Windows Server builds. You will need to enable Hyper-V in advance of any deployment — and if you are running on a VM image on a platform like Azure Stack HCI, make sure it supports nested virtualization.

Devices need to be registered with Azure IoT Hub. This handles deployment of containers, as well as installing the EFLOW PowerShell. Each device needs a unique ID, and you can manage this through the Azure CLI or the Azure Portal.

EFLOW is deployed and managed through PowerShell. You’ll need to use the Azure EFLOW PowerShell module to manage the EFLOW environment once you’ve installed it. Microsoft provides a set of PowerShell commands for installing the MSI, with options for customizing the install and virtual disk locations. Working with the command line may not work for everyone, so you can use a preview extension for the Windows Admin Center, which works with both local and remote managed devices.

SEE: Top Windows 10 run commands (free PDF) (TechRepublic)

With the MSI installed, the PowerShell modules are now ready for use, so use the Deploy-Eflow command to create your environment, configuring memory and disk size. If you’ve used PowerShell to deploy a Hyper-V VM you should find this approach familiar, configuring CPUs, memory, storage and networking. You can even configure GPU support, which simplifies using EFLOW to host machine learning containers, as they can take advantage of its GPGPU support to power inferencing engines. Again, there’s an alternative option of using WAC to configure and deploy EFLOW, choosing target hardware and defining settings, before deploying and configuring.

Running EFLOW

Once installed you can configure the virtual network used by EFLOW. While the default network and virtual switch are good enough for a single application, more complex install environments where EFLOW and other virtual machines and containers are sharing resources will require separate networks and switches to ensure application isolation. Once you have a network, you can create a network endpoint for EFLOW with either a static or dynamic IP address.

With EFLOW up and running, you can use other EFLOW PowerShell scripts as part of a management environment. One useful command collects lots and bundles them as a zip file, ready to send to a central log analysis server, while others report on the current states of VMs and of virtual networks. You will then need to set up connection strings to complete linking your EFLOW instance to your cloud Azure IoT Hub.

The EFLOW environment can also be managed using SSH, connecting only to an SSH client running in PowerShell on the host machine. This allows you to log into a running environment to ensure that it’s configured correctly and that the CBL-Mariner host environment is running. You need a direct connection to the host server; you can’t connect through remote PowerShell or the Windows Admin Center.

You’re now ready to build and deploy your IoT Edge applications to EFLOW, pushing containers to it from Azure IoT Hub. Microsoft provides a GitHub repository with sample code that simplifies building your first Edge applications. It’s worth spending time with these as they show how to do things like running edge-hosted machine learning applications. Code is deployed from Azure, with containers treated as modules stored in a container registry.

Code itself can be developed in any Linux environment, and as EFLOW and WSL share a lot of common features, it’s an option for design and test. It’s worth using a more fully featured distribution like Ubuntu to build and test containers, before running your code in a local EFLOW environment and publishing it to your private registry.

EFLOW lets you use existing Windows edge hardware for Linux edge applications, running alongside all your other code. With Windows IoT offering long support cycles along with EFLOW, it’s a good way to build hybrid systems and appliances that mix and match the best of the two different platforms — from control applications to large-scale edge machine learning.

The big value for anyone using EFLOW is, of course, support. It’s part of the Windows IoT platform, and so gets the full Windows IoT support lifecycle. That’s longer than you’ll get with most long-term support Linux distributions, making it attractive to anyone who needs to run Linux code in an industrial appliance-like environment.

Also see

 

[ad_2]

Source link