.. role:: raw-html-m2r(raw) :format: html Contents ======== * `Contents <#contents>`__ * `OpcuaExport <#opcuaexport>`__ * `Steps to Independently Build and Deploy OpcuaExport Service <#steps-to-independently-build-and-deploy-opcuaexport-service>`__ * `Steps to Independently Build OpcuaExport Service <#steps-to-independently-build-opcuaexport-service>`__ * `Steps to Independently Deploy OpcuaExport Service <#steps-to-independently-deploy-opcuaexport-service>`__ * `Deploy OpcuaExport Service without Config Manager Agent Dependency <#deploy-opcuaexport-service-without-config-manager-agent-dependency>`__ * `Deploy OpcuaExport Service with Config Manager Agent Dependency <#deploy-opcuaexport-service-with-config-manager-agent-dependency>`__ * `Configuration <#configuration>`__ * `Service Bring Up <#service-bring-up>`__ * `OPCUA Client Apps <#opcua-client-apps>`__ 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: .. code-block:: sh cd IEdgeInsights/OpcuaExport #. Copy the IEdgeInsights/build/.env file using the following command in the current folder .. code-block:: sh cp ../build/.env . .. **NOTE**\ : Update the HOST_IP and ETCD_HOST variables in the .env file with your system IP. .. code-block:: sh # Source the .env using the following command: set -a && source .env && set +a #. Independently build .. code-block:: sh 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: .. code-block:: sh # 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. .. code-block:: sh cp ../build/.env . **Note:** Ensure that ``docker ps`` is clean and ``docker network ls`` doesn't have EII bridge network. .. code-block:: 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 .. code-block:: sh # 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. .. code-block:: sh # 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. .. code-block:: sh cp ../build/.env . .. note:: Ensure that ``docker ps`` is clean and ``docker network ls`` does not have EII bridge network. .. code-block:: 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. .. code-block:: sh cp ../ConfigMgrAgent/docker-compose.yml docker-compose.override.yml .. Copy the builder.py with standalone mode changes from IEdgeInsights/build directory .. code-block:: sh cp ../build/builder.py . Run the builder.py in standalone mode, this will generate eii_config.json and update docker-compose.override.yml .. code-block:: sh python3 builder.py -s true Building the service (This step is optional for building the service if not already done in the ``Independently buildable`` step above) .. code-block:: sh docker-compose build For running the service in PROD mode, run the below command: **NOTE**\ : Make sure to update ``DEV_MODE`` to ``false`` in .env while running in PROD mode and source the .env using the command ``set -a && source .env && set +a`` .. code-block:: sh docker-compose up -d For running the service in DEV mode, run the below command: **NOTE**\ : Make sure to update ``DEV_MODE`` to ``true`` in .env while running in DEV mode and source the .env using the command ``set -a && source .env && set +a`` .. code-block:: sh 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 * `../README.md#generate-deployment-and-configuration-files `_ * `../README.md#provision `_ * `../README.md#build-and-run-eii-videotimeseries-use-cases `_ #. Update Opcua client certificate access so that sample test program can access the certificates. .. code-block:: sh 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. .. code-block:: sh sudo chmod -R 755 ../../build/Certificates cp ../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 .. code-block:: sh cd ../build/helm-eii/ helm install eii-gen-cert eii-gen-cert/ This will generate the Certificates under ``eii-deploy/Certificates`` folder. .. code-block:: sh 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 .. code-block:: sh helm install eii-deploy eii-deploy/ Access Opcua server using "opc.tcp://\ :raw-html-m2r:``\ :32003" endpoint.