I'm working on developing an MQTT broker written in Rust, and I need to deploy it to Azure to run up there. I have successfully built a Docker image of my code and everything seems to be functioning as intended.
Now I'm trying to take my Docker image and deploy it to a module inside of an Azure IoT Edge Device. I was able to upload my Docker image to my Azure Container Registry.
My issues arise when I try to make a deployment configuration for my Edge Device. Below is my deployment.json
file
{
"$schema-template": "4.0.0",
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"schemaVersion": "1.4",
"runtime": {
"type": "docker",
"settings": {
"minDockerVersion": "v1.25",
"loggingOptions": "",
"registryCredentials": {
"My-Container-Registry": {
"username": "$CONTAINER_REGISTRY_USERNAME",
"password": "$CONTAINER_REGISTRY_PASSWORD",
"address": "<My-Container-Registry>.azurecr.io"
}
}
}
},
"systemModules": {
"edgeAgent": {
"type": "docker",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-agent:1.4",
"createOptions": {}
}
},
"edgeHub": {
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "mcr.microsoft.com/azureiotedge-hub:1.4",
"createOptions": {
"HostConfig": {
"PortBindings": {
"5671/tcp": [
{
"HostPort": "5671"
}
],
"8883/tcp": [
{
"HostPort": "8883"
}
],
"443/tcp": [
{
"HostPort": "443"
}
]
}
}
}
}
}
},
"modules": {
"BrokerModule": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "<My-Container-Registry>.azurecr.io/<my-image>:latest",
"createOptions": {
"Cmd": [
"Eula=accept"
],
"HostConfig": {
"PortBindings": {
"1883/tcp": [
{
"HostPort": "1883"
}
]
}
}
}
},
"env": {
"IP_ADDR": {
"value": "0.0.0.0"
},
"LOGGING_LEVEL": {
"value": "Debug"
}
}
}
}
}
},
"$edgeHub": {
"properties.desired": {
"schemaVersion": "1.4",
"routes": {
"BrokerModuleToIoTHub": "FROM /messages/modules/BrokerModule/outputs/* INTO $upstream"
},
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
}
}
}
}
}
Much of it was auto generated, my only requirements for this deployment are that I need to be able to listen to the MQTT port of 1883 and those two environment variables my application uses to determine where to open the broker on and the minimum logging level to use.
Below are some screenshots showing the state of my Azure portal after I complete the deployment.
I am also confused by the error codes of NA, but I am also unable to get logs from any of the modules from command line commands or the Azure Portal
Any help would be greatly appreciated, and if any more information is needed I am happy to provide what I can.
If I am unable to do this using a Rust image, then are there other ways I can upload my image without having to rewrite my code in another language that would be supported in Azure?
I've tried making a deployment.json
in both the Azure Portal and outside in Visual Studio using the Azure IoT Hub Tools extension. Both looked similar but produced the same results. I expect the modules to run and to be able to see network traffic in the MQTT protocol. I have flows set up in Node-Red to send and receive messages.
Update
After doing some digging in the logs, I've found that the edgeAgent and edgHub modules are both complaining because a parameter called 'uriString' is null. What exactly does this string need to contain. I've been using ChatGPT a bit to help, and it mentioned things like " IoT Hub endpoint, Docker registry, or any other service that the module is interacting with."