Contents¶
OpcuaExport¶
OpcuaExport service serves as OPCUA server subscribring to classified results from message bus and starts publishing meta data to OPCUA clients.
Note
:
OpcuaExport service subscribes classified results from both VideoAnalytics (video) or InfluxDBConnector (time-series) use cases. Ensure that the required service to subscribe is mentioned in the Subscribers configuration in config.json([WORK_DIR]/IEdgeInsights/OpcuaExport/config.json
).
Steps to Independently Build and Deploy the OpcuaExport Service¶
Note
For running two or more microservices, it is recommended that the user tries the use case-driven approach for building and deploying, as mentioned in Generate Consolidated Files for a Subset of Edge Insights for Industrial Services.
Steps to Independently Build the OpcuaExport Service¶
To independently build OpcuaExport service, complete the following steps:
Note
When switching between independent deployment of the service with and without config manager agent service dependency, user might run into issues with docker-compose build
w.r.t Certificates folder existence. As a workaround, run the command sudo rm -rf Certificates
to proceed with docker-compose build
.
The downloaded source code should have a directory named OpcuaExport:
cd IEdgeInsights/OpcuaExport
Copy the IEdgeInsights/build/.env file using the following command in the current folder
cp ../build/.env .
NOTE: Update the HOST_IP and ETCD_HOST variables in the .env file with your system IP.
# Source the .env using the following command: set -a && source .env && set +a
Independently build
docker-compose build
Steps to Independently Deploy OpcuaExport Service¶
User can deploy the OpcuaExport service in any of the following two ways:
Deploy OpcuaExport Service without Config Manager Agent Dependency¶
Run the following commands to deploy OpcuaExport service without Config Manager Agent dependency:
# Enter the OpcuaExport directory
cd IEdgeInsights/OpcuaExport
Copy the IEdgeInsights/build/.env file using the following command in the current folder, if not already present.
cp ../build/.env .Note: Ensure that
docker ps
is clean anddocker network ls
doesn’t have EII bridge network.
Update .env file for following:
1. HOST_IP and ETCD_HOST variables with your system IP.
2. `READ_CONFIG_FROM_FILE_ENV` value to `true` and `DEV_MODE` value to `true`.
Source the .env using the following command:
set -a && source .env && set +a
# Run the service
docker-compose -f docker-compose.yml -f docker-compose-dev.override.yml up -d
Note
OpcuaExport container restarts automatically when its config is modified in config.json
file.
If user is updating the config.json file using vi or vim
editor, it is required to append the set backupcopy=yes
in ~/.vimrc
so that the changes done on the host machine config.json gets reflected inside the container mount point.
Deploy OpcuaExport Service with Config Manager Agent Dependency¶
Run the following commands to deploy OpcuaExport service with Config Manager Agent dependency:
Note
Ensure that the Config Manager Agent image present in the system. If not, build the Config Manager Agent locally when independently deploying the service with Config Manager Agent dependency.
# Enter the OpcuaExport directory
cd IEdgeInsights/OpcuaExport
Copy the IEdgeInsights/build/.env file using the following command in the current folder, if not already present.
cp ../build/.env .
Note
Ensure that docker ps
is clean and docker network ls
does not have EII bridge network.
Update .env file for following:
1. HOST_IP and ETCD_HOST variables with your system IP.
2. `READ_CONFIG_FROM_FILE_ENV` value is set to `false`.
Copy the docker-compose.yml from IEdgeInsights/ConfigMgrAgent as docker-compose.override.yml in IEdgeInsights/OpcuaExport.
cp ../ConfigMgrAgent/docker-compose.yml docker-compose.override.yml
Copy the builder.py with standalone mode changes from IEdgeInsights/build directory
cp ../build/builder.py .Run the builder.py in standalone mode, this will generate eii_config.json and update docker-compose.override.yml
python3 builder.py -s trueBuilding the service (This step is optional for building the service if not already done in the
Independently buildable
step above)docker-compose build
For running the service in PROD mode, run the below command:
NOTE: Make sure to update
DEV_MODE
tofalse
in .env while running in PROD mode and source the .env using the commandset -a && source .env && set +a
docker-compose up -dFor running the service in DEV mode, run the below command:
NOTE: Make sure to update
DEV_MODE
totrue
in .env while running in DEV mode and source the .env using the commandset -a && source .env && set +a
docker-compose -f docker-compose.yml -f docker-compose-dev.override.yml -f docker-compose.override.yml up -d
Configuration¶
For more details on ETCD secrets and message bus endpoint configuration, visit Etcd_Secrets_Configuration.md and MessageBus Configuration respectively.
Service Bring Up¶
Complete the following steps to generate Opcua client certificates before running test client subscriber for production mode.
Refer to the following sections to build and launch OpcuaExport
Update Opcua client certificate access so that sample test program can access the certificates.
sudo chmod -R 755 ../../build/Certificates
Caution: This step will make the certs insecure. Do not do this step on a production machine.
To run a test subscriber follow the README at OpcuaExport/OpcuaBusAbstraction/c/test(
[WORK_DIR]/IEdgeInsights/OpcuaExport/OpcuaBusAbstraction/c/test
)
OPCUA Client Apps¶
OpcuaExport service has been validated with the following third party OPCUA client apps:
OPCUA CTT tool (https://opcfoundation.org/developer-tools/certification-test-tools/opc-ua-compliance-test-tool-uactt/)
UaExpert (https://www.unified-automation.com/downloads/opc-ua-clients.html)
Integrated Objects (https://integrationobjects.com/sioth-opc/sioth-opc-unified-architecture/opc-ua-client/)
Prosys OPCUA client app(https://www.prosysopc.com/products/opc-ua-browser/)
Note
To connect with OPCUA client apps, User needs to take backup opcua_client_certificate.der([WORK_DIR]/IEdgeInsights/opcua_client_certificate.der
) and copy OPCUA client apps certificate to it.
sudo chmod -R 755 ../../build/Certificates
cp <OPCUA client apps certificate> ../build/Certificates/opcua/opcua_client_certificate.der
Ensure not to bring down ConfigMgrAgent(ia_configmgr_agent) service, however restart necessary services like ia_opcua_export to reflect the changes.
Running in Kubernetes environment
Install provision and deploy helm chart
cd ../build/helm-eii/
helm install eii-gen-cert eii-gen-cert/
This will generate the Certificates under eii-deploy/Certificates
folder.
sudo chmod -R 755 eii-deploy/Certificates
To connect with OPCUA client apps, user needs to copy OPCUA client apps certificate to opcua_client_certificate.der([WORK_DIR]/IEdgeInsights/opcua_client_certificate.der
).
Deploy Helm Chart
helm install eii-deploy eii-deploy/
Access Opcua server using “opc.tcp://