diff options
Diffstat (limited to 'deliveries')
21 files changed, 290 insertions, 201 deletions
diff --git a/deliveries/.env b/deliveries/.env index 0a3230d7..fc7c94c4 100644 --- a/deliveries/.env +++ b/deliveries/.env @@ -1,15 +1,22 @@ # Environment settings # used by docker-compose AND by other shell scripts +# The name ".env" is required by docker-compose # Following are ALSO used in demo/boot/portal_vm_init.sh -EP_IMG_NAME=onap/portal-apps +EP_IMG_NAME=onap/portal-app +SDK_IMG_NAME=onap/portal-sdk DB_IMG_NAME=onap/portal-db WMS_IMG_NAME=onap/portal-wms # Deployed with portal; built elsewhere CLI_IMG_NAME=onap/cli -# Tag all images with this -PORTAL_TAG=1.3.0 +# This is the first portion of the Docker image tag +# that is published to the ONAP registry. +PORTAL_VERSION=2.1 + +# This is used during builds and in docker-compose; +# it is never published to the ONAP registry. +PORTAL_TAG=beijing # Name of directory in apps container (NOT host) WEBAPPS_DIR=/opt/apache-tomcat-8.0.37/webapps @@ -25,5 +32,5 @@ EXTRA_HOST_NAME="" # Export shell environment variables on hosts with no DNS; # a line is added to docker container's /etc/hosts. # For example: -#EXTRA_HOST_IP="-i 135.207.161.163" +#EXTRA_HOST_IP="-i 10.11.12.13" #EXTRA_HOST_NAME="-n portal.api.simpledemo.openecomp.org" diff --git a/deliveries/Apps_Users_OnBoarding_Script.sql b/deliveries/Apps_Users_OnBoarding_Script.sql index 6e720b5a..8e7cc3c4 100644 --- a/deliveries/Apps_Users_OnBoarding_Script.sql +++ b/deliveries/Apps_Users_OnBoarding_Script.sql @@ -2,7 +2,7 @@ USE portal; SET FOREIGN_KEY_CHECKS=1; - + -- Apps; note that the IDs are used below. INSERT INTO `fn_app` (`app_id`, `app_name`, `app_image_url`, `app_description`, `app_notes`, `app_url`, `app_alternate_url`, `app_rest_endpoint`, `ml_app_name`, `ml_app_admin_id`, `mots_id`, `app_password`, `open`, `enabled`, `thumbnail`, `app_username`, `ueb_key`, `ueb_secret`, `ueb_topic_name`, `app_type`,`auth_central`,`auth_namespace`) VALUES @@ -68,8 +68,8 @@ insert into fn_role values(1000,'System Administrator','Y',1,2,1); -- SDK from 9 insert into fn_role values(1001,'Standard User','Y',1,2,16); -- SDK insert into fn_role values(1002,'System Administrator','Y',1,3,1); -- DMaap from 999 to 1 insert into fn_role values(1003,'Standard User','Y',1,3,16); -- DMaap -insert into fn_role values(1004,'System Administrator','Y',1,4,1); -- SDC from 999 to 1 -insert into fn_role values(1005,'Standard User','Y',1,4,16); -- SDC +insert into fn_role values(1004,'ADMIN','Y',1,4,0); -- SDC from 999 to 1 +insert into fn_role values(1005,'TESTOR','Y',1,4,1); -- SDC insert into fn_role values(1006,'System Administrator','Y',1,5,1); -- Policy from 999 to 1 insert into fn_role values(1007,'Standard User','Y',1,5,16); -- Policy insert into fn_role values(1008,'System Administrator','Y',1,6,1); -- VID from 999 to 1 @@ -86,9 +86,13 @@ INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (1,1 INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (1,1006,NULL,5); INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (1,1008,NULL,6); -INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (3,1004,NULL,4); - -INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (4,1004,NULL,4); +INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (2,1004,NULL,4); +INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (3,1005,NULL,4); +INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (4,1005,NULL,4); +INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (5,1005,NULL,4); +INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (6,1005,NULL,4); +INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (7,1005,NULL,4); +INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (8,1005,NULL,4); INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (9,999,NULL,1); INSERT INTO `fn_user_role` (`user_id`,`role_id`,`priority`,`app_id`) VALUES (9,1008,NULL,6); diff --git a/deliveries/Dockerfile.mariadb b/deliveries/Dockerfile.mariadb index 9424815b..347cc1e0 100644 --- a/deliveries/Dockerfile.mariadb +++ b/deliveries/Dockerfile.mariadb @@ -1,24 +1,22 @@ FROM mariadb:latest -ARG PORTAL_SCRIPT_DIR=${PORTAL_SCRIPT_DIR} -ARG SDK_SCRIPT_DIR=${SDK_SCRIPT_DIR} +ARG DB_SCRIPT_DIR=${DB_SCRIPT_DIR} # constant #Add config file COPY my.cnf /etc/mysql/my.cnf -#ADD cluster.cnf /etc/mysql/conf.d # Scripts are executed in alphabetical order -# Portal DDL and DML at 1710 -COPY ${PORTAL_SCRIPT_DIR}/EcompPortalDDLMySql_1710_Common.sql /docker-entrypoint-initdb.d/ -COPY ${PORTAL_SCRIPT_DIR}/EcompPortalDDLMySql_1710_OS.sql /docker-entrypoint-initdb.d/ -COPY ${PORTAL_SCRIPT_DIR}/EcompPortalDMLMySql_1710_Common.sql /docker-entrypoint-initdb.d/ -COPY ${PORTAL_SCRIPT_DIR}/EcompPortalDMLMySql_1710_OS.sql /docker-entrypoint-initdb.d/ -COPY Apps_Users_OnBoarding_Script.sql /docker-entrypoint-initdb.d/EcompPortalDMLMySql_1710_z_apps_users.sql +# Portal DDL and DML at v2.1 +COPY ${DB_SCRIPT_DIR}/PortalDDLMySql_2_1_Common.sql /docker-entrypoint-initdb.d/ +COPY ${DB_SCRIPT_DIR}/PortalDDLMySql_2_1_OS.sql /docker-entrypoint-initdb.d/ +COPY ${DB_SCRIPT_DIR}/PortalDMLMySql_2_1_Common.sql /docker-entrypoint-initdb.d/ +COPY ${DB_SCRIPT_DIR}/PortalDMLMySql_2_1_OS.sql /docker-entrypoint-initdb.d/ +# Do not copy the onboarding script here; it's mounted as a volume -# SDK App DDL and DML unchanged since 1707 -COPY ${SDK_SCRIPT_DIR}/EcompSdkDDLMySql_1710_Common.sql /docker-entrypoint-initdb.d/ -COPY ${SDK_SCRIPT_DIR}/EcompSdkDDLMySql_1710_OS.sql /docker-entrypoint-initdb.d/ -COPY ${SDK_SCRIPT_DIR}/EcompSdkDMLMySql_1710_Common.sql /docker-entrypoint-initdb.d/ -COPY ${SDK_SCRIPT_DIR}/EcompSdkDMLMySql_1710_OS.sql /docker-entrypoint-initdb.d/ +# SDK App DDL and DML +COPY ${DB_SCRIPT_DIR}/EcompSdkDDLMySql_1710_Common.sql /docker-entrypoint-initdb.d/ +COPY ${DB_SCRIPT_DIR}/EcompSdkDDLMySql_1710_OS.sql /docker-entrypoint-initdb.d/ +COPY ${DB_SCRIPT_DIR}/EcompSdkDMLMySql_1710_Common.sql /docker-entrypoint-initdb.d/ +COPY ${DB_SCRIPT_DIR}/EcompSdkDMLMySql_1710_OS.sql /docker-entrypoint-initdb.d/ diff --git a/deliveries/Dockerfile.portalapps b/deliveries/Dockerfile.portal index 17677aa8..81eeb655 100644 --- a/deliveries/Dockerfile.portalapps +++ b/deliveries/Dockerfile.portal @@ -1,5 +1,4 @@ -# Dockerfile for image with ONAP applications: -# Portal app, Portal-SDK app. +# Dockerfile for image with ONAP Portal # Yields an image 823 MB FROM frolvlad/alpine-oraclejdk8:slim @@ -10,7 +9,6 @@ FROM frolvlad/alpine-oraclejdk8:slim # the defaults below only support testing ARG PORTAL_WAR=build/ecompportal-be-os.war ARG FE_DIR=build/public -ARG SDK_WAR=build/epsdk-app-os.war ARG HTTP_PROXY ARG HTTPS_PROXY @@ -19,7 +17,6 @@ ARG TOMCAT=apache-tomcat-8.0.37 ARG TOMCATTAR=${TOMCAT}.tar.gz ARG TOMCATHOME=/opt/${TOMCAT} ARG PORTALCONTEXT=ONAPPORTAL -ARG SDKCONTEXT=ONAPPORTALSDK ENV http_proxy $HTTP_PROXY ENV https_proxy $HTTPS_PROXY @@ -37,17 +34,13 @@ RUN mkdir -p /opt RUN mv ${TOMCAT} /opt WORKDIR ${TOMCATHOME}/webapps -RUN mkdir ${PORTALCONTEXT} && mkdir ${SDKCONTEXT} +RUN mkdir ${PORTALCONTEXT} # Portal has many parts COPY $PORTAL_WAR ${PORTALCONTEXT} RUN cd ${PORTALCONTEXT} && unzip -q *.war && rm *.war COPY ${FE_DIR} ${PORTALCONTEXT}/public -# SDK app has only a war -COPY $SDK_WAR ${SDKCONTEXT} -RUN cd ${SDKCONTEXT} && unzip -q *.war && rm *.war - VOLUME ${TOMCATHOME}/logs # Switch back to root @@ -55,10 +48,8 @@ WORKDIR / # Define commonly used ENV variables ENV PATH $PATH:$JAVA_HOME/bin:${TOMCATHOME}/bin -# Install the wait script -COPY wait-for.sh / # Install the launch script -COPY start-apps-cmd.sh / +COPY start-apache-tomcat.sh / # Define default command -CMD /start-apps-cmd.sh +CMD /start-apache-tomcat.sh diff --git a/deliveries/Dockerfile.sdk b/deliveries/Dockerfile.sdk new file mode 100644 index 00000000..d5603871 --- /dev/null +++ b/deliveries/Dockerfile.sdk @@ -0,0 +1,53 @@ +# Dockerfile for image with ONAP Portal SDK demo app + +# Yields an image 823 MB +FROM frolvlad/alpine-oraclejdk8:slim +# Yields an image 1.4 GB +# FROM openjdk:8-jdk + +# Arguments are supplied by build.sh script +# the defaults below only support testing +ARG SDK_WAR=build/epsdk-app-os.war +ARG HTTP_PROXY +ARG HTTPS_PROXY + +# Just variables, never passed in +ARG TOMCAT=apache-tomcat-8.0.37 +ARG TOMCATTAR=${TOMCAT}.tar.gz +ARG TOMCATHOME=/opt/${TOMCAT} +ARG SDKCONTEXT=ONAPPORTALSDK + +ENV http_proxy $HTTP_PROXY +ENV https_proxy $HTTPS_PROXY +RUN if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi && \ + if [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf; fi + +# Install Tomcat. This image already has curl. +WORKDIR /tmp +RUN wget -q http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.37/bin/apache-tomcat-8.0.37.tar.gz +RUN tar -xzf ${TOMCATTAR} +RUN rm ${TOMCATTAR} +# Remove manager and sample apps +RUN rm -fr ${TOMCAT}/webapps/[a-z]* +RUN mkdir -p /opt +RUN mv ${TOMCAT} /opt + +WORKDIR ${TOMCATHOME}/webapps +RUN mkdir ${SDKCONTEXT} + +# SDK app has only a war +COPY $SDK_WAR ${SDKCONTEXT} +RUN cd ${SDKCONTEXT} && unzip -q *.war && rm *.war + +VOLUME ${TOMCATHOME}/logs + +# Switch back to root +WORKDIR / + +# Define commonly used ENV variables +ENV PATH $PATH:$JAVA_HOME/bin:${TOMCATHOME}/bin +# Install the launch script +COPY start-apache-tomcat.sh / + +# Define default command +CMD /start-apache-tomcat.sh diff --git a/deliveries/Dockerfile.widgetms b/deliveries/Dockerfile.widgetms index 72a11bb5..c7c42a29 100644 --- a/deliveries/Dockerfile.widgetms +++ b/deliveries/Dockerfile.widgetms @@ -10,10 +10,8 @@ ARG WMS_JAR=build/widget-ms.jar COPY ${WMS_JAR} /app.jar RUN sh -c 'touch /app.jar' -# Wait script, which depends on nc -COPY wait-for.sh / # Launch script -COPY start-wms-cmd.sh / +COPY start-wms.sh / # Define default command -CMD /start-wms-cmd.sh +CMD /start-wms.sh diff --git a/deliveries/build_portalapps_dockers.sh b/deliveries/build_portalapps_dockers.sh index 4d4aa833..d4f8968e 100755 --- a/deliveries/build_portalapps_dockers.sh +++ b/deliveries/build_portalapps_dockers.sh @@ -7,89 +7,86 @@ # Stop on error; show output set -e -x -# This reuses the docker-compose file +# This reuses the docker-compose environment file echo "Set image tag name variables" source $(dirname $0)/.env -# Work standalone AND in the ONAP Jenkins. +# Check for Jenkins build number +if [ -n "$BUILD_NUMBER" ]; then + echo "Using Jenkins build number $BUILD_NUMBER" +else + # This indicates a non-Jenkins build + export BUILD_NUMBER="999" +fi + +# Must work when called by ONAP Jenkins AND local builds. # Pick up Jenkins settings for this script. # Use -B for batch operation to skip download progress output if [ -n "$MVN" ]; then - export MVN="${MVN} -B -gs ${GLOBAL_SETTINGS_FILE} -s ${SETTINGS_FILE}" + export MVN="${MVN} -B -gs ${GLOBAL_SETTINGS_FILE} -s ${SETTINGS_FILE} -Dbuild.number=$BUILD_NUMBER" else # Force refresh of snapshots - MVN="mvn -B -U" + MVN="mvn -B -U -Dbuild.number=$BUILD_NUMBER" fi # This expects to start in the deliveries folder; make sure -PORTAL_DOCKERFILE=Dockerfile.portalapps +PORTAL_DOCKERFILE=Dockerfile.portal if [ ! -f $PORTAL_DOCKERFILE ] ; then echo "Failed to find file ${PORTAL_DOCKERFILE}; must start in deliveries folder; exiting" exit 1 fi +SDK_DOCKERFILE=Dockerfile.sdk # Store directory names as variables -# This is the Docker Project area. -DELIV="$(pwd)" +# This is the deliveries area. +DELIVDIR="$(pwd)" # parent directory, for finding source projects cd .. -BASE="$(pwd)" -cd $DELIV +BASEDIR="$(pwd)" +cd $DELIVDIR # Relative path of temp directory BUILD_REL="build" # Absolute path of temp directory -BUILD_ABS=$DELIV/$BUILD_REL -rm -fr $BUILD_REL -mkdir $BUILD_REL +BUILD_ABS=$DELIVDIR/$BUILD_REL -# Copy DDL/DML to required directories +# Build Java projects. +# (use env var toskip when debugging Docker build problems) +if [ "$SKIP_JAVA_BUILD" = "please" ]; then -# RELATIVE PATHS to local directories with database scripts -# bcos Docker looks within this build area only -SCR_BASE=$BUILD_REL/scripts -PORTAL_SCRIPT_DIR=$SCR_BASE/ecomp-portal-DB-os -SDK_SCRIPT_DIR=$SCR_BASE/epsdk-app-os -mkdir -p ${PORTAL_SCRIPT_DIR} ${SDK_SCRIPT_DIR} + echo "SKIPPING JAVA BUILD!" -# copy over DB scripts for the dockerfiles -# Portal -cp $BASE/ecomp-portal-DB-common/*.sql ${PORTAL_SCRIPT_DIR} -cp $BASE/ecomp-portal-DB-os/*.sql ${PORTAL_SCRIPT_DIR} -# SDK app -cp $BASE/sdk/ecomp-sdk/epsdk-app-common/db-scripts/*.sql ${SDK_SCRIPT_DIR} -cp $BASE/sdk/ecomp-sdk/epsdk-app-os/db-scripts/*.sql ${SDK_SCRIPT_DIR} +else + echo "Starting Java build." -# build database docker -DB_DOCKER_CMD=" - docker build -t ${DB_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS} - --build-arg PORTAL_SCRIPT_DIR=${PORTAL_SCRIPT_DIR} - --build-arg SDK_SCRIPT_DIR=${SDK_SCRIPT_DIR} - -f Dockerfile.mariadb . -" -echo "Build mariadb docker image" -$DB_DOCKER_CMD + # Clean out and recreate + rm -fr $BUILD_REL + mkdir $BUILD_REL -echo "Build all jar and war files in Portal" -cd $BASE -${MVN} clean install + echo "Build jar and war files" + cd $BASEDIR + ${MVN} clean install + + echo "Build Portal-SDK app" + cd $BASEDIR/sdk/ecomp-sdk/epsdk-app-os + ${MVN} clean package + + echo "Java build complete." +fi echo "Copy Portal app BE" -cd $BASE/ecomp-portal-BE-os -cp target/ecompportal-be-os.war $BUILD_ABS +cp $BASEDIR/ecomp-portal-BE-os/target/portal-be-os.war $BUILD_ABS echo "Copy Portal app FE" -cd $BASE/ecomp-portal-FE-os/ -cp -r dist/public $BUILD_ABS +cp -r $BASEDIR/ecomp-portal-FE-os/dist/public $BUILD_ABS echo "Copy Portal widget-ms" -cd $BASE/ecomp-portal-widget-ms -cp widget-ms/target/widget-ms.jar $BUILD_ABS +cp $BASEDIR/ecomp-portal-widget-ms/widget-ms/target/widget-ms.jar $BUILD_ABS + +echo "Copy Portal-SDK app build results" +cp $BASEDIR/sdk/ecomp-sdk/epsdk-app-os/target/epsdk-app-os.war $BUILD_ABS -echo "Build and copy Portal-SDK app" -cd $BASE/sdk/ecomp-sdk/epsdk-app-os -${MVN} clean package -cp target/epsdk-app-os.war $BUILD_ABS +# Build Docker images PROXY_ARGS="" if [ $HTTP_PROXY ]; then @@ -99,18 +96,47 @@ if [ $HTTPS_PROXY ]; then PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" fi +# must work in delivery directory +cd $DELIVDIR + +# Copy DDL/DML to required directories +# RELATIVE PATHS to local directories with database scripts +# bcos Docker looks within this build area only +DB_SCRIPT_DIR=$BUILD_REL/db-scripts +mkdir -p ${DELIVDIR}/${DB_SCRIPT_DIR} +# Portal +cp $BASEDIR/ecomp-portal-DB-common/*.sql ${DB_SCRIPT_DIR} +cp $BASEDIR/ecomp-portal-DB-os/*.sql ${DB_SCRIPT_DIR} +# SDK app +cp $BASEDIR/sdk/ecomp-sdk/epsdk-app-common/db-scripts/*.sql ${DB_SCRIPT_DIR} +cp $BASEDIR/sdk/ecomp-sdk/epsdk-app-os/db-scripts/*.sql ${DB_SCRIPT_DIR} + +echo "Build mariadb docker image" +DB_DOCKER_CMD=" + docker build -t ${DB_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS} + --build-arg DB_SCRIPT_DIR=${DB_SCRIPT_DIR} + -f Dockerfile.mariadb . +" +$DB_DOCKER_CMD + echo "Build portal docker image" -cd $DELIV PORTAL_DOCKER_CMD=" docker build -t ${EP_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS} --build-arg FE_DIR=$BUILD_REL/public - --build-arg PORTAL_WAR=$BUILD_REL/ecompportal-be-os.war - --build-arg SDK_WAR=$BUILD_REL/epsdk-app-os.war + --build-arg PORTAL_WAR=$BUILD_REL/portal-be-os.war -f $PORTAL_DOCKERFILE . " $PORTAL_DOCKER_CMD -echo "Bbuild widget-ms docker image" +echo "Build sdk demo app docker image" +SDK_DOCKER_CMD=" + docker build -t ${SDK_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS} + --build-arg SDK_WAR=$BUILD_REL/epsdk-app-os.war + -f $SDK_DOCKERFILE . +" +$SDK_DOCKER_CMD + +echo "Build widget-ms docker image" WMS_DOCKER_CMD=" docker build -t ${WMS_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS} --build-arg WMS_JAR=$BUILD_REL/widget-ms.jar diff --git a/deliveries/docker-compose.yml b/deliveries/docker-compose.yml index a5db5471..4e5879e7 100644 --- a/deliveries/docker-compose.yml +++ b/deliveries/docker-compose.yml @@ -30,6 +30,8 @@ services: volumes: # Just specify a path and let the Engine create a volume - /var/lib/mysql + # Inject the onboarding script at start time + - ./Apps_Users_OnBoarding_Script.sql:/docker-entrypoint-initdb.d/zzz_apps_users_onboarding.sql logging: driver: json-file healthcheck: @@ -49,14 +51,13 @@ services: condition: service_healthy volumes: - ${PROPS_DIR}/ONAPWIDGETMS/application.properties:/application.properties + - ${PROPS_DIR}/ONAPWIDGETMS/application.yml:/application.yml command: - - /start-wms-cmd.sh + - /start-wms.sh logging: driver: json-file - # Environment variables here CANNOT override the database URL because - # two apps use identical configuration keys with different values - portal-apps: + portal-app: image: ${EP_IMG_NAME}:${PORTAL_TAG} ports: - 8989:8080 @@ -76,16 +77,34 @@ services: - ${PROPS_DIR}/ONAPPORTAL/portal.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/portal.properties - ${PROPS_DIR}/ONAPPORTAL/openid-connect.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/openid-connect.properties - ${PROPS_DIR}/ONAPPORTAL/logback.xml:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/logback.xml - - ${PROPS_DIR}/ONAPPORTALSDK/fusion.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties - - ${PROPS_DIR}/ONAPPORTALSDK/system.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/conf/system.properties - - ${PROPS_DIR}/ONAPPORTALSDK/portal.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/portal.properties - - ${PROPS_DIR}/ONAPPORTALSDK/logback.xml:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/logback.xml - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs command: - - /start-apps-cmd.sh + - /start-apache-tomcat.sh # see comments in .env file + - -i - $EXTRA_HOST_IP + - -n - $EXTRA_HOST_NAME logging: driver: json-file + portal-sdk: + image: ${SDK_IMG_NAME}:${PORTAL_TAG} + ports: + - 8990:8080 + links: + - portal-db + - portal-wms + depends_on: + portal-db: + condition: service_healthy + volumes: + - ${PROPS_DIR}/ONAPPORTALSDK/fusion.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties + - ${PROPS_DIR}/ONAPPORTALSDK/system.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/conf/system.properties + - ${PROPS_DIR}/ONAPPORTALSDK/portal.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/portal.properties + - ${PROPS_DIR}/ONAPPORTALSDK/logback.xml:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/logback.xml + - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs + command: + - /start-apache-tomcat.sh + logging: + driver: json-file diff --git a/deliveries/local-dev-host-clone.sh b/deliveries/local-dev-host-clone.sh new file mode 100644 index 00000000..36fdaccb --- /dev/null +++ b/deliveries/local-dev-host-clone.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Sets up a new build area for Portal projects on on a dev/test host such as vm-ep-dev3 + +USER=attuid-goes-here +git clone https://${USER}@codecloud.web.att.com/scm/st_quantum/lf_portal.git +cd lf_portal +git clone https://${USER}@codecloud.web.att.com/scm/st_quantum/lf_portal_sdk.git sdk diff --git a/deliveries/local-dev-host-pull.sh b/deliveries/local-dev-host-pull.sh new file mode 100644 index 00000000..acb344b5 --- /dev/null +++ b/deliveries/local-dev-host-pull.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Refreshes an existing build area for Portal projects on on a dev/test host such as vm-ep-dev3 + +set -x +git pull +cd sdk +git pull diff --git a/deliveries/local-dev-host-start.sh b/deliveries/local-dev-host-start.sh new file mode 100644 index 00000000..4230c393 --- /dev/null +++ b/deliveries/local-dev-host-start.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Starts docker containers for ONAP Portal in test environment +# For development use only; this does NOT pull from git nor build. + +# be verbose +set -x + +# Get variables from docker-compose environment file +source .env + +# Define local subdirectory with host-specific property files +# The leading "./" is required for docker-compose +export PROPS_DIR=./properties_vm-ep-dev11 +if [ ! -d $PROPS_DIR ] ; then + echo "Failed to find directory $PROPS_DIR" + exit 1 +fi +echo "Using properties directory $PROPS_DIR" + +# Constants as of Oct 2017, Amsterdam release +NEXUS_REPO=nexus3.onap.org:10001 +CLI_IMG_VERSION=1.1-STAGING-latest + +# Pull and tag the CLI image, which is provided elsewhere. +# Authenticate like this; the username and password are NOT stored here. +docker login -u username -p password $NEXUS_REPO +docker pull $NEXUS_REPO/$CLI_IMG_NAME:${CLI_IMG_VERSION} +docker tag $NEXUS_REPO/$CLI_IMG_NAME:${CLI_IMG_VERSION} $CLI_IMG_NAME:$PORTAL_TAG + +# Create local logs directory +# The leading "./" is required for docker-compose +export LOGS_DIR=./logs +mkdir -p $LOGS_DIR + +# Make inter-app communication work in dev3 +export EXTRA_HOST_IP="135.207.161.175" +export EXTRA_HOST_NAME="portal.api.simpledemo.onap.org" + +# (re)start containers +docker-compose down +docker-compose up -d diff --git a/deliveries/os_docker_base.sh b/deliveries/os_docker_base.sh index 3f110003..73617049 100755 --- a/deliveries/os_docker_base.sh +++ b/deliveries/os_docker_base.sh @@ -18,9 +18,6 @@ fi # this into os_docker_push, os_docker_release scripts NEXUS_REPO=nexus3.onap.org:10003 -# Establish environment variables -source $(dirname $0)/.env - # Build the containers ./build_portalapps_dockers.sh diff --git a/deliveries/os_docker_push.sh b/deliveries/os_docker_push.sh index 30bd3dc7..39035199 100755 --- a/deliveries/os_docker_push.sh +++ b/deliveries/os_docker_push.sh @@ -4,8 +4,16 @@ # be verbose set -x +# Establish environment variables +source $(dirname $0)/.env + +if [ -z "$PORTAL_VERSION" ]; then + echo "PORTAL_VERSION not set" + exit 1 +fi + TIMESTAMP=$(date +%C%y%m%dT%H%M%S) -export VERSION="1.3.0-SNAPSHOT-${TIMESTAMP}" +export VERSION="${PORTAL_VERSION}-${TIMESTAMP}" export LATEST="latest" exec ./os_docker_base.sh diff --git a/deliveries/os_docker_release.sh b/deliveries/os_docker_release.sh index 45a14507..2a22fef8 100755 --- a/deliveries/os_docker_release.sh +++ b/deliveries/os_docker_release.sh @@ -4,8 +4,16 @@ # be verbose set -x +# Establish environment variables +source $(dirname $0)/.env + +if [ -z "$PORTAL_VERSION" ]; then + echo "PORTAL_VERSION not set" + exit 1 +fi + TIMESTAMP=$(date +%C%y%m%dT%H%M%S) -export VERSION="1.3.0-STAGING-${TIMESTAMP}" -export LATEST="1.3-STAGING-latest" +export VERSION="${PORTAL_VERSION}-STAGING-${TIMESTAMP}" +export LATEST="${PORTAL_VERSION}-STAGING-latest" exec ./os_docker_base.sh diff --git a/deliveries/properties_simpledemo/ONAPPORTALSDK/logback.xml b/deliveries/properties_simpledemo/ONAPPORTALSDK/logback.xml index 32a790c6..8daf2ccc 100644 --- a/deliveries/properties_simpledemo/ONAPPORTALSDK/logback.xml +++ b/deliveries/properties_simpledemo/ONAPPORTALSDK/logback.xml @@ -41,12 +41,12 @@ <!-- Logback files for the ONAP Portal SDK Application are created in directory ${catalina.base}/logs/${componentName} - e.g., apache-tomcat-8.0.35/logs/epsdk_app/application.log + e.g., apache-tomcat-8.0.35/logs/onapsdk/application.log --> <!--<jmxConfigurator /> --> <!-- specify the component name --> - <property name="componentName" value="epsdk_app"></property> + <property name="componentName" value="onapsdk"></property> <!-- specify the base path of the log directory --> <property name="logDirPrefix" value="${catalina.base}/logs"></property> diff --git a/deliveries/properties_simpledemo/ONAPPORTALSDK/system.properties b/deliveries/properties_simpledemo/ONAPPORTALSDK/system.properties index 5bdd0720..c80d2f0e 100644 --- a/deliveries/properties_simpledemo/ONAPPORTALSDK/system.properties +++ b/deliveries/properties_simpledemo/ONAPPORTALSDK/system.properties @@ -62,3 +62,6 @@ guard_notebook_url= #authenticate user server authenticate_user_server=http://portal.onap.org:8383/openid-connect-server-webapp/allUsers + +#cookie domain +cookie_domain = onap.org diff --git a/deliveries/properties_simpledemo/ONAPWIDGETMS/application.properties b/deliveries/properties_simpledemo/ONAPWIDGETMS/application.properties index 7240a61a..547a882c 100644 --- a/deliveries/properties_simpledemo/ONAPWIDGETMS/application.properties +++ b/deliveries/properties_simpledemo/ONAPWIDGETMS/application.properties @@ -31,5 +31,3 @@ account.user.password=6APqvG4AU2rfLgCvMdySwQ== #server.ssl.keyStoreType=PKCS12 #server.ssl.keyAlias=widget-microservice -## Jasypt Properties -jasypt.encryptor.password=EncryptionKey diff --git a/deliveries/properties_simpledemo/ONAPWIDGETMS/application.yml b/deliveries/properties_simpledemo/ONAPWIDGETMS/application.yml new file mode 100644 index 00000000..d655bc92 --- /dev/null +++ b/deliveries/properties_simpledemo/ONAPWIDGETMS/application.yml @@ -0,0 +1,3 @@ +jasypt: + encryptor: + password: EncryptionKey diff --git a/deliveries/start-apps-cmd.sh b/deliveries/start-apache-tomcat.sh index 7d3a8ada..db39248b 100755..100644 --- a/deliveries/start-apps-cmd.sh +++ b/deliveries/start-apache-tomcat.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Starts the Apache-Tomcat web container with the Portal, EPSDK and DMaaP BC web apps. +# Starts the Apache-Tomcat web container. # If arguments "-i ip.2.3.4" AND "-n name" are present, adds an entry to /etc/hosts; # this was added as a workaround for missing DNS in the CSIT environment. @@ -10,11 +10,13 @@ while [ $# -gt 0 ]; do case $key in -i|--ip) hostip="$2" + echo "$0: option -i value is $hostip" shift # past argument shift # past value ;; -n|--name) hostname="$2" + echo "$0: option -n value is $hostname" shift # past argument shift # past value ;; @@ -26,14 +28,18 @@ while [ $# -gt 0 ]; do done # Optionally add to /etc/hosts -if [ -z "${hostip}" -o -z "${hostname}" ]; then - echo "$0: Arguments for IP and name not found, continuing." +# Docker-compose supplies arguments "" +if [ ${#hostip} -lt 3 -o ${#hostname} -lt 3 ]; then + echo "$0: values for IP (-i) and/or name (-n) are empty or short" else - echo "$0: Using IP-name arguments $hostip $hostname" + echo "$0: using IP-name arguments $hostip $hostname" grep $hostname /etc/hosts ret_code=$? if [ $ret_code != 0 ]; then + echo "$0: extending hosts with $hostname" echo "$hostip $hostname" >> /etc/hosts + else + echo "$0: hosts already has $hostname" fi fi diff --git a/deliveries/start-wms-cmd.sh b/deliveries/start-wms.sh index dc8336e7..dc8336e7 100755..100644 --- a/deliveries/start-wms-cmd.sh +++ b/deliveries/start-wms.sh diff --git a/deliveries/wait-for.sh b/deliveries/wait-for.sh deleted file mode 100755 index 25258218..00000000 --- a/deliveries/wait-for.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -# https://github.com/Eficode/wait-for.git -# MIT License - -TIMEOUT=15 -QUIET=0 - -echoerr() { - if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi -} - -usage() { - exitcode="$1" - cat << USAGE >&2 -Usage: - $cmdname host:port [-t timeout] [-- command args] - -q | --quiet Do not output any status messages - -t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit "$exitcode" -} - -wait_for() { - command="$*" - if [ "$QUIET" -ne 1 ]; then echo "$0: probing host $HOST port $PORT"; fi - for i in `seq $TIMEOUT` ; do - nc -z "$HOST" "$PORT" > /dev/null 2>&1 - result=$? - if [ $result -eq 0 ] ; then - if [ "$QUIET" -ne 1 ]; then echo "$0: operation succeeded on try $i"; fi - if [ -n "$command" ] ; then - if [ "$QUIET" -ne 1 ]; then echo "$0: exec-ing command $command"; fi - exec $command - fi - exit 0 - fi - if [ "$QUIET" -ne 1 ]; then echo "$0: sleeping after try $i"; fi - sleep 1 - done - echo "$0: Operation timed out" >&2 - exit 1 -} - -while [ $# -gt 0 ] -do - case "$1" in - *:* ) - HOST=$(printf "%s\n" "$1"| cut -d : -f 1) - PORT=$(printf "%s\n" "$1"| cut -d : -f 2) - shift 1 - ;; - -q | --quiet) - QUIET=1 - shift 1 - ;; - -t) - TIMEOUT="$2" - if [ "$TIMEOUT" = "" ]; then break; fi - shift 2 - ;; - --timeout=*) - TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - break - ;; - --help) - usage 0 - ;; - *) - echoerr "Unknown argument: $1" - usage 1 - ;; - esac -done - -if [ "$HOST" = "" -o "$PORT" = "" ]; then - echoerr "Error: you need to provide a host and port to test." - usage 2 -fi - -wait_for "$@" |