Skip to content
This repository was archived by the owner on Jul 29, 2021. It is now read-only.

Commit b8d84d9

Browse files
Merge pull request #84 from hansgschossmann/master
Refactor published nodes configuration and persistency, changes and fixes in server methods
2 parents db4261e + 321ca4a commit b8d84d9

File tree

8 files changed

+941
-461
lines changed

8 files changed

+941
-461
lines changed

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This application uses the OPC Foundations's OPC UA reference stack and therefore
2020
|master|[![Build status](https://ci.appveyor.com/api/projects/status/6t7ru6ow7t9uv74r/branch/master?svg=true)](https://ci.appveyor.com/project/marcschier/iot-gateway-opc-ua-r4ba5/branch/master) [![Build Status](https://travis-ci.org/Azure/iot-gateway-opc-ua.svg?branch=master)](https://travis-ci.org/Azure/iot-gateway-opc-ua)|
2121

2222
# Building the Application
23-
The application requires the .NET Core SDK 1.1.
23+
The application requires the .NET Core SDK 2.0.
2424

2525
## As native Windows application
2626
Open the OpcPublisher.sln project with Visual Studio 2017 and build the solution by hitting F7.
@@ -34,7 +34,7 @@ From the root of the repository, in a console, type:
3434

3535
The `-f` option for `docker build` is optional and the default is to use Dockerfile. Docker also support building directly from a git repository, which means you also can build a Linux container by:
3636

37-
docker build -t <your-container-name> .https://github.com/Azure/iot-edge-opc-publisher
37+
docker build -t <your-container-name> https://github.com/Azure/iot-edge-opc-publisher
3838

3939
# Configuring the OPC UA nodes to publish
4040
The OPC UA nodes whose values should be published to Azure IoT Hub can be configured by creating a JSON formatted configuration file (defaultname: "publishednodes.json"). This file is updated and persisted by the application, when using it's OPC UA server methods "PublishNode" or "UnpublishNode".
@@ -71,9 +71,9 @@ The syntax of the configuration file is as follows:
7171
]
7272
},
7373

74-
// the format below is only supported for backward compatibility. you need to ensure that the
74+
// the format below (NodeId format) is only supported for backward compatibility. you need to ensure that the
7575
// OPC UA server on the configured EndpointUrl has the namespaceindex you expect with your configuration.
76-
// please use the ExpandedNodeId syntax instead.
76+
// please use the ExpandedNodeId format as in the examples above instead.
7777
{
7878
"EndpointUrl": "opc.tcp://<your_opcua_server>:<your_opcua_server_port>/<your_opcua_server_path>",
7979
"NodeId": {
@@ -268,10 +268,10 @@ The following options are supported:
268268
-h, --help show this message and exit
269269

270270
There are a couple of environment variables which can be used to control the application:
271-
_HUB_CS: sets the IoTHub owner connectionstring
272-
_GW_LOGP: sets the filename of the log file to use
273-
_TPC_SP: sets the path to store certificates of trusted stations
274-
_GW_PNFP: sets the filename of the publishing configuration file
271+
* _HUB_CS: sets the IoTHub owner connectionstring
272+
* _GW_LOGP: sets the filename of the log file to use
273+
* _TPC_SP: sets the path to store certificates of trusted stations
274+
* _GW_PNFP: sets the filename of the publishing configuration file
275275

276276
Command line arguments overrule environment variable settings.
277277

@@ -303,18 +303,27 @@ The Publisher OPC UA server listens by default on port 62222. To expose this inb
303303
docker run -p 62222:62222 microsoft/iot-edge-opc-publisher <applicationname> [<iothubconnectionstring>] [options]
304304

305305
### Enable intercontainer nameresolution
306-
To enable name resolution from within the container to other containers, you need to create a user define docker bridge network and connect the container to this network using the `--network`option.
306+
To enable name resolution from within the container to other containers, you need to create a user define docker bridge network and connect the container to this network using the `--network` option.
307307
Additionally you need to assign the container a name using the `--name` option as in this example:
308308

309309
docker network create -d bridge iot_edge
310310
docker run --network iot_edge --name publisher microsoft/iot-edge-opc-publisher <applicationname> [<iothubconnectionstring>] [options]
311311

312312
The container can now be reached by other containers via the name `publisher`over the network.
313313

314+
### Access other systems from within the container
315+
Other containers, can be reached using the parameters described in the "Enable intercontainer nameresolution" paragraph.
316+
If operating system on which docker is hosted is DNS enabled, then accessing all systems which are known by DNS will work..
317+
A problems occurs in a network which does use NetBIOS name resolution. To enable access to other systems (including the one on which docker is hosted) you need to start your container using the `--add-host` option,
318+
which effectevly is adding an entry to the containers host file.
319+
320+
docker run --add-host mydevbox:192.168.178.23 microsoft/iot-edge-opc-publisher <applicationname> [<iothubconnectionstring>] [options]
321+
314322
### Assigning a hostname
315323
Publisher uses the hostname of the machine is running on for certificate and endpoint generation. docker chooses a random hostname if there is none set by the `-h` option. Here an example to set the internal hostname of the container to `publisher`:
316324

317325
docker run -h publisher microsoft/iot-edge-opc-publisher <applicationname> [<iothubconnectionstring>] [options]
326+
318327
### Using bind mounts (shared filesystem)
319328
In certain use cases it may make sense to read configuration information from or write log files to locations on the host and not keep them in the container file system only. To achieve this you need to use the `-v` option of `docker run` in the bind mount mode.
320329

@@ -327,6 +336,8 @@ Storing X509 certificates does not work with bind mounts, since the permissions
327336

328337
Open the OpcPublisher.sln project with Visual Studio 2017 and start debugging the app by hitting F5.
329338

339+
If you need to access the OPC UA server in the publisher, you should ensure that the firewall setting allow access to the port the server is listening on (default: 62222).
340+
330341
## In a docker container
331342

332343
Visual Studio 2017 supports debugging of application in docker container. This is done by using docker-compose. Since this does not allow to pass command line parameters it is not convenient.

0 commit comments

Comments
 (0)