-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better explain how to set the configuration file. #2324
Labels
documentation
Issue in the documentation
Milestone
Comments
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. |
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:
* --pf=<path>: Specifies the path to the published nodes configuration file.
* --di: Enables diagnostics output.
* --pn=<port>: Specifies the port on which the publisher listens for incoming telemetry.
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:
* PUBLISHERCONFIGURATIONFILE: Path to the configuration file.
* OPCPUBLISHER_TELEMETRY_PORT: Sets the telemetry port.
* OPCPUBLISHER_LOGLEVEL: Configures the log level.
Example in a Docker docker-compose.yml file:
yaml
services:
opcpublisher:
image: mcr.microsoft.com/iotedge/opc-publisher
environment:
- PUBLISHERCONFIGURATIONFILE=/app/publishednodes.json
- OPCPUBLISHER_LOGLEVEL=info
- OPCPUBLISHER_TELEMETRY_PORT=62222
volumes:
- ./publishednodes.json:/app/publishednodes.json
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 <your-iot-hub> --device-id <your-device-id> --module-name <opc-publisher> --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 GitHub<#2324 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJ2NCA6KX7Q3TPH4SM2L5LTZTLDABAVCNFSM6AAAAABNDCOBO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBZGQZDGMRRHE>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
marcschier
changed the title
Please explain how to deploy the configuration file, including Name and Path.
Better explain how to set the configuration file.
Sep 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please explain how to deploy the configuration file, including file Name and Path.
The text was updated successfully, but these errors were encountered: