The startpublisher script

::# Please set the following variables to your local requirements:
::# Define your IoT-hub connection string without quotes
set _HUB_CS='replace with your connection string'

The variable _HUB_CS must contain the IoT-Hub connection string

::# Set the docker shared root variable, so that the docker containers could access the files stored on your real drive:
::# In the example below, it is assumed, that drive C: is a shared drive for docker, and it contains the directory docker.
set DOCKER_SHARED_ROOT=//C/docker

The variable DOCKER_SHARED_ROOT defines the directory which is shared between the container and the host computer and pre-configured to C:\docker

::# Insert the IP address of the IISK computer:
set MYIP=10.123.45.27
::# Insert the hostname of the IISK computer:
set MYHOSTNAME=iisk
::# Insert the domain name with leading dot '.'. (If there is no domain name define the variable as empty string):
set MYDOMAINNAME=.example.com

The variable MYIP defines the IPv4 address where the iot-edge-opc-publisher can be reached. Set this to the IPv4 address of the IISK.
The variable MYHOSTNAME must be set to the hostname of the IISK computer.
The variable MYDOMAINNAME defines the the domain name of iot-edge-opc-publisher.

::# The version tag of the iot-edge-opc-publisher
set PUBLISHERVERSION=2.1.4
::# The name of the docker network
set DOCKER_NETWORK_NAME=iot_edge

The variable PUBLISHERVERSION defines the version tag of the docker image that shall be used.
The variable DOCKER_NETWORK_NAME defines the name of the network bridge. This must be the same in the startProxy.bat and startPublisher.bat scripts.

set MYFQDN=%MYHOSTNAME%%MYDOMAINNAME%
set PUBHOSTNAME=publisher%MYDOMAINNAME%

The variables MYFQDN andPUBHOSTNAME are derived from already set environment variables.
The hostname within the variable PUBHOSTNAME must not be changed and is always publisher.

docker container stop iot-edge-opc-publisher
docker container rm iot-edge-opc-publisher
docker network create -d bridge %DOCKER_NETWORK_NAME%

Stop the docker container named iot-edge-opc-publisher if it is running
Remove the docker container iot-edge-opc-publisher if it exists
Create a network bridge with name of variable DOCKER_NETWORK_NAME. For more details read: https://docs.docker.com/engine/reference/commandline/network_create/.

::# Run the publisher permanently, so that it is accessible by port 62222 from the "outside"
docker run -it --restart always --network %DOCKER_NETWORK_NAME% -h publisher --name iot-edge-opc-publisher -p 62222:62222 --add-host "%MYFQDN%":%MYIP% -v %DOCKER_SHARED_ROOT%:/docker -v myx509certstore:/root/.dotnet/corefx/cryptography/x509stores microsoft/iot-edge-opc-publisher:%PUBLISHERVERSION% %PUBHOSTNAME% "%_HUB_CS%" --lf ./publisher.log.txt --pf /docker/publishednodes.json --ih Http1 --as true --ns true --tm true --si 0 --ms 0 --trustedcertstorepath=/docker/CertificateStores/trusted --rejectedcertstorepath=/docker/CertificateStores/rejected

Parameters for docker:
* docker run - run the docker container
* -it
* --restart always - always restart the container
* --network %DOCKER_NETWORK_NAME% - connect to network defined in variable DOCKER_NETWORK_NAME
* -h publisher
* --name iot-edge-opc-publisher - name the container iot-edge-opc-publisher
* -p 62222:62222 - map ports
* --add-host %MYFQDN%":%MYIP% - Create entry in file /etc/hosts within the container
* -v %DOCKER_SHARED_ROOT%:/docker
* -v myx509certstore:/root/.dotnet/corefx/cryptography/x509stores

The name of the docker image:
* microsoft/iot-edge-opc-publisher:%PUBLISHERVERSION%

Parameters for the container:
* %PUBHOSTNAME% "%_HUB_CS%"
* --lf ./publisher.log.txt
* --pf /docker/publishednodes.json
* --ih Http1
* --as true
* --tm true
* --si 0
* --ms 0
* --trustedcertstorepath=/docker/CertificateStores/trusted
* --rejectedcertstorepath=/docker/CertificateStores/rejected

Further info about the iot-edge-opc-publisher

pause

Pause to prevent exiting the console - may be useful to read messages in case of error


Continue reading with:
* Table of Content
* IISK Configuration


Version: Documentation-v1.1.0