Work in Progress cds-sdc-listener containerization 26/85226/13
authorprathamesh morde <prathamesh.morde@bell.ca>
Fri, 12 Apr 2019 15:41:36 +0000 (11:41 -0400)
committerOleg Mitsura <oleg.mitsura@amdocs.com>
Wed, 17 Apr 2019 21:24:47 +0000 (17:24 -0400)
Change-Id: Ib99f2c2f7c3f8ad46ec9630a548370e7467a96b4
Issue-ID: CCSDK-1145
Signed-off-by: prathamesh morde <prathamesh.morde@bell.ca>
ms/cds-sdc-listener/application/pom.xml
ms/cds-sdc-listener/application/src/main/docker/Dockerfile [new file with mode: 0644]
ms/cds-sdc-listener/application/src/main/docker/docker-compose.yaml [new file with mode: 0644]
ms/cds-sdc-listener/application/src/main/docker/start.sh [new file with mode: 0755]
ms/cds-sdc-listener/application/src/main/resources/application.yml
ms/cds-sdc-listener/application/src/main/resources/logback.xml [new file with mode: 0644]
ms/cds-sdc-listener/distribution/pom.xml [deleted file]

index c58bb13..3f8e1a3 100644 (file)
@@ -6,7 +6,8 @@
   ~ proprietary to Bell Canada and are protected by trade secret or copyright law.
   ~ Unauthorized copying of this file, via any medium is strictly prohibited.
   -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
   <parent>
     <groupId>org.onap.ccsdk.parent</groupId>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>cds-sdc-listener-application</artifactId>
   <version>0.4.2-SNAPSHOT</version>
-  <name>CDS-SDC Listener Application </name>
+  <name>CDS-SDC Listener Application</name>
 
   <properties>
     <grpc.version>1.17.1</grpc.version>
     <protobuf.version>3.6.1</protobuf.version>
+    <image.name>onap/ccsdk-cds-sdc-listener</image.name>
+    <docker.push.phase>deploy</docker.push.phase>
+    <project.version>${parent.version}</project.version>
+    <!-- Start of Docker Related Properties -->
+    <docker.fabric.version>0.26.1</docker.fabric.version>
+    <ccsdk.project.version>${project.version}</ccsdk.project.version>
   </properties>
 
   <dependencies>
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.8</version>
+        <executions>
+          <execution>
+            <id>copy</id>
+            <phase>package</phase>
+            <configuration>
+              <target>
+                <echo>ANT TASK - copying Docker files</echo>
+                <copy todir="${basedir}/target/docker-stage" overwrite="true" flatten="true">
+                  <fileset dir="${basedir}/src/main/docker">
+                    <include name="Dockerfile"/>
+                    <include name="start.sh"/>
+                  </fileset>
+                  <fileset dir="${basedir}/target">
+                    <include name="*.jar"/>
+                  </fileset>
+                  <fileset dir="${basedir}/src/main/resources/">
+                    <include name="application.yml"/>
+                  </fileset>
+                </copy>
+              </target>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.groovy.maven</groupId>
+        <artifactId>gmaven-plugin</artifactId>
+        <version>1.0</version>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>execute</goal>
+            </goals>
+            <configuration>
+              <source>${basedir}/../../../TagVersion.groovy</source>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+            <version>${docker.fabric.version}</version>
+            <inherited>false</inherited>
+            <configuration>
+              <images>
+                <image>
+                  <name>${image.name}</name>
+                  <build>
+                    <cleanup>try</cleanup>
+                    <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+                    <tags>
+                      <tag>${project.docker.latestminortag.version}</tag>
+                      <tag>${project.docker.latestfulltag.version}</tag>
+                      <tag>${project.docker.latesttagtimestamp.version}</tag>
+                    </tags>
+                  </build>
+                </image>
+              </images>
+              <verbose>true</verbose>
+            </configuration>
+            <executions>
+              <execution>
+                <id>generate-images</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>build</goal>
+                </goals>
+              </execution>
+              <execution>
+                <id>push-images</id>
+                <phase>${docker.push.phase}</phase>
+                <goals>
+                  <goal>build</goal>
+                  <goal>push</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
 </project>
diff --git a/ms/cds-sdc-listener/application/src/main/docker/Dockerfile b/ms/cds-sdc-listener/application/src/main/docker/Dockerfile
new file mode 100644 (file)
index 0000000..062f657
--- /dev/null
@@ -0,0 +1,13 @@
+FROM openjdk:8-jdk-alpine
+
+ENV HTTP_PROXY  ${HTTP_PROXY}
+ENV HTTPS_PROXY ${HTTPS_PROXY}
+
+RUN mkdir -p /opt/app/onap/ /opt/app/onap/config
+WORKDIR  /opt/app/onap/
+COPY start.sh /opt/app/onap/
+COPY application.yml /opt/app/onap/config
+RUN chmod 751 /opt/app/onap/start.sh
+COPY cds-sdc-listener-application-0.4.2-SNAPSHOT.jar /opt/app/onap/cds-sdc-listener-distribution.jar
+EXPOSE 9000
+ENTRYPOINT /opt/app/onap/start.sh
diff --git a/ms/cds-sdc-listener/application/src/main/docker/docker-compose.yaml b/ms/cds-sdc-listener/application/src/main/docker/docker-compose.yaml
new file mode 100644 (file)
index 0000000..1e73847
--- /dev/null
@@ -0,0 +1,29 @@
+version: '3.3'
+
+services:
+  cds-sdc-listener:
+    image: onap/cdssdclistener:latest
+    container_name: cdssdclistener
+    restart: always
+    environment:
+      asdcAddress: localhost:8443
+      messageBusAddress: localhost
+      sdcusername: vid
+      password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+      pollingInterval: 15
+      pollingTimeout: 15
+      relevantArtifactTypes: TOSCA_CSAR
+      consumerGroup: cds-id-local
+      environmentName: AUTO
+      consumerId: cds-id-local
+      keyStorePassword:
+      keyStorePath:
+      activateServerTLSAuth: "false"
+      isUseHttpsWithDmaap: "false"
+      archivePath: /opt/app/onap/cds-sdc-listener/
+      grpcAddress: localhost
+      grpcPort: 9111
+      authHeader: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
+      #port needed by Liveness probe
+      healthcheckPort: "9000"
+      sprintWebListenerEnabled: "true"
diff --git a/ms/cds-sdc-listener/application/src/main/docker/start.sh b/ms/cds-sdc-listener/application/src/main/docker/start.sh
new file mode 100755 (executable)
index 0000000..f24d156
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+extraArgs=$@
+java -jar /opt/app/onap/cds-sdc-listener-distribution.jar \
+-Dspring.config=/opt/app/onap/config/application.yml \
+-Djava.security.egd=file:/dev/./urandom \
+${extraArgs}
index 0c2c60d..b3f8443 100644 (file)
@@ -1,27 +1,27 @@
 listenerservice:
-    config:
-      asdcAddress: localhost:8443
-      messageBusAddress: localhost
-      user: vid
-      password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
-      pollingInterval: 15
-      pollingTimeout: 60
-      relevantArtifactTypes: TOSCA_CSAR
-      consumerGroup: cds-id-local
-      environmentName: AUTO
-      consumerId: cds-id-local
-      keyStorePassword:
-      keyStorePath:
-      activateServerTLSAuth : false
-      isUseHttpsWithDmaap: false
-      archivePath: /opt/app/onap/cds-sdc-listener/
-      grpcAddress: localhost
-      grpcPort: 9111
-      authHeader: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
+  config:
+    asdcAddress: ${asdcAddress:localhost:8443}
+    messageBusAddress: ${messageBusAddress:localhost}
+    user: ${sdcusername:vid}
+    password: ${password:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
+    pollingInterval: ${pollingInterval:15}
+    pollingTimeout: ${pollingTimeout:60}
+    relevantArtifactTypes: ${relevantArtifactTypes:TOSCA_CSAR}
+    consumerGroup: ${consumerGroup:cds-id-local}
+    environmentName: ${environmentName:AUTO}
+    consumerId: ${consumerId:cds-id-local}
+    keyStorePassword: ${keyStorePassword}
+    keyStorePath: ${keyStorePath}
+    activateServerTLSAuth : ${activateServerTLSAuth:false}
+    isUseHttpsWithDmaap: ${isUseHttpsWithDmaap:false}
+    archivePath: ${archivePath:/opt/app/onap/cds-sdc-listener/}
+    grpcAddress: ${grpcAddress:localhost}
+    grpcPort: ${grpcPort:9111}
+    authHeader: ${authHeader:Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==}
 #port needed by Liveness probe
 server:
-  port: 9000
+  port: ${healthcheckPort:9000}
 #set spring.main.web-environment=false if you want to NOT to open a port for healthcheck.
-#spring:
-#  main:
-#    web-environment: false
\ No newline at end of file
+spring:
+  main:
+    web-environment: ${sprintWebListenerEnabled:true}
diff --git a/ms/cds-sdc-listener/application/src/main/resources/logback.xml b/ms/cds-sdc-listener/application/src/main/resources/logback.xml
new file mode 100644 (file)
index 0000000..b26cbcb
--- /dev/null
@@ -0,0 +1,33 @@
+<!--
+Copyright (C) 2019 Bell Canada
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<configuration>
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="STDOUT"/>
+  </root>
+
+  <logger name="org.springframework" level="info"/>
+  <logger name="org.springframework.web" level="info"/>
+  <logger name="org.onap.ccsdk.cds" level="info"/>
+  
+</configuration>
diff --git a/ms/cds-sdc-listener/distribution/pom.xml b/ms/cds-sdc-listener/distribution/pom.xml
deleted file mode 100644 (file)
index 59e3824..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright (C) 2019 Bell Canada. All rights reserved.
-  ~
-  ~ NOTICE:  All the intellectual and technical concepts contained herein are
-  ~ proprietary to Bell Canada and are protected by trade secret or copyright law.
-  ~ Unauthorized copying of this file, via any medium is strictly prohibited.
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <artifactId>cds-sdc-listener</artifactId>
-    <groupId>org.onap.ccsdk.cds</groupId>
-    <version>0.4.2-SNAPSHOT</version>
-  </parent>
-
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.onap.ccsdk.cds</groupId>
-  <artifactId>cds-sdc-listener-distribution</artifactId>
-  <name>CDS-SDC Listener Distribution</name>
-
-  <properties>
-    <image.name>onap/ccsdk-cdssdclistener</image.name>
-    <docker.push.phase>deploy</docker.push.phase>
-  </properties>
-
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-resources-plugin</artifactId>
-        <version>2.6</version>
-        <executions>
-          <execution>
-            <id>copy-dockerfile</id>
-            <goals>
-              <goal>copy-resources</goal>
-            </goals>
-            <phase>validate</phase>
-            <configuration>
-              <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
-              <resources>
-                <resource>
-                  <directory>src/main/docker</directory>
-                  <includes>
-                    <include>*</include>
-                  </includes>
-                  <filtering>true</filtering>
-                </resource>
-              </resources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-  <profiles>
-    <profile>
-      <id>docker</id>
-      <build>
-        <plugins>
-          <plugin>
-            <!-- Maven plugin for managing docker images and containers -->
-            <groupId>io.fabric8</groupId>
-            <artifactId>docker-maven-plugin</artifactId>
-            <version>0.26.1</version>
-            <inherited>false</inherited>
-            <configuration>
-              <images>
-                <image>
-                  <name>${image.name}</name>
-                  <build>
-                    <cleanup>try</cleanup>
-                    <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
-                    <tags>
-                      <tag>${project.version}</tag>
-                      <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
-                    </tags>
-                  </build>
-                </image>
-              </images>
-              <verbose>true</verbose>
-            </configuration>
-            <executions>
-              <execution>
-                <id>generate-images</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>build</goal>
-                </goals>
-              </execution>
-              <execution>
-                <id>push-images</id>
-                <phase>${docker.push.phase}</phase>
-                <goals>
-                  <goal>build</goal>
-                  <goal>push</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-
-</project>