From e800051dcf97c375fe7998dc5799e8ea5694435c Mon Sep 17 00:00:00 2001 From: Rob Daugherty Date: Wed, 1 Aug 2018 00:02:38 -0400 Subject: Build docker images so/catalog-db-adapter so/requests-db-adapter so/sdnc-adapter so/openstack-adapters so/asdc-controller so/bpmn-infra so/api-handler-infra Base image is alpine with openjdk. Change-Id: Ied96227aa48cd5c1420ac328e251f601020a0679 Issue-ID: SO-780 Signed-off-by: Rob Daugherty --- packages/docker/pom.xml | 318 ++++++++++++++------- .../src/main/docker/docker-files/Dockerfile.so-app | 22 ++ .../docker/docker-files/Dockerfile.so-base-image | 17 ++ .../configs/logging/logback-spring.xml | 188 ++++++++++++ .../docker/docker-files/scripts/startService.sh | 44 +++ 5 files changed, 492 insertions(+), 97 deletions(-) create mode 100644 packages/docker/src/main/docker/docker-files/Dockerfile.so-app create mode 100644 packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image create mode 100644 packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml create mode 100644 packages/docker/src/main/docker/docker-files/scripts/startService.sh (limited to 'packages') diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index c84902ae4d..5fafb4afd9 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -1,5 +1,6 @@ + 4.0.0 @@ -10,20 +11,16 @@ pom docker - - MSO Docker Deliveries - OpenECOMP MSO Docker Deliveries + Docker Images + Docker Images UTF-8 UTF-8 - - ${env.GIT_NO_PROJECT} - master - so/chef-repo - so/so-config - ${project.version} + ${project.version} + false + false + false nexus3.onap.org:10001 nexus3.onap.org:10003 @@ -31,74 +28,37 @@ ${project.artifactId}-${project.version} - - org.codehaus.groovy.maven - gmaven-plugin - 1.0 - - - validate - - execute - - - - println project.properties['mso.project.version']; - def versionArray; - if ( project.properties['mso.project.version'] != null ) { - versionArray = project.properties['mso.project.version'].split('\\.'); - } - - if ( project.properties['mso.project.version'].endsWith("-SNAPSHOT") ) { - project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-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']; - - - - - - - org.apache.maven.plugins - maven-scm-plugin - 1.9.5 + org.codehaus.groovy.maven + gmaven-plugin + 1.0 - chef-repo-checkout - - checkout - - initialize - - scm:git:${mso.chef.git.url.prefix}/${mso.chef.git.url.suffix.chef.repo} - src/main/docker/docker-files/chef-configs/chef-repo - ${mso.chef.git.branchname} - branch - true - false - - - - mso-config-checkout + validate - checkout + execute - initialize - scm:git:${mso.chef.git.url.prefix}/${mso.chef.git.url.suffix.chef.config} - src/main/docker/docker-files/chef-configs/mso-config - ${mso.chef.git.branchname} - branch - true - false + + println 'Project version: ' + project.properties['so.project.version']; + def versionArray; + if ( project.properties['so.project.version'] != null ) { + versionArray = project.properties['so.project.version'].split('-'); + } + + if ( project.properties['so.project.version'].endsWith("-SNAPSHOT") ) { + project.properties['project.docker.latesttag.version']=versionArray[0] + "-SNAPSHOT-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 @@ -112,62 +72,191 @@ - openecomp/jacoco:1.0 - jacoco + so/base-image:1.0 try docker-files - Dockerfile.jacoco - + Dockerfile.so-base-image - openecomp/ubuntu-update:1.0 - ubuntu-update + so/catalog-db-adapter - try docker-files - Dockerfile.ubuntu-16.04-update - + Dockerfile.so-app + + ${project.version} + ${project.version}-${maven.build.timestamp} + ${project.docker.latesttag.version} + + + + + + + org.onap.so.adapters:mso-catalog-db-adapter + + app.jar + + + + - openecomp/wildfly:1.0 - wildfly + so/requests-db-adapter - try docker-files - Dockerfile.wildfly-10 - + Dockerfile.so-app + + ${project.version} + ${project.version}-${maven.build.timestamp} + ${project.docker.latesttag.version} + + + + + + + org.onap.so.adapters:mso-requests-db-adapter + + app.jar + + + + + + + + so/sdnc-adapter + + try + docker-files + Dockerfile.so-app + + ${project.version} + ${project.version}-${maven.build.timestamp} + ${project.docker.latesttag.version} + + + + + + + org.onap.so:mso-sdnc-adapter + + app.jar + + + + - openecomp/mso:%l - onap/so:%1 - openecomp/mso:%l - so + so/openstack-adapters + try + docker-files + Dockerfile.so-app - ${project.version}-STAGING-${maven.build.timestamp} + ${project.version} + ${project.version}-${maven.build.timestamp} ${project.docker.latesttag.version} + + + + + + org.onap.so:mso-openstack-adapters + + app.jar + + + + + + + + so/asdc-controller + try docker-files - Dockerfile.mso-chef-final + Dockerfile.so-app + + ${project.version} + ${project.version}-${maven.build.timestamp} + ${project.docker.latesttag.version} + - / - - jboss:jboss:jboss - /opt/jboss/wildfly/standalone/deployments - ../../../../deliveries/src/main/assembly/war-pack/mso-wars.xml + + + + + org.onap.so:asdc-controller + + app.jar + + + + + + + + so/bpmn-infra + + try + docker-files + Dockerfile.so-app + + ${project.version} + ${project.version}-${maven.build.timestamp} + ${project.docker.latesttag.version} + + + + + + + org.onap.so:mso-infrastructure-bpmn + + app.jar + + + + + + + + so/api-handler-infra + + try + docker-files + Dockerfile.so-app + + ${project.version} + ${project.version}-${maven.build.timestamp} + ${project.docker.latesttag.version} + + + + + + + org.onap.so:mso-api-handler-infra + + app.jar + + + - + clean-images @@ -177,7 +266,6 @@ true - openecomp/mso:%l @@ -197,11 +285,10 @@ push - openecomp/mso:%l,openecomp/jacoco:1.0 + so/catalog-db-adapter,so/requests-db-adapter,so/sdnc-adapter,so/openstack-adapters,so/asdc-controller,so/bpmn-infra,so/api-handler-infra - @@ -215,4 +302,41 @@ + + + org.onap.so.adapters + mso-catalog-db-adapter + ${project.version} + + + org.onap.so.adapters + mso-requests-db-adapter + ${project.version} + + + org.onap.so + mso-sdnc-adapter + ${project.version} + + + org.onap.so + mso-openstack-adapters + ${project.version} + + + org.onap.so + asdc-controller + ${project.version} + + + org.onap.so + mso-infrastructure-bpmn + ${project.version} + + + org.onap.so + mso-api-handler-infra + ${project.version} + + diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app new file mode 100644 index 0000000000..27c6b58cd2 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app @@ -0,0 +1,22 @@ +FROM so/base-image:1.0 + +ARG http_proxy +ENV HTTP_PROXY=$http_proxy +ENV http_proxy=$HTTP_PROXY +ARG https_proxy +ENV HTTPS_PROXY=$https_proxy +ENV https_proxy=$HTTPS_PROXY + +RUN mkdir /app + +COPY maven/app.jar /app +COPY configs/logging/logback-spring.xml /app +COPY scripts/startService.sh /app + +RUN chown -R so:so /app && chmod 700 /app/startService.sh + +VOLUME /tmp + +WORKDIR /app +USER so:so +ENTRYPOINT /app/startService.sh diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image new file mode 100644 index 0000000000..9780018325 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image @@ -0,0 +1,17 @@ +FROM openjdk:8-jdk-alpine + +ARG http_proxy +ARG https_proxy +ENV HTTP_PROXY=$http_proxy +ENV HTTPS_PROXY=$https_proxy +ENV http_proxy=$HTTP_PROXY +ENV https_proxy=$HTTPS_PROXY + +# Update the package list and upgrade installed packages +RUN apk update && apk upgrade + +# Install commonly needed tools +RUN apk --no-cache add curl sudo bash + +# Create 'so' user +RUN addgroup -g 1000 so && adduser -S -u 1000 -G so so diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml new file mode 100644 index 0000000000..dbba5da9b0 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${logs_dir:-.}/${saneLogName}.log + + ${logs_dir:-.}/${saneLogName}.%d{yyyy-MM-dd}.%i.log.zip + + + + ${maxFileSize} + ${maxHistory} + ${totalSizeCap} + + + ${defaultPattern} + + + + + ${logs_dir:-.}/${auditLogName}.log + + ${logs_dir:-.}/${auditLogName}.%d{yyyy-MM-dd}.%i.log.zip + + ${maxFileSize} + ${maxHistory} + ${totalSizeCap} + + + ${auditPattern} + + + + + 256 + + + + + ${logs_dir:-.}/${metricsLogName}.log + + ${logs_dir:-.}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log.zip + + ${maxFileSize} + ${maxHistory} + ${totalSizeCap} + + + ${metricPattern} + + + + + + 256 + + + + + + ERROR + ACCEPT + DENY + + ${logs_dir:-.}/${errorLogName}.log + + ${logs_dir:-.}/${errorLogName}.%d{yyyy-MM-dd}.%i.log.zip + + ${maxFileSize} + ${maxHistory} + ${totalSizeCap} + + + ${errorPattern} + + + + + 256 + + + + + ${logs_dir:-.}/${debugLogName}.log + + ${logs_dir:-.}/${debugLogName}.%d{yyyy-MM-dd}.%i.log.zip + + ${maxFileSize} + ${maxHistory} + ${totalSizeCap} + + + ${debugPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/docker/src/main/docker/docker-files/scripts/startService.sh b/packages/docker/src/main/docker/docker-files/scripts/startService.sh new file mode 100644 index 0000000000..67e575b334 --- /dev/null +++ b/packages/docker/src/main/docker/docker-files/scripts/startService.sh @@ -0,0 +1,44 @@ +#!/bin/sh +touch /app/app.jar +if [ -z "${TARGET_ENV}" ]; then + export TARGET_ENV="dev" +fi +export CONFIG_PATH=/app/config/override.yaml +if [ -z "${LOG_PATH}" ]; then + export LOG_PATH="./logs/apih" +fi +if [ ${LOG_PATH} = "./logs/asdc/" ]; then + ln -s /app/logs/asdc ASDC +fi +if [ ${LOG_PATH} = "./logs/bpmn/" ]; then + ln -s /app/logs/bpmn BPMN +fi +if [ "${SSL_DEBUG}" = "log" ]; then + export SSL_DEBUG="-Djavax.net.debug=all" +else + export SSL_DEBUG="" +fi + +op=`basename $LOG_PATH` +if [ $op = "openstack" ]; then + export DISABLE_SNI="-Djsse.enableSNIExtension=false" +fi + +JAVA_VERSION_MAJOR=$(java -Xinternalversion | sed -n 's/.*JRE ([0-9]\.\([0-9]\+\)\.[0-9].*/\1/p') +JAVA_VERSION_MINOR=$(java -Xinternalversion | sed -n 's/.*JRE ([0-9]\.[0-9]\+\.[0-9]_\([0-9]\+\).*/\1/p') + +if [[ ${JAVA_VERSION_MAJOR} -eq 8 && ${JAVA_VERSION_MINOR} -lt 131 ]]; then + if [[ ${LOG_PATH} = "./logs/bpmn/" ]]; then + jvmargs="-Xmx8g " + else + jvmargs="-Xmx4g " + fi +elif [[ ${JAVA_VERSION_MAJOR} -eq 8 && ${JAVA_VERSION_MINOR} -ge 131 ]] || [[ ${JAVA_VERSION_MAJOR} -eq 9 ]]; then + jvmargs="-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1 " +fi + +jvmargs=${jvmargs}"-Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml -Dmso.load.ssl.client.keystore=true -Djavax.net.ssl.keyStore=msoClientKeyStore-${TARGET_ENV}.jks -Djavax.net.ssl.keyStorePassword=${MSO_KEYSTORE_PASSWORD} -Djavax.net.ssl.trustStore=msoTrustStore.jks -Djavax.net.ssl.trustStorePassword=${MSO_TRUSTSTORE_PASSWORD} -Dspring.config.location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}" + +echo JVM Arguments: ${jvmargs} + +java ${jvmargs} -jar app.jar -- cgit 1.2.3-korg