Skip to content

Commit 5f4b113

Browse files
committed
More edits to correct new changes
1 parent f19dc8e commit 5f4b113

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

articles/iot-edge/how-to-vs-code-develop-module.md

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ To build and deploy your module image, you need Docker to build the module image
7272

7373
::: zone pivot="iotedge-dev-cli"
7474

75-
- Install the Python-based [Azure IoT Edge Dev Tool](https://pypi.org/project/iotedgedev/) with the following command in your terminal to set up your local development environment to debug, run, and test your IoT Edge solution. [Python (3.6/3.7)](https://www.python.org/downloads/) and [Pip3](https://pip.pypa.io/en/stable/installation/) are required.
75+
- Install the Python-based [Azure IoT Edge Dev Tool](https://pypi.org/project/iotedgedev/) with the following command to enable you to debug, run, and test your IoT Edge solution. [Python (3.6/3.7)](https://www.python.org/downloads/) and [Pip3](https://pip.pypa.io/en/stable/installation/) are required.
7676

7777
```bash
7878
pip3 install iotedgedev
7979
```
8080

8181
> [!NOTE]
8282
>
83-
> If you have multiple Python including pre-installed Python 2.7 (for example, on Ubuntu or macOS), make sure you are using `pip3` to install *IoT Edge Dev Tool (iotedgedev)*.
83+
> If you have multiple Python versions, including pre-installed Python 2.7 (for example, on Ubuntu or macOS), make sure you use `pip3` to install *IoT Edge Dev Tool (iotedgedev)*.
8484
>
8585
> For more information setting up your development machine, see [iotedgedev development setup](https://github.com/Azure/iotedgedev/blob/main/docs/environment-setup/manual-dev-machine-setup.md).
8686

@@ -109,22 +109,17 @@ Install prerequisites specific to the language you're developing in:
109109
- Install [Node.js](https://nodejs.org). Install [Yeoman](https://www.npmjs.com/package/yo) and the [Azure IoT Edge Node.js Module Generator](https://www.npmjs.com/package/generator-azure-iot-edge-module).
110110
111111
# [Python](#tab/python)
112+
::: zone pivot="iotedge-dev-ext"
112113
113-
- Install [Python](https://www.python.org/downloads/) and [Pip](https://pip.pypa.io/en/stable/installation/)
114-
- Install [Python Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
115-
- Install the Python-based [Azure IoT Edge Dev Tool](https://pypi.org/project/iotedgedev/) to debug, run, and test your IoT Edge solution. You can alternatively install the Azure IoT Edge Dev Tool using the CLI:
116-
117-
```bash
118-
pip3 install iotedgedev
119-
```
114+
Install [Python](https://www.python.org/downloads/) and [Pip](https://pip.pypa.io/en/stable/installation/).
120115
121-
> [!NOTE]
122-
>
123-
> If you have multiple Python including pre-installed Python 2.7 (for example, on Ubuntu or macOS), make sure you are using `pip3` to install *IoT Edge Dev Tool (iotedgedev)*. For more information setting up your development machine, see [iotedgedev development setup](https://github.com/Azure/iotedgedev/blob/main/docs/environment-setup/manual-dev-machine-setup.md).
116+
::: zone-end
117+
118+
Install the [Python extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python).
124119
125120
---
126121
127-
To test your module on a device:
122+
To test your module on a device, you need:
128123
129124
- An active IoT Hub with at least one IoT Edge device.
130125
- A physical IoT Edge device or a virtual device. To create a virtual device in Azure, follow the steps in the quickstart for [Linux](quickstart-linux.md) or [Windows](quickstart.md).
@@ -143,7 +138,7 @@ The [IoT Edge Dev Tool](https://github.com/Azure/iotedgedev) simplifies Azure Io
143138
mkdir c:\dev\iotedgesolution
144139
```
145140
146-
1. Use the **iotedgedev solution init** command to create a solution and set up your Azure IoT Hub for your development language.
141+
1. Use the **iotedgedev solution init** command to create a solution and set up your Azure IoT Hub in the development language of your choice.
147142
148143
# [C\#](#tab/csharp)
149144
@@ -211,9 +206,12 @@ After solution creation, these main files are in the solution:
211206
> [!NOTE]
212207
> The environment file is only created if you provide an image repository for the module. If you accepted the localhost defaults to test and debug locally, then you don't need to declare environment variables.
213208
214-
- Two module deployment files named **deployment.template.json** and **deployment.debug.template.json** list the modules to deploy to your device. By default, the list includes the IoT Edge system modules and two sample modules:
209+
- Two module deployment files named **deployment.template.json** and **deployment.debug.template.json** list the modules to deploy to your device. By default, the list includes the IoT Edge system modules (edgeAgent and edgeHub) and sample modules such as:
215210
- **filtermodule** is a sample module that implements a simple filter function.
216211
- **SimulatedTemperatureSensor** module that simulates data you can use for testing. For more information about how deployment manifests work, see [Learn how to use deployment manifests to deploy modules and establish routes](module-composition.md). For more information on how the simulated temperature module works, see the [SimulatedTemperatureSensor.csproj source code](https://github.com/Azure/iotedge/tree/master/edge-modules/SimulatedTemperatureSensor).
212+
213+
> [!NOTE]
214+
> The exact modules installed may depend on your language of choice.
217215
218216
::: zone-end
219217
@@ -224,13 +222,13 @@ Use Visual Studio Code and the [Azure IoT Edge](https://marketplace.visualstudio
224222
1. Select **View** > **Command Palette**.
225223
1. In the command palette, enter and run the command **Azure IoT Edge: New IoT Edge Solution**.
226224
227-
:::image type="content" source="./media/how-to-develop-csharp-module/new-solution.png" alt-text="Screenshot of how to run a new IoT Edge solution.":::
225+
:::image type="content" source="./media/how-to-develop-csharp-module/new-solution.png" alt-text="Screenshot of how to run a new IoT Edge solution." lightbox="./media/how-to-develop-csharp-module/new-solution.png":::
228226
229227
1. Browse to the folder where you want to create the new solution and then select **Select folder**.
230228
1. Enter a name for your solution.
231229
1. Select a module template for your preferred development language to be the first module in the solution.
232230
1. Enter a name for your module. Choose a name that's unique within your container registry.
233-
1. Provide the name of the module's image repository. Visual Studio Code autopopulates the module name with **localhost:5000/<your module name\>**. Replace it with your own registry information. Use **localhost** if you use a local Docker registry for testing. If you use Azure Container Registry, then use sign in server from your registry's settings. The sign-in server looks like **_\<registry name\>_.azurecr.io**. Only replace the **localhost:5000** part of the string so that the final result looks like **\<*registry name*\>.azurecr.io/_\<your module name\>_**.
231+
1. Provide the name of the module's image repository. Visual Studio Code autopopulates the module name with **localhost:5000/<your module name\>**. Replace it with your own registry information. Use **localhost** if you use a local Docker registry for testing. If you use Azure Container Registry, then use **Login server** from your registry's settings. The sign-in server looks like **_\<registry name\>_.azurecr.io**. Only replace the **localhost:5000** part of the string so that the final result looks like **\<*registry name*\>.azurecr.io/_\<your module name\>_**.
234232

235233
:::image type="content" source="./media/how-to-develop-csharp-module/repository.png" alt-text="Screenshot of how to provide a Docker image repository.":::
236234

@@ -304,11 +302,13 @@ The IoT Edge extension defaults to the latest stable version of the IoT Edge run
304302
...
305303
```
306304
305+
You might have to change your `.env` file for the variable `RUNTIME_TAG`, instead of changing the manifest.
306+
307307
::: zone-end
308308
309309
## Add more modules
310310
311-
To add more modules to your solution, change to *module* directory.
311+
To add more modules to your solution, change to the *modules* directory and add them there.
312312
313313
```bash
314314
cd modules
@@ -323,6 +323,8 @@ Run the command **Azure IoT Edge: Add IoT Edge Module** from the command palette
323323
324324
::: zone pivot="iotedge-dev-cli"
325325
326+
Install the modules using your language of choice.
327+
326328
# [C\#](#tab/csharp)
327329
328330
1. Install the [.NET IoT Edge C# template](https://github.com/azure/dotnet-template-azure-iot-edge-module/).
@@ -396,13 +398,13 @@ Run the command **Azure IoT Edge: Add IoT Edge Module** from the command palette
396398
# [Python](#tab/python)
397399
398400
1. Create a new directory folder in the *modules* folder and change directory to the new folder. For example, `mkdir pythonmodule` then `cd pythonmodule`.
399-
1. Get the `cookiecutter-azure-iot-edge-module` from GitHub with one of these methods:
401+
1. Get the `cookiecutter-azure-iot-edge-module` from GitHub, using one of these methods:
400402
* From another Bash terminal instance, clone the repository to your desktop with the command:
401403
```URL
402404
git clone https://github.com/Azure/cookiecutter-azure-iot-edge-module.git
403405
```
404-
* Download a ZIP of the contents of the [Cookiecutter Template for Azure IoT Edge Python Module](https://github.com/azure/cookiecutter-azure-iot-edge-module).
405-
1. Extract (if a ZIP file) the contents of the `{{cookiecutter.module_name}}` folder then copy the files into your new module directory. In this tutorial, we call this new directory **pythonmodule**.
406+
* Download a ZIP and extract the contents of the [Cookiecutter Template for Azure IoT Edge Python Module](https://github.com/azure/cookiecutter-azure-iot-edge-module).
407+
1. Copy the contents in the `{{cookiecutter.module_name}}` folder then add these files into your new module directory. In this tutorial, we call this new directory **pythonmodule**.
406408
407409
:::image type="content" source="media/how-to-vs-code-develop-module/modules-folder-structure.png" alt-text="Screenshot of the expected folder structure for your I o T Edge solution.":::
408410
@@ -568,11 +570,11 @@ When you debug modules using this method, your modules are running on top of the
568570

569571
### Build and deploy your module to an IoT Edge device
570572

571-
In Visual Studio Code, open the *deployment.debug.template.json* deployment manifest file. The [deployment manifest](module-deployment-monitoring.md#deployment-manifest) is a JSON document that describes the modules to be configured on the targeted IoT Edge device. Before deployment, you need to update your Azure Container Registry credentials and your module images with the proper `createOptions` values. For more information about createOption values, see [How to configure container create options for IoT Edge modules](how-to-use-create-options.md).
573+
In Visual Studio Code, open the *deployment.debug.template.json* deployment manifest file. The [deployment manifest](module-deployment-monitoring.md#deployment-manifest) describes the modules to be configured on the targeted IoT Edge device. Before deployment, you need to update your Azure Container Registry credentials and your module images with the proper `createOptions` values. For more information about createOption values, see [How to configure container create options for IoT Edge modules](how-to-use-create-options.md).
572574

573575
::: zone pivot="iotedge-dev-cli"
574576

575-
1. If you're using an Azure Container Registry to store your module image, add your credentials to **deployment.debug.template.json** in the *edgeAgent* settings. For example:
577+
1. If you're using an Azure Container Registry to store your module image, add your credentials to the *edgeAgent* > *settings* > *registryCredentials* section in **deployment.debug.template.json**. Replace **myacr** with your own registry name in both places and provide your password and **Login server** address. For example:
576578
577579
```json
578580
"modulesContent": {
@@ -596,7 +598,7 @@ In Visual Studio Code, open the *deployment.debug.template.json* deployment mani
596598
...
597599
```
598600
599-
1. Add or replace the following stringified content to the *createOptions* value for each system and custom module listed. Change the values if necessary.
601+
1. Add or replace the following stringified content to the *createOptions* value for each system (edgeHub and edgeAgent) and custom module (for example, tempSensor) listed. Change the values if necessary.
600602
601603
```json
602604
"createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}"
@@ -639,7 +641,7 @@ You can check your container status by running the `docker ps` command in the te
639641

640642
#### Build module Docker image
641643

642-
Use the module's Dockerfile to build the module Docker image.
644+
Use the module's Dockerfile to [build](https://docs.docker.com/engine/reference/commandline/build/) the module Docker image.
643645
644646
```bash
645647
docker build --rm -f "<DockerFilePath>" -t <ImageNameAndTag> "<ContextPath>"
@@ -659,7 +661,7 @@ docker build --rm -f "./modules/filtermodule/Dockerfile.amd64.debug" -t myacr.az
659661
660662
#### Push module Docker image
661663
662-
Push your module image to the local registry or a container registry.
664+
[Push](https://docs.docker.com/engine/reference/commandline/push/) your module image to the local registry or a container registry.
663665
664666
`docker push <ImageName>`
665667
@@ -803,12 +805,12 @@ The Docker and Moby engines support SSH connections to containers allowing you t
803805
804806
:::image type="content" source="media/how-to-vs-code-develop-module/vs-code-breakpoint.png" alt-text="Screenshot of Visual Studio Code attached to a Docker container on a remote device paused at a breakpoint.":::
805807
> [!NOTE]
806-
> The preceding example shows how to debug IoT Edge modules on remote containers. It added a remote Docker context and changes to the Docker privileges on the remote device. After you finish debugging your modules, set your Docker context to *default* and remove privileges from your user account.
808+
> The preceding example shows how to debug IoT Edge modules on remote containers. The example adds a remote Docker context and changes to the Docker privileges on the remote device. After you finish debugging your modules, set your Docker context to *default* and remove privileges from your user account.
807809
808810
See this [IoT Developer blog entry](https://devblogs.microsoft.com/iotdev/easily-build-and-debug-iot-edge-modules-on-your-remote-device-with-azure-iot-edge-for-vs-code-1-9-0/) for an example using a Raspberry Pi device.
809811
810812
## Next steps
811813
812814
After you've built your module, learn how to [deploy Azure IoT Edge modules from Visual Studio Code](how-to-deploy-modules-vscode.md).
813815
814-
To develop modules for your IoT Edge devices, [Understand and use Azure IoT Hub SDKs](../iot-hub/iot-hub-devguide-sdks.md).
816+
To develop modules for your IoT Edge devices, understand and use [Azure IoT Hub SDKs](../iot-hub/iot-hub-devguide-sdks.md).

0 commit comments

Comments
 (0)