The startProxy 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 device name that is registered at the Azure IoT Hub (only lower case and no space allowed)
set DEVICENAME=proxy-iisk
::# The version tag of the iot-edge-opc-proxy
set PROXYVERSION=1.0.4
::# The name of the docker network
set DOCKER_NETWORK_NAME=iot_edge

The variable DEVICENAME defines the name that is used for device registration at the Azure IoT Hub. The device name shall be all lower case and must not include spaces.
The variable PROXYVERSION 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 network create -d bridge %DOCKER_NETWORK_NAME%

Create a network bridge with name of variable DOCKER_NETWORK_NAME. For more details read: https://docs.docker.com/engine/reference/commandline/network_create/.

::# Initially run the proxy to register itself at the IoT-hub:
docker container stop proxy
docker container rm proxy

Stop the docker container named proxy if it is running. For more datails, read https://docs.docker.com/engine/reference/commandline/container_stop/.
Remove the docker container proxy if it exists. For more details, read https://docs.docker.com/engine/reference/commandline/container_rm/

docker run -it --rm --name proxy --network %DOCKER_NETWORK_NAME% -v %DOCKER_SHARED_ROOT%:/mapped microsoft/iot-edge-opc-proxy:%PROXYVERSION% --name %DEVICENAME% -i -c "%_HUB_CS%" -D /mapped/cs.db

Parameters for docker:
* docker run - run the docker container
* -it
* --rm
* --name proxy - name the container proxy
* --network %DOCKER_NETWORK_NAME% - connect to network defined in variable DOCKER_NETWORK_NAME
* -v %DOCKER_SHARED_ROOT%:/mapped

The name of the docker image:
* microsoft/iot-edge-opc-proxy:%PROXYVERSION%

Parameters for the container:
* --name %DEVICENAME%
* -i
* -c "%_HUB_CS%"
* -D /mapped/cs.db

For more details, read https://docs.docker.com/engine/reference/commandline/container_run/.

::# Run the proxy permanently, so that the connected factory could connect to OPC UA servers through the proxy tunnel:
docker run -it --restart always --name proxy --network %DOCKER_NETWORK_NAME% -v %DOCKER_SHARED_ROOT%:/mapped --add-host "%PUBHOSTNAME% %MYFQDN%":%MYIP% microsoft/iot-edge-opc-proxy:%PROXYVERSION% -D /mapped/cs.db

Parameters for docker:
* docker run - run the docker container
* -it
* --restart always - always restart the container
* --name proxy - name the container proxy
* --network %DOCKER_NETWORK_NAME% - connect to network defined in variable DOCKER_NETWORK_NAME
* -v %DOCKER_SHARED_ROOT%:/mapped
* --add-host "%PUBHOSTNAME% %MYFQDN%":%MYIP% - Create entry in file /etc/hosts within the container

The name of the docker image:
* microsoft/iot-edge-opc-proxy:%PROXYVERSION%

Parameters for the container:
* -D /mapped/cs.db

Further info about the iot-edge-opc-proxy


Continue reading with:
* Table of Content
* IISK Configuration


Version: Documentation-v1.1.0