From 9bbcb1be8d83cca5ba97dc4a2e86c525e51991e5 Mon Sep 17 00:00:00 2001 From: tragait Date: Mon, 24 Feb 2020 16:33:50 +0000 Subject: pnf sw upgrade csit Change-Id: I776d61030efc3d51e04f98698ceb8c445db2dafa Signed-off-by: tragait Issue-ID: INT-1308 Signed-off-by: tragait --- .../so/simulator/package/docker/pom.xml | 95 ++++++++++++++++++++++ .../Dockerfile.so-simulator-base-image | 34 ++++++++ .../Dockerfile.workaround-job-container | 27 ++++++ .../configs/logging/logback-spring.xml | 46 +++++++++++ .../main/docker/docker-files/scripts/start-app.sh | 69 ++++++++++++++++ 5 files changed, 271 insertions(+) create mode 100755 plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/pom.xml create mode 100755 plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image create mode 100755 plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/Dockerfile.workaround-job-container create mode 100755 plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml create mode 100755 plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/scripts/start-app.sh (limited to 'plans/usecases/pnf-sw-upgrade/so/simulator/package/docker') diff --git a/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/pom.xml b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/pom.xml new file mode 100755 index 00000000..b3d617d9 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/pom.xml @@ -0,0 +1,95 @@ + + + package + org.onap.so.simulators + 1.0-SNAPSHOT + + 4.0.0 + docker + pom + ${project.artifactId} + + ${project.artifactId}-${project.version} + + + io.fabric8 + docker-maven-plugin + 0.28.0 + + true + 1.23 + ${docker.pull.registry} + ${docker.push.registry} + + + jobs/workaround-job-container + + try + docker-files + Dockerfile.workaround-job-container + + + + simulators/aai-simulator + + try + docker-files + Dockerfile.so-simulator-base-image + + ${project.version} + + + + + + + ${project.parent.groupId}:aai-simulator + + app.jar + + + + + + + + + + + clean-images + pre-clean + + remove + + + true + + + + generate-images + generate-sources + + build + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8 + + true + + + + + + + ${project.parent.groupId} + aai-simulator + ${project.version} + + + \ No newline at end of file diff --git a/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image new file mode 100755 index 00000000..efd7833f --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image @@ -0,0 +1,34 @@ +FROM docker.io/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 netcat-openbsd sudo nss + +# Create 'so' user +RUN addgroup -g 1000 so && adduser -S -u 1000 -G so -s /bin/sh so + +RUN mkdir /app && mkdir /app/config && mkdir /app/logs && mkdir /app/ca-certificates + +COPY maven/app.jar /app +COPY configs/logging/logback-spring.xml /app +COPY scripts/start-app.sh /app + +RUN chown -R so:so /app && chmod 700 /app/*.sh + +# Springboot configuration (required) +VOLUME /app/config + +# CA certificates +VOLUME /app/ca-certificates + +WORKDIR /app +CMD ["/app/start-app.sh"] diff --git a/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/Dockerfile.workaround-job-container b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/Dockerfile.workaround-job-container new file mode 100755 index 00000000..faf8492c --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/Dockerfile.workaround-job-container @@ -0,0 +1,27 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# + +# @author Waqas Ikram (waqas.ikram@est.tech) + +FROM docker.io/alpine + +# Install packages +RUN apk update && apk upgrade && apk add mysql-client && apk add bash + +RUN apk --no-cache add curl netcat-openbsd sudo nss diff --git a/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml new file mode 100755 index 00000000..13c91879 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml @@ -0,0 +1,46 @@ + + + + + + + + + %black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable + + + + + + ${logs_dir:-.}/spring-boot-logger.log + + %d %p %C{1.} [%t] %m%n + + + + + ${logs_dir:-.}/archived/spring-boot-logger-%d{yyyy-MM-dd}.%i.log + + + 10MB + + + + + + + + + + + + + + + + diff --git a/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/scripts/start-app.sh b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/scripts/start-app.sh new file mode 100755 index 00000000..eb8ee2e5 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/simulator/package/docker/src/main/docker/docker-files/scripts/start-app.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +# @author Waqas Ikram (waqas.ikram@est.tech) + +touch /app/app.jar + +if [ "$(ls -1 /app/ca-certificates)" ]; then + needUpdate=FALSE + for certificate in `ls -1 /app/ca-certificates`; do + echo "Installing $certificate in /usr/local/share/ca-certificates" + cp /app/ca-certificates/$certificate /usr/local/share/ca-certificates/$certificate + needUpdate=TRUE + done + if [ $needUpdate = TRUE ]; then + echo "Updating ca-certificates . . ." + update-ca-certificates --fresh + fi +fi + +if [ -z "$APP" ]; then + echo "CONFIG ERROR: APP environment variable not set" + exit 1 +fi + +echo "Starting $APP simulator ... " + +if [ -z "${CONFIG_PATH}" ]; then + export CONFIG_PATH=/app/config/override.yaml +fi + +if [ -z "${LOG_PATH}" ]; then + export LOG_PATH="logs/${APP}" +fi + +if [ "${SSL_DEBUG}" = "log" ]; then + export SSL_DEBUG="-Djavax.net.debug=all" +else + export SSL_DEBUG= +fi + + +jvmargs="${JVM_ARGS} -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml -Dspring.config.additional-location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}" + +echo "JVM Arguments: ${jvmargs}" + +java ${jvmargs} -jar app.jar +rc=$? + +echo "Application exiting with status code $rc" + +exit $rc -- cgit 1.2.3-korg