From b01df8be03edfbea5e6185d763496bd8cfa833ff Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Tue, 9 Jul 2019 16:14:17 +0000 Subject: Adding Infrastructure for Simulate Request for SDC Change-Id: Icf1100f180201735b4862cb0b9762d4a30750817 Issue-ID: SO-1949 Signed-off-by: waqas.ikram --- .../so-simulators/package/docker/pom.xml | 100 +++++++++++++++++++++ .../Dockerfile.so-simulator-base-image | 31 +++++++ .../configs/logging/logback-spring.xml | 46 ++++++++++ .../main/docker/docker-files/scripts/start-app.sh | 56 ++++++++++++ 4 files changed, 233 insertions(+) create mode 100644 plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml create mode 100644 plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image create mode 100644 plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml create mode 100644 plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/scripts/start-app.sh (limited to 'plans/so/integration-etsi-testing/so-simulators/package/docker') diff --git a/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml b/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml new file mode 100644 index 00000000..873fa2ab --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml @@ -0,0 +1,100 @@ + + + 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} + + + + simulators/sdc-simulator + + try + docker-files + Dockerfile.so-simulator-base-image + + ${project.version} + + + + + + + org.onap.so.simulators:sdc-simulator + + app.jar + + + + + + + + + + + + clean-images + pre-clean + + remove + + + true + + + + + generate-images + generate-sources + + build + + + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8 + + true + + + + + + + + + org.onap.so.simulators + sdc-simulator + ${project.version} + + + + + diff --git a/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image new file mode 100644 index 00000000..f6f0fc9b --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image @@ -0,0 +1,31 @@ +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 + +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 + +WORKDIR /app +CMD ["/app/start-app.sh"] diff --git a/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml new file mode 100644 index 00000000..13c91879 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/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/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/scripts/start-app.sh b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/scripts/start-app.sh new file mode 100644 index 00000000..0ab3d27f --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/scripts/start-app.sh @@ -0,0 +1,56 @@ +#!/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 [ -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