Skip to main content

Example Manifest

Let's have a closer look at a specific IoT Edge deployment manifest, which includes the essential $edgeAgent and $edgeHub modules, along with custom modules OpcPublisher and factsSqlModule. This manifest exemplifies how to establish a multifaceted IoT Edge device setup, showcasing the configuration of modules, the creation of custom routes for data flow, and the management of detailed module properties.

{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"schemaVersion": "1.1",
"runtime": {
"type": "docker",
"settings": {
"registryCredentials": {
"Facts": {
"address": "facts.example.io",
"password": "password",
"username": "user"
}
}
}
},
"systemModules": {
"edgeAgent": {
"env": {
"SendRuntimeQualityTelemetry": {
"value": false
}
},
"settings": {
"image": "mcr.microsoft.com/azureiotedge-agent:1.4"
},
"type": "docker"
},
"edgeHub": {
"restartPolicy": "always",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-hub:1.4",
"createOptions": "{\"HostConfig\":{\"PortBindings\":{\"443/tcp\":[{\"HostPort\":\"443\"}],\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}]}}}"
},
"status": "running",
"type": "docker"
}
},
"modules": {
"OpcPublisher": {
"env": {},
"restartPolicy": "always",
"settings": {
"image": "mcr.microsoft.com/iotedge/opc-publisher:2.8.3",
"createOptions": "{\"HostName\":\"OpcPublisher\",\"Cmd\":[\"OpcPublisher\",\"--autoaccept\",\"--trustowncert\",\"--publishfile=/iot/pn.json\",\"--diagnosticsinterval=30\",\"--iothubsendinterval=1\"],\"HostConfig\":{\"Binds\":[\"/iot:/iot\"],\"LogConfig\":{\"Config\":{\"max-size\":\"5m\",\"max-file\":\"20\"},\"Type\":\"json-file\"}}}"
},
"status": "running",
"type": "docker"
},
"factsSqlModule": {
"env": {},
"restartPolicy": "always",
"settings": {
"image": "facts.example.io/iotedge/sql-publisher:latest-amd64",
"createOptions": "{\"Cmd\":[\"--verbose\"],\"HostConfig\":{\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"10m\",\"max-file\":\"25\"}}}}"
},
"status": "running",
"type": "docker"
}
}
}
},
"$edgeHub": {
"properties.desired": {
"schemaVersion": "1.1",
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
},
"routes": {
"factsSqlModule": {
"priority": 0,
"route": "FROM /messages/modules/factsSqlModule/* INTO $upstream",
"timeToLiveSecs": 7200
},
"OpcPublisher": {
"priority": 0,
"route": "FROM /messages/modules/OpcPublisher/* INTO $upstream",
"timeToLiveSecs": 7200
}
}
}
},
"factsSqlModule": {
"properties.desired": {
"queryconfigA": {
"messageSubject": "",
"from": "",
"queryIntervalSeconds": "",
"sqlServer": "",
"sqlDatabase": "",
"sqlUser": "",
"sqlPassword": "",
"sqlQuery": ""
}
}
}
}
}
  • modulesContent: This is the root element of the manifest and contains configuration for all the modules that will be deployed to the IoT Edge device.

  • $edgeAgent: This is one of the two required modules in an IoT Edge deployment, and it manages the lifecycle of modules on the IoT Edge device.

    • properties.desired: Contains the desired configuration for the Edge Agent.
      • schemaVersion: The version of the Edge Agent schema used in the manifest.
      • runtime: Contains the runtime settings for the IoT Edge device.
        • type: Specifies the type of runtime used by the Edge Agent. In this case, Docker is used.
        • settings: Contains settings for the runtime.
          • registryCredentials: Contains the credentials for accessing a private Docker registry.
      • systemModules: Contains configuration for the system modules of the IoT Edge device, which are edgeAgent and edgeHub.
  • $edgeHub: The second required module in an IoT Edge deployment. It manages communication between modules and between the device and IoT Hub.

    • properties.desired: Contains the desired configuration for the Edge Hub.
      • routes: Defines how messages are passed between modules and between the device and IoT Hub.
      • storeAndForwardConfiguration: Configures how the Edge Hub should store and forward messages if the device's connection to the IoT Hub is interrupted.
  • Custom modules: In addition to the system modules, you can also add your own custom modules. The manifest you provided includes two custom modules: OpcPublisher and factsSqlModule.

    • Each custom module has a similar structure with a set of properties including env, restartPolicy, settings, and status.
      • env: Contains environment variables for the module.
      • restartPolicy: Defines when and if the IoT Edge agent should restart the module if it stops.
      • settings: Contains settings for the module, such as the Docker image to use and any createOptions to configure the image on startup.
      • status: Specifies whether the module should be running or stopped when first deployed.
  • Routes: These are declared within the $edgeHub module and they specify how messages flow between modules and eventually to the IoT Hub. The provided manifest contains routes for both OpcPublisher and factsSqlModule.

    • Each route has a priority, a route string specifying the message flow, and a time to live in seconds.
  • Desired properties: These are additional properties for each module that are declared outside the $edgeAgent and $edgeHub sections. The provided manifest includes desired properties for factsSqlModule.