Azure / dotnet-template-azure-iot-edge-module

Scaffolding tool for Azure IoT Edge C# module
MIT License
15 stars 23 forks source link

Docker files and module.json file are missing for v7.0.0 #97

Open AlexandrStarov opened 9 months ago

AlexandrStarov commented 9 months ago

Some files are missing for a new solution. Can't follow this instruction https://learn.microsoft.com/en-us/azure/iot-edge/tutorial-develop-for-linux?view=iotedge-1.4&tabs=csharp&pivots=iotedge-dev-ext.

image
rido-min commented 9 months ago

thanks @AlexandrStarov for your feedback.

With .NET 7, we'd like to use the latest container builds that will simplify the process by do not requiring Dockerfiles, as described in https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container?pivots=dotnet-7-0

You are right, we need to update the docs accordingly, I'll keep this issue open until the docs reflect the current change.

We have removed the PrjectCapability to reflect that the VS support for IoTEdge modules is in maintenance mode https://github.com/microsoft/vs-azure-iot-edge-docs/issues/42

AlexandrStarov commented 9 months ago

In addition to the new documentation, it would be nice to have a working example of a project on GitHub, since today it is impossible to create a new project as described in the documentation. I will be very grateful if you can share it.

I also encountered the impossibility of creating a module and connecting a common project to it. This issue is described in this item https://github.com/Azure/iotedge/issues/6606

rido-min commented 9 months ago

good suggestion, we'll provide that sample to show the e2e flow to create and deploy IoTEdge modules based on the latest template.

I believe that by adopting the new "publish container" tooling it will fix the 6606 issue.

Ilheu commented 8 months ago

I just realized this too. I'm used to module.json and dockerfiles way to work, what can I do now to build and push my module? Is there any tutorial? The Readme file is not helping me enough.

rido-min commented 8 months ago

We will provide a sample with the complete flow, including how to debug from VS, or VSCode.

For now, you can create the docker image with

https://github.com/Azure/dotnet-template-azure-iot-edge-module/blob/08326e52d5aca6218c80fb4a305fa8bc063c33bf/content/dotnet-template-azure-iot-edge-module/CSharp/README.md?plain=1#L8

Here are the docs to use this new method https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container?pivots=dotnet-7-0

if you need further customization on the base image, you can create your own base image, and then use containerbaseimage

what is missing, is the use of module.json to produce the deploymentManifest, so for now you can use the portal to deploy.

AlexandrStarov commented 8 months ago

@rido-min When can I expect new documentation?

ridomin commented 8 months ago

Hi @AlexandrStarov

Checkout this article https://dev.to/ridomin/developing-iotedge-modules-32ag and let me know if you are missing anything.

AlexandrStarov commented 8 months ago

Hi @ridomin

First of all, thanks for the article, it has become a little more transparent how to work with IoT edge.

Now I have several questions about this article:

  1. Unfortunately, there are no tips on how to transfer an existing solution to a new version. It would seem that these are big changes in the approach to how we need to work, but not a word about it. It's a pity. Is there a plan to add such an article to the site "https://learn.microsoft.com/en-us/azure/iot-edge/?view=iotedge-1.4"?
  2. In the article you suggest using aziotedge-modinit, which is not official from Microsoft. This means that there may be no more fixes and updates. It looks like there is currently no official solution that should replace outdated plugins for the Visual studio 2022 and Visual Code. Perhaps there will be some other improvements in the near future? Since now it does not seem rational to start a new commercial project with .Net 7.
  3. Is it now possible to run 2 virtual IoT edge devices locally on a work computer?
  4. Do I understand correctly that this is now a temporary version of the article, which will later be added to the site "https://learn.microsoft.com/en-us/azure/iot-edge/?view=iotedge-1.4"?
ridomin commented 8 months ago

@AlexandrStarov I see your points, however the article is not a replacement of the current tooling, instead it shows how to develop (and debug) modules without any special tool. With this in mind:

  1. The tools are in maintenance mode, what means no further updates, including the docs.
  2. aziotedge-modinit is just a workaround to initialize $edgeHub. It's a simple app (just 2 HTTP calls), and I do not think it will require any update, and if it does, it's open source !!. Do not expect any updates in VS/Code plugins. The module template will be updated to target .NET8 shortly.
  3. Not sure I understand this question. there is no such thing as virtual IoT edge device. If you mean two instances of $edgeHub, I dont think so since the ports are hardcoded.
  4. I dont think so since the docs cover multiple languages, but this is only for dotnet.

If you are happy with the current tools in VS, Code or CLI, you can continue using those, and replace the dotnet projects with the updated version.

Also, keep in mind this repo only covers the dotnet template to scaffold a project to implement a module, and does not include any feature to deploy, since it should cover multiple modules and global configuration. What I usually do, is to configure the initial deployment from the portal to produce the deploymentManifest.json, so I can deploy from the CLI.

I believe the dockerfiles included in the previous version, are no longer required, since dotnet already has better docker integration story.

AlexandrStarov commented 8 months ago

@ridomin Regarding point 3 in my previous comment. You are right, I meant to launch 2 $edgeHubs instances, which will be for two different devices.

I tried updating the projects for my current solution and updated the .Net version to 7. Fortunately, after the changes I can successfully launch using the tools in VS Code.

Unfortunately, I was unable to successfully apply your solution with "aziotedge-modinit" on my project. I understand the value of your example. But your example does not fully reflect step by step how to write such projects yourself.

Is there a publicly available roadmap for IoT products? What languages are preferable to use for writing modules? Because now it looks as if this direction is no longer planned to be developed.

ridomin commented 8 months ago

I dont think you can run two instances of $edgeHub, since each one requires exclusive access to the same ports, and AFAIK those are not configurable.

aziotedge-modinit is only required to initialize the $edgeHub module in IoTHub to have a connection string, if you already have an IoTEdge device identity initialized you can omit this step. And if you have any issues with the tool, you can report it to https://github.com/ridomin/aziotedge-modinit

I'm guessing the step by step instructions you miss are for deployment rather than develop/debug. Once you have the container image pushed to a container registry, you can follow this doc https://learn.microsoft.com/en-us/azure/iot-edge/how-to-deploy-modules-portal?view=iotedge-1.4

I'm not aware of any roadmap at this point, but I've been told IoTEdge is feature complete, and we should not expect any new features, just security and bug fixes.