From 380b7afc7c81a13c3025de0efed050ddbd1d929b Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 23 Aug 2018 15:54:30 +0000 Subject: Controller Blueprints Microservice Add Docker Build and Deploy Maven Implementations for Controller Blueprint MS and their dependencies Change-Id: I9eee9fff535bcc9ca0b855150892ce53af126d1c Issue-ID: CCSDK-483 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- ms/controllerblueprints/application/pom.xml | 75 ++++----- .../application/src/assembly/distribution.xml | 72 -------- .../application/src/main/dc/docker-compose.yaml | 36 ---- .../application/src/main/docker/Dockerfile | 17 -- .../application/src/main/docker/startService.sh | 8 - ms/controllerblueprints/distribution/pom.xml | 187 +++++++++++++++++++++ .../distribution/src/main/dc/docker-compose.yaml | 36 ++++ .../distribution/src/main/docker/Dockerfile | 20 +++ .../distribution/src/main/docker/distribution.xml | 72 ++++++++ .../distribution/src/main/docker/startService.sh | 8 + ms/controllerblueprints/modules/core/pom.xml | 6 +- ms/controllerblueprints/modules/pom.xml | 6 +- .../modules/resource-dict/pom.xml | 10 +- ms/controllerblueprints/modules/service/pom.xml | 10 +- ms/controllerblueprints/parent/pom.xml | 40 +++-- ms/controllerblueprints/pom.xml | 8 + 16 files changed, 400 insertions(+), 211 deletions(-) delete mode 100644 ms/controllerblueprints/application/src/assembly/distribution.xml delete mode 100644 ms/controllerblueprints/application/src/main/dc/docker-compose.yaml delete mode 100644 ms/controllerblueprints/application/src/main/docker/Dockerfile delete mode 100644 ms/controllerblueprints/application/src/main/docker/startService.sh create mode 100644 ms/controllerblueprints/distribution/pom.xml create mode 100644 ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml create mode 100644 ms/controllerblueprints/distribution/src/main/docker/Dockerfile create mode 100644 ms/controllerblueprints/distribution/src/main/docker/distribution.xml create mode 100644 ms/controllerblueprints/distribution/src/main/docker/startService.sh (limited to 'ms') diff --git a/ms/controllerblueprints/application/pom.xml b/ms/controllerblueprints/application/pom.xml index 19fd9c72d..4e781ad1b 100644 --- a/ms/controllerblueprints/application/pom.xml +++ b/ms/controllerblueprints/application/pom.xml @@ -21,24 +21,18 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.onap.ccsdk.apps - controllerblueprints-parent + org.onap.ccsdk.apps.controllerblueprints + parent 0.3.0-SNAPSHOT ../parent - controllerblueprints-application + application Controller Blueprints Application ${basedir}/src/main/resources/swagger-ui/dist 1.8 - xxxxxxxxx:5100 - distribution - local org.onap.ccsdk.apps - org.onap.ccsdk.apps - 200.0.49 controllerblueprints - jacoco reuseReports @@ -50,15 +44,12 @@ ${basedir}/target/jacoco-it.exec java 2.0.7 - - - - org.onap.ccsdk.apps - controllerblueprints-service + org.onap.ccsdk.apps.controllerblueprints + service org.springframework.boot @@ -102,16 +93,34 @@ true - - src/main/docker - ${basedir}/target - - **/* - - true - + + maven-resources-plugin + 2.6 + + + copy-dockerfile + + copy-resources + + validate + + ${basedir}/target/docker-stage + + + src/main/docker + + * + + true + + + + + + + org.jacoco jacoco-maven-plugin @@ -166,28 +175,6 @@ - - - maven-assembly-plugin - 3.0.0 - - - target - - src/assembly/distribution.xml - - posix - - - - ${assembly.id} - package - - single - - - - maven-compiler-plugin 3.1 diff --git a/ms/controllerblueprints/application/src/assembly/distribution.xml b/ms/controllerblueprints/application/src/assembly/distribution.xml deleted file mode 100644 index c58c20d78..000000000 --- a/ms/controllerblueprints/application/src/assembly/distribution.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - ${assembly.id} - - tar.gz - - - - /opt/app/onap/lib - - - - - - - ${project.basedir}/src/main/resources - - application.properties - - / - true - - - ${project.basedir}/src/main/docker - - Dockerfile - startService.sh - - / - true - - - ${project.basedir}/src/main/groovy - src/main/groovy - true - - - ${project.basedir}/src/main/resources - src/main/resources - true - - - ${project.basedir}/etc - /etc - true - - - ${project.basedir}/load - load - true - - - diff --git a/ms/controllerblueprints/application/src/main/dc/docker-compose.yaml b/ms/controllerblueprints/application/src/main/dc/docker-compose.yaml deleted file mode 100644 index 5696d02b3..000000000 --- a/ms/controllerblueprints/application/src/main/dc/docker-compose.yaml +++ /dev/null @@ -1,36 +0,0 @@ -version: '3.3' - -services: - db: - image: mysql:5.7.22 - container_name: cb-mysql - ports: - - "3307:3306" - volumes: - - ~/vm_mysql:/var/lib/mysql - restart: always - environment: - MYSQL_ROOT_PASSWORD: sdnctl - MYSQL_DATABASE: sdnctl - MYSQL_USER: sdnctl - MYSQL_PASSWORD: sdnctl - controller-blueprints: - depends_on: - - db - image: onap/controllerblueprints:1.0.0 - container_name: cb-rest - ports: - - "8080:8080" - restart: always - volumes: - - ~/share/vm_ms/controllerblueprints/config:/opt/app/onap/config - - ~/share/vm_ms/controllerblueprints/logs:/logs - environment: - DB_URL: jdbc:mysql://db:3306/sdnctl - DB_USER: sdnctl - DB_PASSWORD: sdnctl - INIT_DATA_LOAD: "true" - APP_CONFIG_HOME: /opt/app/onap/config - BUNDLEVERSION: 1.0.0 - STICKYSELECTORKEY: - ENVCONTEXT: DEV \ No newline at end of file diff --git a/ms/controllerblueprints/application/src/main/docker/Dockerfile b/ms/controllerblueprints/application/src/main/docker/Dockerfile deleted file mode 100644 index 06304e1db..000000000 --- a/ms/controllerblueprints/application/src/main/docker/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM anapsix/alpine-java:8_jdk - -RUN apk add --no-cache curl - -COPY startService.sh /startService.sh -RUN chmod 777 /startService.sh && dos2unix /startService.sh - -COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz - -RUN (mkdir -p /source /opt/app/onap) && (tar -xzf /source.tar.gz -C /source) \ -&& (mv /source/@project.build.finalName@ /source/app) \ -&& (cp -rf /source/app/opt/app/onap/lib /opt/app/onap/) \ -&& (cp -rf /source/app/etc /) \ -&& (cp -rf /source/app/load /) \ -&& (rm -rf /source) - -ENTRYPOINT /startService.sh diff --git a/ms/controllerblueprints/application/src/main/docker/startService.sh b/ms/controllerblueprints/application/src/main/docker/startService.sh deleted file mode 100644 index 7077c2246..000000000 --- a/ms/controllerblueprints/application/src/main/docker/startService.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -nodeName=ControllerBlueprints_1.0.0_$(cat /proc/self/cgroup | grep docker | sed s/\\//\\n/g | tail -1) - -echo "APP Config HOME : ${APP_CONFIG_HOME}" -export APP_HOME=/opt/app/onap - -source /etc/run.source diff --git a/ms/controllerblueprints/distribution/pom.xml b/ms/controllerblueprints/distribution/pom.xml new file mode 100644 index 000000000..37c0b8448 --- /dev/null +++ b/ms/controllerblueprints/distribution/pom.xml @@ -0,0 +1,187 @@ + + + + + 4.0.0 + + org.onap.ccsdk.apps.controllerblueprints + parent + 0.3.0-SNAPSHOT + ../parent + + distribution + pom + Controller Blueprints Distribution + + maven + org.onap.ccsdk.apps + controllerblueprints + onap/ccsdk-controllerblueprints + + + + + org.onap.ccsdk.apps.controllerblueprints + application + + + + + + maven-resources-plugin + 2.6 + + + copy-dockerfile + + copy-resources + + validate + + ${basedir}/target/docker-stage + + + src/main/docker + + * + + true + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + ant-test + package + + + + + + + run + + + + + + + maven-assembly-plugin + 3.0.0 + + + ${basedir}/target/docker-stage + + src/main/docker/distribution.xml + + posix + + + + ${assembly.id} + package + + single + + + + + + org.codehaus.groovy.maven + gmaven-plugin + 1.0 + + + validate + + execute + + + + println project.properties['ccsdk.project.version']; + def versionArray; + if (project.properties['ccsdk.project.version'] != null ) { + versionArray = project.properties['ccsdk.project.version'].split('\\.'); + } + + if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT")) + { + project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest"; + } else { + project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest"; + } + + println 'New Tag for docker:' + project.properties['project.docker.latesttag.version']; + + + + + + + io.fabric8 + docker-maven-plugin + 0.26.1 + false + + + + ${image.name} + + try + ${basedir}/target/docker-stage + + ${project.version} + ${project.version}-STAGING-${maven.build.timestamp} + ${project.docker.latesttag.version} + + + + + true + + + + + + + + + + + push-images + deploy + + build + push + + + + + + + + diff --git a/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml new file mode 100644 index 000000000..9450f3065 --- /dev/null +++ b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml @@ -0,0 +1,36 @@ +version: '3.3' + +services: + db: + image: mysql:5.7.22 + container_name: cb-mysql + ports: + - "3307:3306" + volumes: + - ~/vm_mysql:/var/lib/mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: sdnctl + MYSQL_DATABASE: sdnctl + MYSQL_USER: sdnctl + MYSQL_PASSWORD: sdnctl + controller-blueprints: + depends_on: + - db + image: onap/ccsdk-controllerblueprints:latest + container_name: cb-rest + ports: + - "8080:8080" + restart: always + volumes: + - ~/share/vm_ms/controllerblueprints/config:/opt/app/onap/config + - ~/share/vm_ms/controllerblueprints/logs:/logs + environment: + DB_URL: jdbc:mysql://db:3306/sdnctl + DB_USER: sdnctl + DB_PASSWORD: sdnctl + INIT_DATA_LOAD: "true" + APP_CONFIG_HOME: /opt/app/onap/config + BUNDLEVERSION: 1.0.0 + STICKYSELECTORKEY: + ENVCONTEXT: DEV \ No newline at end of file diff --git a/ms/controllerblueprints/distribution/src/main/docker/Dockerfile b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile new file mode 100644 index 000000000..a2f453f24 --- /dev/null +++ b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile @@ -0,0 +1,20 @@ +FROM anapsix/alpine-java:8_jdk + +ENV HTTP_PROXY ${HTTP_PROXY} +ENV HTTPS_PROXY ${HTTPS_PROXY} + +RUN apk add --no-cache curl + +COPY startService.sh /startService.sh +RUN chmod 777 /startService.sh && dos2unix /startService.sh + +COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz + +RUN (mkdir -p /source /opt/app/onap) && (tar -xzf /source.tar.gz -C /source) \ +&& (mv /source/@project.build.finalName@ /source/app) \ +&& (cp -rf /source/app/opt/app/onap/lib /opt/app/onap/) \ +&& (cp -rf /source/app/etc /) \ +&& (cp -rf /source/app/load /) \ +&& (rm -rf /source) + +ENTRYPOINT /startService.sh diff --git a/ms/controllerblueprints/distribution/src/main/docker/distribution.xml b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml new file mode 100644 index 000000000..f2f3cb0be --- /dev/null +++ b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml @@ -0,0 +1,72 @@ + + + + + + ${assembly.id} + + tar.gz + + + + /opt/app/onap/lib + + + + + + + ${project.basedir}/../application/src/main/resources + + application.properties + + ./ + true + + + ${project.basedir}/src/main/docker + + Dockerfile + startService.sh + + ./ + true + + + ${project.basedir}/../application/src/main/groovy + src/main/groovy + true + + + ${project.basedir}/../application/src/main/resources + src/main/resources + true + + + ${project.basedir}/../application/etc + ./etc + true + + + ${project.basedir}/../application/load + load + true + + + diff --git a/ms/controllerblueprints/distribution/src/main/docker/startService.sh b/ms/controllerblueprints/distribution/src/main/docker/startService.sh new file mode 100644 index 000000000..7077c2246 --- /dev/null +++ b/ms/controllerblueprints/distribution/src/main/docker/startService.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +nodeName=ControllerBlueprints_1.0.0_$(cat /proc/self/cgroup | grep docker | sed s/\\//\\n/g | tail -1) + +echo "APP Config HOME : ${APP_CONFIG_HOME}" +export APP_HOME=/opt/app/onap + +source /etc/run.source diff --git a/ms/controllerblueprints/modules/core/pom.xml b/ms/controllerblueprints/modules/core/pom.xml index fc7581c8c..5782c60fc 100644 --- a/ms/controllerblueprints/modules/core/pom.xml +++ b/ms/controllerblueprints/modules/core/pom.xml @@ -21,11 +21,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.onap.ccsdk.apps - controllerblueprints-modules + org.onap.ccsdk.apps.controllerblueprints + modules 0.3.0-SNAPSHOT - controllerblueprints-core + core Controller Blueprints Core diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml index 9e7215ba8..5ab4e4477 100644 --- a/ms/controllerblueprints/modules/pom.xml +++ b/ms/controllerblueprints/modules/pom.xml @@ -21,12 +21,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.onap.ccsdk.apps - controllerblueprints-parent + org.onap.ccsdk.apps.controllerblueprints + parent 0.3.0-SNAPSHOT ../parent - controllerblueprints-modules + modules Controller Blueprints Modules pom diff --git a/ms/controllerblueprints/modules/resource-dict/pom.xml b/ms/controllerblueprints/modules/resource-dict/pom.xml index 337f5512f..4f2261853 100644 --- a/ms/controllerblueprints/modules/resource-dict/pom.xml +++ b/ms/controllerblueprints/modules/resource-dict/pom.xml @@ -21,17 +21,17 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.onap.ccsdk.apps - controllerblueprints-modules + org.onap.ccsdk.apps.controllerblueprints + modules 0.3.0-SNAPSHOT - controllerblueprints-resource-dict + resource-dict Controller Blueprints Resource Dictionary - org.onap.ccsdk.apps - controllerblueprints-core + org.onap.ccsdk.apps.controllerblueprints + core diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml index b4b798e6e..6a40a4a71 100644 --- a/ms/controllerblueprints/modules/service/pom.xml +++ b/ms/controllerblueprints/modules/service/pom.xml @@ -21,11 +21,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.onap.ccsdk.apps - controllerblueprints-modules + org.onap.ccsdk.apps.controllerblueprints + modules 0.3.0-SNAPSHOT - controllerblueprints-service + service Controller Blueprints Service @@ -33,8 +33,8 @@ - org.onap.ccsdk.apps - controllerblueprints-resource-dict + org.onap.ccsdk.apps.controllerblueprints + resource-dict org.apache.velocity diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml index f8977d1f3..e48c11342 100644 --- a/ms/controllerblueprints/parent/pom.xml +++ b/ms/controllerblueprints/parent/pom.xml @@ -20,18 +20,18 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.onap.ccsdk.apps - controllerblueprints-parent + + org.onap.ccsdk.apps + controllerblueprints + 0.3.0-SNAPSHOT + + org.onap.ccsdk.apps.controllerblueprints + parent Controller Blueprints Parent - 0.3.0-SNAPSHOT pom - UTF-8 - UTF-8 - 1.8 - 1.8 - 1.8 2.0.4.RELEASE + 5.0.8.RELEASE 1.2.60 1.0.0 2.9.2 @@ -122,19 +122,26 @@ ${kotlin.version} test + + - org.onap.ccsdk.apps - controllerblueprints-core + org.onap.ccsdk.apps.controllerblueprints + core ${project.version} - org.onap.ccsdk.apps - controllerblueprints-service + org.onap.ccsdk.apps.controllerblueprints + service ${project.version} - org.onap.ccsdk.apps - controllerblueprints-resource-dict + org.onap.ccsdk.apps.controllerblueprints + application + ${project.version} + + + org.onap.ccsdk.apps.controllerblueprints + resource-dict ${project.version} @@ -148,17 +155,14 @@ org.apache.commons commons-lang3 - 3.2.1 - + commons-collections commons-collections - 3.2.2 commons-io commons-io - 2.6 com.jayway.jsonpath diff --git a/ms/controllerblueprints/pom.xml b/ms/controllerblueprints/pom.xml index d76f4c8cb..798bdae4a 100644 --- a/ms/controllerblueprints/pom.xml +++ b/ms/controllerblueprints/pom.xml @@ -30,12 +30,20 @@ ControllerBlueprints UTF-8 + UTF-8 + yyyyMMdd'T'HHmmss'Z' + ${maven.build.timestamp} + 1.8 + 1.8 + 1.8 + ${project.version} pom parent modules application + distribution -- cgit 1.2.3-korg