Azure / Industrial-IoT

Azure Industrial IoT Platform
MIT License
529 stars 214 forks source link

Better explain how to set the configuration file. #2324

Closed uriel-kluk closed 1 month ago

uriel-kluk commented 3 months ago

Please explain how to deploy the configuration file, including file Name and Path.

marcschier commented 3 months ago

I am not sure what is the ask here. the configuration file is provided to publisher using the --pf command line option. If you are using docker, add a docker volume mount (see readme, examples, samples etc.) and the file in there, and reference via --pf, see other command line options in the help.

uriel-kluk commented 3 months ago

Thanks Marc,

The comprehensive documentation wasn't very intuitive for me as a first-time user of this project, but your references to command-line options and environment variables clarified the issue.

Could I recommend to help developers to extend the documentation like this:

OPC Publisher Configuration The simplest way to configure OPC Publisher is via a configuration file. A basic configuration file looks like this:

[ { "EndpointUrl": "opc.tcp://testserver:62541/Quickstarts/ReferenceServer", "UseSecurity": true, "OpcNodes": [ { "Id": "i=2258", "OpcSamplingInterval": 2000, "OpcPublishingInterval": 5000, "DisplayName": "Current time" } ] } ]

This configuration can be placed in a JSON file, typically named publishednodes.json, and provided to OPC Publisher at runtime. Configuring via Command Line In addition to using a configuration file, OPC Publisher can be configured via command-line options. This is useful for overriding settings or quickly testing changes. Some common command-line parameters include:

Example usage:

iotedgehubdev start -d deployment.json --pf=/app/publishednodes.json --di

Configuring via Environment Variables Environment variables can also be used to configure OPC Publisher. This method is particularly useful when deploying at scale or in environments where you want to externalize configuration from the container image. Some environment variables you might use include:

Example in a Docker docker-compose.yml file:

yaml services: opcpublisher: image: mcr.microsoft.com/iotedge/opc-publisher environment:

Automating Deployment at Scale For large-scale deployments, automating the configuration and management of OPC Publisher is critical. This can be achieved using Azure IoT Hub's Cloud-to-Device (C2D) messaging. C2D commands allow you to remotely configure and control OPC Publisher instances running on IoT Edge devices. For example, you can send commands to update the configuration, restart the module, or change runtime parameters without needing to manually intervene on each device. Example of sending a C2D command to update configuration:

bash az iot hub invoke-module-method --hub-name --device-id --module-name --method-name UpdateConfiguration --method-payload '{"OpcNodes": [{"EndpointUrl": "opc.tcp://new-opc-server:4840", "OpcNodes": [{"Id": "ns=2;i=10853"}]}]}'

This method allows you to dynamically adjust the configuration across multiple devices, ensuring that your deployment remains flexible and responsive to changes.


From: Marc Schier @.> Sent: Monday, August 26, 2024 1:26 AM To: Azure/Industrial-IoT @.> Cc: Uriel Kluk @.>; Author @.> Subject: Re: [Azure/Industrial-IoT] Please explain how to deploy the configuration file, including Name and Path. (Issue #2324)

I am not sure what is the ask here. the configuration file is provided to publisher using the --pf command line option. If you are using docker, add a docker volume mount (see readme, examples, samples etc.) and the file in there, and reference via --pf, see other command line options in the help.

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/Industrial-IoT/issues/2324#issuecomment-2309423219, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJ2NCA6KX7Q3TPH4SM2L5LTZTLDABAVCNFSM6AAAAABNDCOBO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBZGQZDGMRRHE. You are receiving this because you authored the thread.Message ID: @.***>

marcschier commented 1 month ago

Updated documentation where necessary with additional information.