summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gauld <agauld@att.com>2020-01-21 14:47:38 +0000
committerAndrew Gauld <agauld@att.com>2020-01-21 19:41:32 +0000
commit3fb91dc34bcde5489681f6470cae7f01c8b246d0 (patch)
tree8c6a330a1dc1084c8ff99ee4e418838fe9ecfbd8
parent86a040e87585d176dee6f215d5d46a2a74c1366e (diff)
runtimeapi & genprocessor pom.xml docker changes
Change-Id: I1595bf1c08dae161530c4dcdbc3e53b909164a10 Issue-ID: DCAEGEN2-1860 Signed-off-by: Andrew Gauld <agauld@att.com>
-rw-r--r--mod/genprocessor/docker/README.md51
-rw-r--r--mod/genprocessor/docker/http/Dockerfile6
-rwxr-xr-xmod/genprocessor/docker/http/start.sh24
-rw-r--r--mod/genprocessor/docker/job/Dockerfile15
-rw-r--r--mod/genprocessor/nginx.conf (renamed from mod/genprocessor/docker/http/nginx.conf)0
-rw-r--r--mod/genprocessor/pom.xml275
-rw-r--r--mod/genprocessor/src/main/java/org/onap/dcae/genprocessor/App.java25
-rw-r--r--mod/runtimeapi/runtime-web/Dockerfile10
-rw-r--r--mod/runtimeapi/runtime-web/pom.xml31
9 files changed, 184 insertions, 253 deletions
diff --git a/mod/genprocessor/docker/README.md b/mod/genprocessor/docker/README.md
deleted file mode 100644
index 47bdc14..0000000
--- a/mod/genprocessor/docker/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# Genprocessor: Docker
-
-`http` - http server that serves up the DCAE Nifi jars as files under the path `/nifi-jars`
-`job` - background job that continuously polls the onboarding API for components and generates jars from components
-
-The usage here will assume the use of a docker volume to persist data.
-
-Create a volume:
-
-```
-docker volume create genprocessor
-```
-
-## job
-
-Build:
-
-```
-$ cd ../
-$ docker build -t genprocessor-job -f docker/job/Dockerfile .
-```
-
-Run:
-
-```
-docker run -v genprocessor:/work -e GENPROC_ONBOARDING_API_HOST=http://some-hostname/onboarding -d genprocessor-job
-```
-
-NOTE: Above onboarding API is to the one running in iLab.
-
-Run as part of the stack:
-
-```
-docker run -v genprocessor:/work --link onboarding-api:onboarding-api -d genprocessor-job
-```
-
-## http
-
-Build:
-
-```
-$ cd http
-$ docker build -t genprocessor-http .
-```
-
-Run:
-
-```
-$ docker run -p 8080:80 -d -v genprocessor:/www/data:ro genprocessor-http
-```
-
diff --git a/mod/genprocessor/docker/http/Dockerfile b/mod/genprocessor/docker/http/Dockerfile
deleted file mode 100644
index 0cafbf4..0000000
--- a/mod/genprocessor/docker/http/Dockerfile
+++ /dev/null
@@ -1,6 +0,0 @@
-FROM nginx:latest
-
-COPY nginx.conf /etc/nginx/conf.d/default.conf
-COPY start.sh /code/start.sh
-
-CMD /code/start.sh
diff --git a/mod/genprocessor/docker/http/start.sh b/mod/genprocessor/docker/http/start.sh
deleted file mode 100755
index 45ff3e9..0000000
--- a/mod/genprocessor/docker/http/start.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-# ============LICENSE_START=======================================================
-# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file 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.
-# ============LICENSE_END=========================================================
-
-if [ -d "/www/data/nifi-jars" ]; then
- nginx -g "daemon off;"
-else
- echo "\"/www/data/nifi-jars\" directory missing"
- echo "You must perform a volume mount to this directory in the container"
- exit 1
-fi
diff --git a/mod/genprocessor/docker/job/Dockerfile b/mod/genprocessor/docker/job/Dockerfile
deleted file mode 100644
index b70a06c..0000000
--- a/mod/genprocessor/docker/job/Dockerfile
+++ /dev/null
@@ -1,15 +0,0 @@
-FROM maven:3-jdk-8
-
-COPY . /code
-WORKDIR /code
-RUN mvn package dependency:copy-dependencies
-ENV GENPROC_WORKING_DIR=/work
-ENV GENPROC_ONBOARDING_API_HOST=http://onboarding-api/onboarding
-ENV GENPROC_PROCESSOR_CLASSFILE_PATH=/code/target/classes/sandbox/DCAEProcessor.class
-ENV GENPROC_SLEEP_SEC=10
-
-ENV _RUN_COMMAND="java -cp \"target/genprocessor-1.0.1.jar:target/dependency/*\" sandbox.App gen"
-RUN printf "#!/bin/bash\nwhile true\ndo\n\t$_RUN_COMMAND\n\tsleep $GENPROC_SLEEP_SEC\ndone" > /code/run.sh \
- & chmod +x /code/run.sh
-
-CMD /code/run.sh
diff --git a/mod/genprocessor/docker/http/nginx.conf b/mod/genprocessor/nginx.conf
index bd53c07..bd53c07 100644
--- a/mod/genprocessor/docker/http/nginx.conf
+++ b/mod/genprocessor/nginx.conf
diff --git a/mod/genprocessor/pom.xml b/mod/genprocessor/pom.xml
index 6caf715..3b916ca 100644
--- a/mod/genprocessor/pom.xml
+++ b/mod/genprocessor/pom.xml
@@ -2,55 +2,52 @@
<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">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>2.0.0</version>
- </parent>
- <groupId>org.onap.dcaegen2.platform.mod</groupId>
- <artifactId>genprocessor</artifactId>
- <version>1.0.0</version>
- <name>dcaegen2-platform-mod-genprocessor</name>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.deploy.skip>true</maven.deploy.skip>
- <java.version>1.8</java.version>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
- </properties>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>2.0.0</version>
+ </parent>
+ <groupId>org.onap.dcaegen2.platform.mod</groupId>
+ <artifactId>genprocessor</artifactId>
+ <version>1.0.0</version>
+ <name>dcaegen2-platform-mod-genprocessor</name>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.deploy.skip>true</maven.deploy.skip>
+ <java.version>1.8</java.version>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
+ <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
+ <docker.push.registry>${env.NEXUS3_PUSH_REGISTRY}</docker.push.registry>
+ <start-class>org.onap.dcae.genprocessor.App</start-class>
+ <!--NOTE: Nifi jars used here are version 1.9.2 but dcae mod is on 1.9.3 because 1.9.3 is not in Maven Central -->
+ <nifi.version>1.9.2</nifi.version>
+ </properties>
<dependencies>
- <!--NOTE: Nifi jars used here are version 1.9.2 but dcae mod is on 1.9.3 because 1.9.3 is not in
- Maven Central -->
<dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-api</artifactId>
- <version>1.9.2</version>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-api</artifactId>
+ <version>${nifi.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-record-serialization-service-api</artifactId>
- <version>1.9.2</version>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-record-serialization-service-api</artifactId>
+ <version>${nifi.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-record</artifactId>
- <version>1.9.2</version>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-record</artifactId>
+ <version>${nifi.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-processor-utils</artifactId>
- <version>1.9.2</version>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-processor-utils</artifactId>
+ <version>${nifi.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.nifi</groupId>
- <artifactId>nifi-utils</artifactId>
- <version>1.9.2</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-utils</artifactId>
+ <version>${nifi.version}</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
@@ -58,120 +55,114 @@
<version>3.25.0-GA</version>
</dependency>
<dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.2.3</version>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.3</version>
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.10.0.pr1</version>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.10.0.pr1</version>
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.10.0.pr1</version>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.10.0.pr1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.7</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
-
<build>
- <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
- <plugins>
- <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>3.1.0</version>
- </plugin>
- <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>3.0.2</version>
- </plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.0</version>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.22.1</version>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <version>3.0.2</version>
- <configuration>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- <classpathPrefix>lib/</classpathPrefix>
- <mainClass>org.onap.dcae.genprocessor.App</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-install-plugin</artifactId>
- <version>2.5.2</version>
- </plugin>
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.2</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
- <plugin>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.7.1</version>
- </plugin>
- <plugin>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>3.0.0</version>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- <classpathPrefix>lib/</classpathPrefix>
- <mainClass>org.onap.dcae.genprocessor.App</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <!-- THIS DOES NOT RUN-->
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <configuration>
+ <verbose>true</verbose>
+ <pullRegistry>${docker.pull.registry}</pullRegistry>
+ <pushRegistry>${docker.push.registry}</pushRegistry>
+ <images>
+ <image>
+ <name>onap/${project.groupId}.${project.artifactId}-http</name>
+ <registry>${onap.nexus.dockerregistry.daily}</registry>
+ <build>
+ <from>nginx:latest</from>
+ <tags>
+ <tag>latest</tag>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}Z</tag>
+ </tags>
+ <assembly>
+ <targetDir>/</targetDir>
+ <inline>
+ <files>
+ <file>
+ <source>./nginx.conf</source>
+ <outputDirectory>/etc/nginx/conf.d</outputDirectory>
+ <destName>default.conf</destName>
+ </file>
+ </files>
+ </inline>
+ </assembly>
+ <entryPoint>
+ <exec>
+ <arg>nginx</arg>
+ <arg>-g</arg>
+ <arg>daemon off;</arg>
+ </exec>
+ </entryPoint>
+ </build>
+ </image>
+ <image>
+ <name>onap/${project.groupId}.${project.artifactId}-job</name>
+ <registry>${onap.nexus.dockerregistry.daily}</registry>
+ <build>
+ <from>openjdk:8-jre-alpine</from>
+ <tags>
+ <tag>latest</tag>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}Z</tag>
+ </tags>
+ <assembly>
+ <descriptorRef>artifact-with-dependencies</descriptorRef>
+ </assembly>
+ <workdir>/maven</workdir>
+ <env>
+ <GENPROC_WORKING_DIR>/work</GENPROC_WORKING_DIR>
+ <GENPROC_ONBOARDING_API_HOST>http://onboarding-api/onboarding</GENPROC_ONBOARDING_API_HOST>
+ <GENPROC_PROCESSOR_CLASSFILE_PATH>/code/target/classes/sandbox/DCAEPROCESSOR.class</GENPROC_PROCESSOR_CLASSFILE_PATH>
+ <GENPROC_SLEEP_SEC>10</GENPROC_SLEEP_SEC>
+ </env>
+ <entryPoint>
+ <exec>
+ <arg>java</arg>
+ <arg>-cp</arg>
+ <arg>/maven/*</arg>
+ <arg>${start-class}</arg>
+ </exec>
+ </entryPoint>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
</build>
</project>
diff --git a/mod/genprocessor/src/main/java/org/onap/dcae/genprocessor/App.java b/mod/genprocessor/src/main/java/org/onap/dcae/genprocessor/App.java
index 9996b71..7cee8b0 100644
--- a/mod/genprocessor/src/main/java/org/onap/dcae/genprocessor/App.java
+++ b/mod/genprocessor/src/main/java/org/onap/dcae/genprocessor/App.java
@@ -308,13 +308,34 @@ public class App {
return false;
}
- public static void main(String[] args) {
+ public static void main(String[] args) throws InterruptedException {
if (args.length == 0) {
+ args = new String[] { "gen" };
+ String sleepstr = System.getenv("GENPROC_SLEEP_SEC");
+ long sleepdur = (sleepstr != null)? 1000 * Long.parseLong(sleepstr): 0;
+ do {
+ try {
+ main2(args);
+ } catch (Exception e) {
+ LOG.error(e.toString(), e);
+ }
+ Thread.sleep(sleepdur);
+ } while (sleepdur > 0);
+ return;
+ } else {
+ main2(args);
+ }
+ }
+
+
+ public static void main2(String[] args) {
+ String argsStr = String.join(", ", args);
+ if (argsStr.contains("-h")) {
LOG.info("Here are the possible args:");
LOG.info("<gen> <load>");
+ return;
}
- String argsStr = String.join(", ", args);
boolean shouldGenerate = argsStr.contains("gen") ? true : false;
boolean shouldLoad = argsStr.contains("load") ? true : false;
boolean shouldPackage = argsStr.contains("package") ? true : false;
diff --git a/mod/runtimeapi/runtime-web/Dockerfile b/mod/runtimeapi/runtime-web/Dockerfile
deleted file mode 100644
index 5d17d41..0000000
--- a/mod/runtimeapi/runtime-web/Dockerfile
+++ /dev/null
@@ -1,10 +0,0 @@
-FROM openjdk:8-jre-alpine
-WORKDIR /usr/app
-VOLUME /tmp
-ADD target/runtime-web-1.0.0.jar runtime-web-1.0.0.jar
-
-EXPOSE 9090
-
-ENTRYPOINT ["java", \
- "-Djava.security.egd=file:/dev/./urandom", \
- "-jar", "runtime-web-1.0.0.jar"]
diff --git a/mod/runtimeapi/runtime-web/pom.xml b/mod/runtimeapi/runtime-web/pom.xml
index 27cc960..3b39845 100644
--- a/mod/runtimeapi/runtime-web/pom.xml
+++ b/mod/runtimeapi/runtime-web/pom.xml
@@ -66,25 +66,50 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<verbose>true</verbose>
- <imagePullPolicy>IfNotPresent</imagePullPolicy>
+ <pullRegistry>${docker.pull.registry}</pullRegistry>
+ <pushRegistry>${docker.push.registry}</pushRegistry>
<images>
<image>
<name>onap/${project.groupId}.${project.artifactId}</name>
<registry>${onap.nexus.dockerregistry.daily}</registry>
<build>
- <contextDir>${project.basedir}</contextDir>
- <cleanup>none</cleanup>
+ <from>openjdk:8-jre-alpine</from>
<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}Z</tag>
</tags>
+ <assembly>
+ <descriptorRef>artifact</descriptorRef>
+ </assembly>
+ <workdir>/maven</workdir>
+ <volumes>
+ <volume>/tmp</volume>
+ </volumes>
+ <ports>
+ <port>9090</port>
+ </ports>
+ <entryPoint>
+ <exec>
+ <arg>java</arg>
+ <arg>-Djava.security.egd=file:/dev/./urandom</arg>
+ <arg>-jar</arg>
+ <arg>${project.artifactId}-${project.version}.${project.packaging}</arg>
+ </exec>
+ </entryPoint>
</build>
</image>
</images>