Add scripts to install opc-ua 18/1618/1
authorwutianwei <wutianwei1@huawei.com>
Thu, 19 Sep 2019 07:28:48 +0000 (07:28 +0000)
committerwutianwei <wutianwei1@huawei.com>
Thu, 19 Sep 2019 07:58:51 +0000 (07:58 +0000)
1. Running install.sh to instal the opc-ua
2. Running docker/build.sh to build the opc-ua
   image, and run the image to start opc-ua server

Signed-off-by: wutianwei <wutianwei1@huawei.com>
Change-Id: I3c85ed23c6dc3f154e628a40ab216926ad65c43d

scripts/opc-ua/docker/Dockerfile [new file with mode: 0644]
scripts/opc-ua/docker/build.sh [new file with mode: 0755]
scripts/opc-ua/install.sh [new file with mode: 0755]

diff --git a/scripts/opc-ua/docker/Dockerfile b/scripts/opc-ua/docker/Dockerfile
new file mode 100644 (file)
index 0000000..b3bafb5
--- /dev/null
@@ -0,0 +1,12 @@
+FROM centos:centos7
+ADD ./work/ /root/work
+RUN yum install -y gcc git
+RUN yum  groupinstall -y 'Development Tools'
+RUN cd /root/work && ls -al && tar xzf cmake-3.15.2.tar.gz && \
+    rpm -Uvh scons-2.3.0-1.el7.centos.noarch.rpm && \
+    python get-pip.py && \
+    cd cmake-3.15.2 && ./bootstrap && \
+    make && \
+    make install && \
+    cd ../protocol-opcua-c/ && \
+    ./build.sh
diff --git a/scripts/opc-ua/docker/build.sh b/scripts/opc-ua/docker/build.sh
new file mode 100755 (executable)
index 0000000..5360917
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+set -o errexit
+
+# set the docker name and docker tag when you build
+DOCKER_NAME=
+DOCKER_TAG=
+
+export ELIOT_DIR=$(cd $(dirname $0); pwd)
+export WORK_DIR=$ELIOT_DIR/work
+export CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz
+export SCONS_PPA_URL=http://repo.okay.com.mx/centos/7/x86_64/release//scons-2.3.0-1.el7.centos.noarch.rpm
+export GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
+export OPCUA_REPO=https://github.com/edgexfoundry-holding/protocol-opcua-c.git
+export DOCKER_NAME=${DOCKER_NAME:-"eliot/opc-ua"}
+export DOCKER_TAG=${DOCKER_TAG:-"latest"}
+
+
+rm -rf $WORK_DIR
+mkdir -p $WORK_DIR
+
+cd $WORK_DIR
+wget $CMAKE_URL
+wget $SCONS_PPA_URL
+wget $GET_PIP_URL
+git clone $OPCUA_REPO
+
+cd $ELIOT_DIR
+docker build ./ -t $DOCKER_NAME:$DOCKER_TAG
diff --git a/scripts/opc-ua/install.sh b/scripts/opc-ua/install.sh
new file mode 100755 (executable)
index 0000000..270dd7f
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/bash
+set -o errexit
+
+# set the docker name and docker tag when you build
+# export DOCKER_NAME=eliot/opc-ua
+# export DOCKER_TAG=latest
+
+export ELIOT_DIR=$(cd $(dirname $0); pwd)
+export WORK_DIR=$ELIOT_DIR/work
+export CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz
+export SCONS_PPA_URL=http://repo.okay.com.mx/centos/7/x86_64/release//scons-2.3.0-1.el7.centos.noarch.rpm
+export GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
+export OPCUA_REPO=https://github.com/edgexfoundry-holding/protocol-opcua-c.git
+export DOCKER_NAME=${DOCKER_NAME:-"eliot/opc-ua"}
+export DOCKER_TAG=${DOCKER_TAG:-"latest"}
+
+# Clean and Create the work directory
+rm -rf $WORK_DIR
+mkdir -p $WORK_DIR
+
+yum install -y gcc git wget
+yum groupinstall -y 'Development Tools'
+# Get the package and source code
+cd $WORK_DIR
+wget $CMAKE_URL
+wget $SCONS_PPA_URL
+wget $GET_PIP_URL
+git clone $OPCUA_REPO
+
+# Install Package
+rpm -Uvh scons-2.3.0-1.el7.centos.noarch.rpm
+python get-pip.py
+
+# Build and Install camke
+tar xzf cmake-3.15.2.tar.gz
+cd ${WORK_DIR}/cmake-3.15.2
+./bootstrap
+make
+make install
+
+# Build the opc-ua server and client
+cd ${WORK_DIR}/protocol-opcua-c/
+./build.sh
+
+set +x
+echo "####################################################"
+echo "# If you want to  start the server, follow below steps"
+echo "# cd ${WORK_DIR}/protocol-opcua-c/example/out"
+echo "# ./server"
+echo "####################################################"
+