admin管理员组

文章数量:1200344

I am using Azure IoT hub and deploying one custom modules to an edge device. out of 5 modules 4 are looking good. one of them disappears after deploying successfully in Set Modules area.

This module is nothing but a C++ executable with UI which we are deploying as container in IoT edge device

Problem: UI based Customer module gets deployed but vanishes from set module after running successfully.

Setup: Ubuntu 22.04.

Runtime: Docker and Azure IoT Edge Runtime

Installed: x11 and x Server running as our container based exe has UI to display

Steps to reproduce:

I am performing below steps to reproduce the problem.

  1. In IoT hub >> click on Set Modules >> Click on Add IoT edge module

  2. specify module name and container image URL

    1. Environment Settings: Add DISPLAY with value :0

    2. CreateOptions

      {
        "HostConfig": {
          "Binds": [
            "/dev/mem:/dev/mem",
            "/dev/gpiomem:/dev/gpiomem"
          ],
          "Mounts": [
            {
              "Source": "/dev",
              "Target": "/dev",
              "Type": "bind"
            },
            {
              "Source": "/tmp",
              "Target": "/tmp",
              "Type": "bind"
            },
            {
              "Source": "/tmp/.X11-unix",
              "Target": "/tmp/.X11-unix",
              "Type": "bind"
            }
          ],
          "NetworkMode": "host",
          "Privileged": true
        },
        "Env": [
          "DISPLAY=:0"
        ],
        "NetworkingConfig": {
          "EndpointsConfig": {
            "host": {}
          }
        },
       }
      

3. Now this gets deployed to edge device successfully. and I can see the UI on edge device running.

on Azure portal on IoT hub, I can see module running

Now if I go to Set Modules, I am expecting it is listed there. but this module is not visible.

I am deploying other modules and those are visible all the time but not this specific module.

Any help will be appreciated.

I am looking looking forward to see the custom module in set modules list same as all other modules agent and hub can be seen.

I am using Azure IoT hub and deploying one custom modules to an edge device. out of 5 modules 4 are looking good. one of them disappears after deploying successfully in Set Modules area.

This module is nothing but a C++ executable with UI which we are deploying as container in IoT edge device

Problem: UI based Customer module gets deployed but vanishes from set module after running successfully.

Setup: Ubuntu 22.04.

Runtime: Docker and Azure IoT Edge Runtime

Installed: x11 and x Server running as our container based exe has UI to display

Steps to reproduce:

I am performing below steps to reproduce the problem.

  1. In IoT hub >> click on Set Modules >> Click on Add IoT edge module

  2. specify module name and container image URL

    1. Environment Settings: Add DISPLAY with value :0

    2. CreateOptions

      {
        "HostConfig": {
          "Binds": [
            "/dev/mem:/dev/mem",
            "/dev/gpiomem:/dev/gpiomem"
          ],
          "Mounts": [
            {
              "Source": "/dev",
              "Target": "/dev",
              "Type": "bind"
            },
            {
              "Source": "/tmp",
              "Target": "/tmp",
              "Type": "bind"
            },
            {
              "Source": "/tmp/.X11-unix",
              "Target": "/tmp/.X11-unix",
              "Type": "bind"
            }
          ],
          "NetworkMode": "host",
          "Privileged": true
        },
        "Env": [
          "DISPLAY=:0"
        ],
        "NetworkingConfig": {
          "EndpointsConfig": {
            "host": {}
          }
        },
       }
      

3. Now this gets deployed to edge device successfully. and I can see the UI on edge device running.

on Azure portal on IoT hub, I can see module running

Now if I go to Set Modules, I am expecting it is listed there. but this module is not visible.

I am deploying other modules and those are visible all the time but not this specific module.

Any help will be appreciated.

I am looking looking forward to see the custom module in set modules list same as all other modules agent and hub can be seen.

