Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for local MQTT broker (preview) #345

Open
grickettsnz opened this issue Aug 22, 2021 · 1 comment
Open

Support for local MQTT broker (preview) #345

grickettsnz opened this issue Aug 22, 2021 · 1 comment

Comments

@grickettsnz
Copy link

Currently, when attempting to enable the experimental local MQTT broker I'm seeing issues with edgeHub not able to start and complaining about missing environment variables. I got about 6 deep trying to supply these env vars manually before giving up on that route.

Repro steps:

sudo iotedgehubdev setup -c "<CONNECTION STRING>"
iotedgehubdev start -d deployment.json

Example deployment manifest:

{
  "$schema-template": "1.0.0",
  "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.2",
              "createOptions": "{}"
            }
          },
          "edgeHub": {
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "mcr.microsoft.com/azureiotedge-hub:1.2",
              "createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}],\"1883/tcp\":[{\"HostPort\":\"1883\"}]}}}"
            },
            "env": {
               "experimentalFeatures__mqttBrokerEnabled": {
                "value": "true"
              },
              "experimentalFeatures__enabled": {
                "value": "true"
              },
              "RuntimeLogLevel": {
                "value": "debug"
              }
            }
          }
        },
        "modules": {         
        }
      }
    },
    "$edgeHub": {
      "properties.desired": {
        "schemaVersion": "1.2",
        "routes": {
          "Upstream": "FROM /messages/* INTO $upstream"
        },
        "storeAndForwardConfiguration": {
          "timeToLiveSecs": 7200
        },
        "mqttBroker": {
          "authorizations": [
            {
              "identities": ["{{iot:identity}}"],
              "allow": [
                {
                  "operations": ["mqtt:connect"]
                }
              ]
            },
            {
              "identities": ["{{iot:identity}}"],
              "allow": [
                {
                  "operations": ["mqtt:publish", "mqtt:subscribe"],
                  "resources": ["test_topic"]
                }
              ]
            }
          ]
        }
      }
    }
  }
}

Example error:

...
at Microsoft.Azure.Devices.Edge.Hub.Service.Program.Main() in /home/vsts/work/1/s/edge-hub/core/src/Microsoft.Azure.Devices.Edge.Hub.Service/Program.cs:line 36

Error: IOTEDGE_DEVICEID

Caused by:
environment variable not found

Removing the 'experimentalFeatures__mqttBrokerEnabled' env variable allows edgeHub to start normally.

@cindydeng1998
Copy link
Contributor

cindydeng1998 commented Aug 23, 2021

Hello @grickettsnz, thank you for reporting this issue. As of now, the iotedgehubdev tool does not support the MQTT broker feature yet. We will investigate and let you know once we have an update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants