The Azure IoT Edge Dev Tool greatly simplifies your Azure IoT Edge development process. It has everything you need to get started and helps with your day-to-day Edge development.
Перейти к файлу
Chaoyi Yuan 98c906bb62
Fix error when start simulator with setup option (#418)
* Fix error when start simulator with --setup option

* Bump version to 2.1.1

* Install fixed version of Azure CLI IoT extension

* Do not support 3.8 due to Azure CLI IoT extension incompatible
2019-12-16 13:25:19 +08:00
.github/ISSUE_TEMPLATE Adding issue templates (#266) 2018-08-20 07:06:13 -07:00
.vscode enable e2e test case for iotedgedev 2018-12-07 20:34:10 +08:00
assets Add quickstart video (#161) 2018-04-18 16:17:00 -07:00
docker Fix host.docker.internal not available in linux docker issue (#382) 2019-03-22 11:32:13 +08:00
iotedgedev Fix error when start simulator with setup option (#418) 2019-12-16 13:25:19 +08:00
scripts Update gen-help-markdown.bat (#310) 2018-08-28 11:32:19 +08:00
tests Fix error when start simulator with setup option (#418) 2019-12-16 13:25:19 +08:00
vsts_ci Fix error when start simulator with setup option (#418) 2019-12-16 13:25:19 +08:00
.env.tmp Add better Docker Hub instructions (#399) 2019-07-09 15:07:58 +08:00
.gitignore Add iotedgehubdev integration (#233) 2018-08-15 12:17:29 -07:00
.travis.yml Fix error when start simulator with setup option (#418) 2019-12-16 13:25:19 +08:00
CHANGELOG.md Fix error when start simulator with setup option (#418) 2019-12-16 13:25:19 +08:00
CODE_OF_CONDUCT.md update license file, update code of conduct (#172) 2018-05-15 09:10:17 -07:00
CONTRIBUTING.md Add telemetry and CLA statements (#355) 2018-11-02 11:38:00 +08:00
LICENSE update license file, update code of conduct (#172) 2018-05-15 09:10:17 -07:00
MANIFEST.in Retire history.rst 2018-11-01 17:29:47 +08:00
Makefile Init Commit 2017-12-29 16:39:34 -08:00
README.md Update Azure DevOps badge to point to mseng (#367) 2018-12-10 14:05:56 +08:00
build.sh Modify build.sh to run from Linux. (#329) 2018-10-08 23:09:25 +08:00
cleanup.sh Added support for windows containers via nanoserver (#158) 2018-08-10 14:29:44 -07:00
pytest.ini Configure travis for unit tests (#195) 2018-06-29 11:12:00 -07:00
requirements.txt Fix case sensitivity for 'click' package (#389) 2019-05-07 15:47:14 +08:00
requirements_dev.txt Buildupdates (#304) 2018-08-23 17:26:05 -07:00
requirements_travis.txt Remove DOTNET_VERBOSITY from env. Update requirements.txt. Fix push. (#272) 2018-08-20 18:17:02 -07:00
setup.cfg Fix error when start simulator with setup option (#418) 2019-12-16 13:25:19 +08:00
setup.py Fix error when start simulator with setup option (#418) 2019-12-16 13:25:19 +08:00
tox.ini Fix error when start simulator with setup option (#418) 2019-12-16 13:25:19 +08:00
travis_pypi_setup.py Update to Tool and simplify pypi package name (#149) 2018-04-08 21:45:01 +09:00

README.md

Azure IoT Edge Dev Tool

PyPI version Travis Build Status Build Status

The IoT Edge Dev Tool greatly simplifies Azure IoT Edge development down to simple commands driven by environment variables.

  • It gets you started with IoT Edge development with the IoT Edge Dev Container and IoT Edge solution scaffolding that contains a default module and all the required configuration files.
  • It speeds up your inner-loop dev (dev, debug, test) by reducing multi-step build & deploy processes into one-line CLI commands as well as drives your outer-loop CI/CD pipeline. You can use all the same commands in both stages of your development life-cycle.

Overview

For the absolute fastest way to get started with IoT Edge Dev, please see the Quickstart section below.

For a more detailed overview of IoT Edge Dev Tool including setup and commands, please see the Wiki.

Quickstart

To set up development machines manually instead of using the IoT Edge Dev Container, please see the Manual Development Machine Setup Wiki.

This quickstart will run a container, create a solution, setup Azure resources, build and deploy modules to your device, setup and start the IoT Edge simulator, monitor messages flowing into IoT Hub, and finally deploy to the IoT Edge runtime.

The only thing you need to install is Docker. All of the other dev dependencies are included in the container.

  1. Install Docker CE

    • For Windows, please follow the document to open Docker Settings and setup a Shared Drive.
    • For macOS, please follow the document to choose local directories to share with your containers.
  2. Run the IoT Edge Dev Container

    Before you run the container, you will need to create a local folder to store your IoT Edge solution files.

    Windows

    mkdir c:\temp\iotedge
    docker run -ti -v /var/run/docker.sock:/var/run/docker.sock -v c:/temp/iotedge:/home/iotedge microsoft/iotedgedev
    

    Linux

    sudo mkdir /home/iotedge
    sudo docker run -ti -v /var/run/docker.sock:/var/run/docker.sock -v ~/iotedge:/home/iotedge microsoft/iotedgedev
    

    macOS

    mkdir ~/iotedge
    docker run -ti -v /var/run/docker.sock:/var/run/docker.sock -v ~/iotedge:/home/iotedge microsoft/iotedgedev
    
  3. Initialize IoT Edge solution and setup Azure resources

    iotedgedev init

    iotedgedev init will create a solution and setup your Azure IoT Hub in a single command. The solution comes with a default C# module named filtermodule.

    More information
    1. You will see structure of current folder like below:
        │  .env
        │  .gitignore
        │  deployment.debug.template.json
        │  deployment.template.json
        │
        ├─.vscode
        │      launch.json
        │
        └─modules
            └─filtermodule
                │  .gitignore
                │  Dockerfile.amd64
                │  Dockerfile.amd64.debug
                │  Dockerfile.arm32v7
                │  Dockerfile.windows-amd64
                │  filtermodule.csproj
                │  module.json
                │  Program.cs
    
    1. Open .env file, you will see the IOTHUB_CONNECTION_STRING and DEVICE_CONNECTION_STRING environment variables filled correctly.

    2. Open deployment.template.json file

      1. You will see below section in the modules section:
      "filtermodule": {
          "version": "1.0",
          "type": "docker",
          "status": "running",
          "restartPolicy": "always",
          "settings": {
              "image": "${MODULES.filtermodule}",
              "createOptions": {}
          }
      }
      
      1. Two default routes are added:
      "routes": {
          "sensorTofiltermodule": "FROM /messages/modules/tempSensor/outputs/temperatureOutput INTO BrokeredEndpoint(\"/modules/filtermodule/inputs/input1\")",
          "filtermoduleToIoTHub": "FROM /messages/modules/filtermodule/outputs/* INTO $upstream"
      }
      
    3. You will see privacy statement like below:

      Welcome to iotedgedev!
      -------------------------
      Telemetry
      ---------
      The iotedgedev collects usage data in order to improve your experience.
      The data is anonymous and does not include commandline argument values.
      The data is collected by Microsoft.
      
      You can change your telemetry settings by updating 'collect_telemetry' to 'no' in ~/.iotedgedev/setting.ini
      
  4. Build IoT Edge module images

    sudo iotedgedev build

    This step will build user modules in deployment.template.json targeting amd64 platform.

    More information
    1. You will see a "BUILD COMPLETE" for each module and no error messages in the terminal output.
    2. Open config/deployment.amd64.json file, you will see the module image placeholders expanded correctly.
    3. Run sudo docker image ls, you will see the module images you just built.
  5. Setup and start the IoT Edge Simulator to run the solution

    sudo iotedgedev start --setup --file config/deployment.amd64.json

    IoT Edge Simulator does not support running Python and C modules yet. You'll need IoT Edge Runtime to run your Python and C modules.

    More information
    1. You will see an "IoT Edge Simulator has been started in solution mode." message at the end of the terminal output
    2. Run sudo docker ps, you will see your modules running as well as an edgeHubDev container
  6. Monitor messages sent from IoT Edge Simulator to IoT Hub

    iotedgedev monitor

    More information
    1. You will see your expected messages sending to IoT Hub

Resources

Please refer to the Wiki for details on setup, usage, and troubleshooting.

Data/Telemetry

This project collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you dont wish to send usage data to Microsoft, you can change your telemetry settings by updating collect_telemetry to no in ~/.iotedgedev/settings.ini.

Contributing

This project welcomes contributions and suggestions. Please refer to the Contributing file for details on contributing changes.

Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.