Share Improve this question edited Jan 22 at 13:33 NILESH asked Jan 22 at 13:22 NILESHNILESH 5511 bronze badges 6
  • what do mean by module is not visible and vanishes from set module after running successfully.. see the custom module in set modules list same as all other modules agent and hub can be seen. – Sampath Commented Jan 23 at 2:44
  • I mean, if I add module form set modules options, I should be able to see that when I navigate to set modules again after deployment. I am able to see modules on device screen at the bottom. but if I click on set modules then I cannot see this module which I added earlier. This happens only to the UI Based set module where create options and environment variables are mentioned in the question. – NILESH Commented Jan 23 at 4:20
  • I can see specified in deployment as no. There is problem with container image. – Sampath Commented Jan 23 at 4:51
  • I have added sample simulated temperature image with IoT Module name SimulatedTemperatureSensor for Iot edge custom module. using Image URI mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:latest Additionally, add a route name SimulatedTemperatureSensorToIoTHub that sends all messages from the simulated temperature module to IoT Hub with vaule of FROM /messages/modules/SimulatedTemperatureSensor/* INTO $upstream. – Sampath Commented Jan 23 at 5:27
  • Ok. let me check the image and get back. – NILESH Commented Jan 23 at 6:26
 |  Show 1 more comment

1 Answer 1

Reset to default 0

The main reason the custom module gets deployed but vanishes from the "Set Modules" section after running successfully is due to the specification in the deployment manifest being set to "no". This issue occurs when the image is not properly configured or when there are issues with the Privileged mode, routes, or binding sensitive host paths.

Refer to this MSDOC to develop Azure IoT Edge modules using Visual Studio Code.

The key change here is how the deployment manifest is structured to include the custom module, similar to the edgeAgent and edgeHub modules. This ensures that the module's configuration is correct in terms of its properties and mount points.

Below is a sample of an IoT Edge custom module using a deployment manifest for the SimulatedTemperatureSensor module:

{
  "content": {
    "modulesContent": {
      "$edgeAgent": {
        "properties.desired": {
          "schemaVersion": "1.1",
          "runtime": {
            "type": "docker",
            "settings": {
              "minDockerVersion": "v1.25",
              "loggingOptions": "",
              "registryCredentials": {}
            }
          },
          "systemModules": {
            "edgeAgent": {
              "type": "docker",
              "settings": {
                "image": "mcr.microsoft.com/azureiotedge-agent:1.5",
                "createOptions": "{}"
              }
            },
            "edgeHub": {
              "type": "docker",
              "status": "running",
              "restartPolicy": "always",
              "settings": {
                "image": "mcr.microsoft.com/azureiotedge-hub:1.5",
                "createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}"
              }
            }
          },
          "modules": {
            "SimulatedTemperatureSensor": {
              "version": "1.0",
              "type": "docker",
              "status": "running",
              "restartPolicy": "always",
              "settings": {
                "image": "mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.5",
                "createOptions": "{}"
              }
            }
          }
        }
      },
      "$edgeHub": {
        "properties.desired": {
          "schemaVersion": "1.1",
          "routes": {
            "upstream": "FROM /messages/* INTO $upstream"
          },
          "storeAndForwardConfiguration": {
            "timeToLiveSecs": 7200
          }
        }
      },
      "SimulatedTemperatureSensor": {
        "properties.desired": {
          "SendData": true,
          "SendInterval": 5
        }
      }
    }
  }
}

To deploy the deployment manifest, use the following Azure CLI command: az iot edge set-modules --device-id [device id] --hub-name [hub name] --content [file path] to deploy deployment manifest.

Refer to this MSDOC for the full deployment manifest and detailed steps.

UI Steps:

Login azure UI>> IoT hub >> click on Set Modules >> Click on Add IoT edge module.

I have added a sample simulated temperature image with the IoT module name SimulatedTemperatureSensor for the IoT Edge custom module using the image URI mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:latest. Additionally, I added a route named SimulatedTemperatureSensorToIoTHub that sends all messages from the simulated temperature module to the IoT Hub with the value FROM /messages/modules/SimulatedTemperatureSensor/* INTO $upstream.

本文标签: