Skip to content

How to edit deployment.*.template.json

Wei Shen edited this page Dec 18, 2019 · 8 revisions

Description

"deployment.*.template.json" is compatible with the edge deployment manifest JSON document. And after running command "Azure IoT Edge: Build/Build and Push Edge Solution" or "Azure IoT Edge: Generate IoT Edge Deployment manifest". The final edge deployment manifest "deployment.*.json" will be generated under "config" folder.

"deployment.*.template.json" helps to improve manifest editing experience. And also provide the capability to parse environment variables, module reference schema. Following list the differences between "deployment.*.template.json" and edge deployment manifest.

  • "createOptions" supports JSON object in "deployment.*.template.json" while the value should be string in edge deployment manifest.

  • Environment variables could be used in "deployment.*.template.json". For example "$VALUE", and it will be expanded in the generated edge deployment manifest.

  • Module reference schema

    The module reference schema enables the deployment template to reference the module dynamically. When building, it could easily pick the docker file of target platform and build the referenced module from source code and auto-fill the image tag. The default target image platform is got from the VS Code global setting "Default platform of IoT Edge Solution".

    1. Reference the module under the "modules" folder. For example the "csharpmodule" under "modules" folder

      ${MODULES.csharpmodule}

      ${MODULES.csharpmodule.debug}

      ${MODULES.csharpmodule.[platform key]}

      For example ${MODULES.csharpmodule.amd64.debug}. Since platform key is provided explicitly, the default platform setting is ignored in this case.

    2. Reference the module outside the current solution, or other path. For example a module at relative path "../../outmodule"

      ${MODULEDIR.<../../outmodule>}

      ${MODULEDIR.<../../outmodule>.debug}

      ${MODULEDIR.<../../outmodule>.[platform key]}

      For example ${MODULEDIR.<../../outmodule>.amd64.debug}. Since platform key is provided explicitly, the default platform setting is ignored in this case.

Build the Edge solution with deployment.*.template.json

When run running command "Azure IoT Edge: Build/Build and Push Edge Solution", it will

  • Stringfy the "createOptions" JSON object and fill in the string value.
  • Build the modules referenced through module schema. And fill in the image tag. The taget platform is pick from the global setting "Default platform of IoT Edge Solution". The setting could be updated through command "Azure IoT Edge: Set default target platform for Edge Solution". With the default platform, docker file is picked from "module.json" file under the module folder.
  • Expand the environment variables.
  • The final edge deployment manifest could be found under "config" folder as deployment.*.json