summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Brady <patrick.brady@att.com>2019-01-17 13:21:47 -0800
committerPatrick Brady <patrick.brady@att.com>2019-01-18 12:33:18 -0800
commitc67e66efb4450c3d6f041185998b73a5e2b35cce (patch)
tree2438711419e9388f57bb8935506378df62a7d16b
parent0e67e9860a1edfdcd1b9356085af1f19acee6162 (diff)
Change to feature pre-install
Adding a new script dockerInstall.sh which will run during the docker build and install the opendaylight features so that start-up time for the image is reduced. Change-Id: I6cf8bc0a746e6d5037c8689c576ddb42a54155ff Signed-off-by: Patrick Brady <patrick.brady@att.com> Issue-ID: APPC-1322
-rw-r--r--installation/appc/src/main/docker/Dockerfile20
-rw-r--r--installation/appc/src/main/scripts/dockerInstall.sh87
-rw-r--r--installation/appc/src/main/scripts/installFeatures.sh2
-rw-r--r--installation/appc/src/main/scripts/installZips.sh37
-rw-r--r--installation/appc/src/main/scripts/startODL.sh57
5 files changed, 114 insertions, 89 deletions
diff --git a/installation/appc/src/main/docker/Dockerfile b/installation/appc/src/main/docker/Dockerfile
index 7720910..5e39eed 100644
--- a/installation/appc/src/main/docker/Dockerfile
+++ b/installation/appc/src/main/docker/Dockerfile
@@ -1,7 +1,7 @@
# ============LICENSE_START==========================================
# ONAP : APPC
# ===================================================================
-# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -30,16 +30,18 @@ ENV APPC_CONFIG_DIR /opt/onap/appc/data/properties
# Copy the opt folder to the container's /opt folder
COPY opt /opt
-# We are keeping the feature installers in their
-# own folders in the docker staging repository.
-# The number of feature directories is defined in
-# the installZips.sh file.
-COPY featureDir1 /opt/onap/appc/features
-COPY featureDir2 /opt/onap/appc/features
-COPY featureDir3 /opt/onap/appc/features
-COPY featureDir4 /opt/onap/appc/features
+#Copy the directory containing each features' install script
+COPY featureDir /opt/onap/appc/features
+
+#Copy the directory containing a system folder and an etc folder in order
+# to merge both of these with the opendaylight folders of the same names.
+COPY repoDir /opt/opendaylight
+
RUN ln -s /opt/onap/appc /opt/appc
+#Start opendaylight and pre-install the appc features
+RUN opt/onap/appc/bin/dockerInstall.sh
+
# Expose port 8181 for ODL REST calls
EXPOSE 8181
diff --git a/installation/appc/src/main/scripts/dockerInstall.sh b/installation/appc/src/main/scripts/dockerInstall.sh
new file mode 100644
index 0000000..1196004
--- /dev/null
+++ b/installation/appc/src/main/scripts/dockerInstall.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# APPC
+# ================================================================================
+# 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=========================================================
+###
+
+#
+# This script runs during docker image build.
+# It starts opendaylight, installs the appc features, then shuts down opendaylight.
+#
+ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
+ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
+SDNC_HOME=${SDNC_HOME:-/opt/onap/ccsdk}
+APPC_HOME=${APPC_HOME:-/opt/onap/appc}
+SLEEP_TIME=${SLEEP_TIME:-120}
+MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
+
+appcInstallStartTime=$(date +%s)
+
+
+
+echo "Starting OpenDaylight"
+${ODL_HOME}/bin/start
+echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
+sleep ${SLEEP_TIME}
+
+echo "Copying a working version of the logging configuration into the opendaylight etc folder"
+cp ${APPC_HOME}/data/org.ops4j.pax.logging.cfg ${ODL_HOME}/etc/org.ops4j.pax.logging.cfg
+echo "Copying a new version of aaf cadi shiro into the opendaylight deploy folder"
+cp ${APPC_HOME}/data/aaf-shiro-aafrealm-osgi-bundle.jar ${ODL_HOME}/deploy/aaf-shiro-aafrealm-osgi-bundle.jar
+
+echo "Installing APPC platform features"
+${APPC_HOME}/bin/installFeatures.sh
+
+echo "Adding a property system.properties for AAF cadi.properties location"
+echo "" >> ${ODL_HOME}/etc/system.properties
+echo "cadi_prop_files=${APPC_HOME}/data/properties/cadi.properties" >> ${ODL_HOME}/etc/system.properties
+echo "" >> ${ODL_HOME}/etc/system.properties
+
+echo "Adding a value to property appc.asdc.env in appc.properties for appc-asdc-listener feature"
+echo "" >> $APPC_HOME/data/properties/appc.properties
+echo "appc.asdc.env=$DMAAP_TOPIC_ENV" >> $APPC_HOME/data/properties/appc.properties
+echo "" >> $APPC_HOME/data/properties/appc.properties
+
+echo "Copying the aaa shiro configuration into opendaylight"
+cp ${APPC_HOME}/data/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml
+
+echo "Stopping OpenDaylight"
+${ODL_HOME}/bin/stop
+checkRun () {
+ running=0
+ while read a b c d e f g h
+ do
+ if [ "$h" == "/bin/sh /opt/opendaylight/bin/karaf server" ]
+ then
+ running=1
+ fi
+ done < <(ps -eaf)
+ echo $running
+}
+
+while [ $( checkRun ) == 1 ]
+do
+ echo "Karaf is still running, waiting..."
+ sleep 5s
+done
+echo "Karaf process has stopped"
+sleep 10s
+
+appcInstallEndTime=$(date +%s)
+echo "Total Appc install took $(expr $appcInstallEndTime - $appcInstallStartTime) seconds"
diff --git a/installation/appc/src/main/scripts/installFeatures.sh b/installation/appc/src/main/scripts/installFeatures.sh
index 98844ef..1675a82 100644
--- a/installation/appc/src/main/scripts/installFeatures.sh
+++ b/installation/appc/src/main/scripts/installFeatures.sh
@@ -4,7 +4,7 @@
# ============LICENSE_START=======================================================
# APPC
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-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.
diff --git a/installation/appc/src/main/scripts/installZips.sh b/installation/appc/src/main/scripts/installZips.sh
index 1bb1495..b6ca122 100644
--- a/installation/appc/src/main/scripts/installZips.sh
+++ b/installation/appc/src/main/scripts/installZips.sh
@@ -4,7 +4,7 @@
# ============LICENSE_START=======================================================
# APPC
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-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.
@@ -33,16 +33,13 @@ SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
targetDir=${1:-${APPC_HOME}}
sdnc_targetDir=${1:-${SDNC_HOME}}
-#We are going to use a series of directories in the docker-stage folder to extract features to.
-#By extracting features into more than one directory, we can copy them into the docker image in
-#different parts, creating more even layer sizes in the docker image.
+#The featureDir holds the install-feature shell scripts for each feature
featureDir=$2/featureDir
-#This value determine how many feature directories we want. The featutures will be evenly split
-#into the number of directories specified. Any remainder will be put into the last directory.
-#IF THE FEATURES_DIRECTORY_COUNT IS CHANGED, THE DOCKERFILE MUST ALSO BE UPDATED SINCE IT CONTAINS
-#A COPY COMMAND FOR EACH FEATURE DIRECTORY!! See the Dockerfile for more information.
-FEATURE_DIRECTORY_COUNT=4
+#The repoDir is where the classes are extracted to. This will be merged with the opendaylight
+# system directory.
+repoDir=$2/repoDir
+
APPC_FEATURES=" \
appc-core \
@@ -100,25 +97,13 @@ mavenOpts="-s ${SETTINGS_FILE} -gs ${GLOBAL_SETTINGS_FILE}"
cd ${tmpDir}
echo "Installing APP-C version ${APPC_VERSION}"
-
-#The math for splitting up the features into folders
-featureNumber=1
-featureDirNumber=1
for feature in ${APPC_FEATURES}
do
-if (( $featureDirNumber < $FEATURE_DIRECTORY_COUNT ))
-then
- if (( $featureNumber > $FEATURES_PER_DIRECTORY ))
- then
- featureDirNumber=$(($featureDirNumber+1))
- featureNumber=1
- fi
-fi
-
- rm -f ${tmpDir}/${feature}-installer*.zip
- mvn -U ${mavenOpts} org.apache.maven.plugins:maven-dependency-plugin:2.9:copy -Dartifact=org.onap.appc:${feature}-installer:${APPC_VERSION}:zip -DoutputDirectory=${tmpDir} -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.ssl.insecure=true
- unzip -d ${featureDir}$featureDirNumber ${tmpDir}/${feature}-installer*zip
-featureNumber=$(($featureNumber+1))
+ rm -f ${tmpDir}/${feature}-installer*.zip
+ mvn -U ${mavenOpts} org.apache.maven.plugins:maven-dependency-plugin:2.9:copy -Dartifact=org.onap.appc:${feature}-installer:${APPC_VERSION}:zip -DoutputDirectory=${tmpDir} -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.ssl.insecure=true
+ unzip -d ${featureDir} ${tmpDir}/${feature}-installer*zip
+ unzip -n -d ${repoDir} ${featureDir}/${feature}/${feature}*zip
+ rm -f ${featureDir}/${feature}/${feature}*zip
done
echo "Installing platform-logic for APP-C"
diff --git a/installation/appc/src/main/scripts/startODL.sh b/installation/appc/src/main/scripts/startODL.sh
index a359d02..52e524b 100644
--- a/installation/appc/src/main/scripts/startODL.sh
+++ b/installation/appc/src/main/scripts/startODL.sh
@@ -4,7 +4,7 @@
# ============LICENSE_START=======================================================
# APPC
# ================================================================================
-# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-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.
@@ -32,8 +32,6 @@ APPC_HOME=${APPC_HOME:-/opt/onap/appc}
SLEEP_TIME=${SLEEP_TIME:-120}
MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
-appcInstallStartTime=$(date +%s)
-
#
# Adding the DMAAP_TOPIC_ENV variable into APPC-ASDC-LISTENER properties
#
@@ -47,11 +45,6 @@ if [ -z "$DMAAP_TOPIC_ENV" ]
echo "DMAAP_TOPIC_ENV shell variable exists and it's $DMAAP_TOPIC_ENV"
fi
-echo "Adding a value to property appc.asdc.env in appc.properties for appc-asdc-listener feature"
-echo "" >> $APPC_HOME/data/properties/appc.properties
-echo "appc.asdc.env=$DMAAP_TOPIC_ENV" >> $APPC_HOME/data/properties/appc.properties
-echo "" >> $APPC_HOME/data/properties/appc.properties
-
#
# Wait for database to init properly
#
@@ -71,24 +64,13 @@ then
${APPC_HOME}/bin/installAppcDb.sh
echo "Installing ODL Host Key"
${SDNC_HOME}/bin/installOdlHostKey.sh
- echo "Starting OpenDaylight"
- ${ODL_HOME}/bin/start
- echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
- sleep ${SLEEP_TIME}
- echo "Copying a working version of the logging configuration into the opendaylight etc folder"
- cp ${APPC_HOME}/data/org.ops4j.pax.logging.cfg ${ODL_HOME}/etc/org.ops4j.pax.logging.cfg
- echo "Copying a new version of aaf cadi shiro into the opendaylight deploy folder"
- cp ${APPC_HOME}/data/aaf-shiro-aafrealm-osgi-bundle.jar ${ODL_HOME}/deploy/aaf-shiro-aafrealm-osgi-bundle.jar
- echo "Installing SDNC platform features"
- ${SDNC_HOME}/bin/installFeatures.sh
+
if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
then
echo "Installing directed graphs"
${SDNC_HOME}/svclogic/bin/install.sh
fi
- echo "Installing APPC platform features"
- ${APPC_HOME}/bin/installFeatures.sh
@@ -98,42 +80,11 @@ then
${APPC_HOME}/svclogic/bin/install-converted-dgs.sh
fi
- echo "Adding a property system.properties for AAF cadi.properties location"
- echo "" >> ${ODL_HOME}/etc/system.properties
- echo "cadi_prop_files=${APPC_HOME}/data/properties/cadi.properties" >> ${ODL_HOME}/etc/system.properties
- echo "" >> ${ODL_HOME}/etc/system.properties
-
- echo "Copying the aaa shiro configuration into opendaylight"
- cp ${APPC_HOME}/data/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml
-
- echo "Restarting OpenDaylight"
- ${ODL_HOME}/bin/stop
- checkRun () {
- running=0
- while read a b c d e f g h
- do
- if [ "$h" == "/bin/sh /opt/opendaylight/bin/karaf server" ]
- then
- running=1
- fi
- done < <(ps -eaf)
- echo $running
- }
-
- while [ $( checkRun ) == 1 ]
- do
- echo "Karaf is still running, waiting..."
- sleep 5s
- done
- echo "Karaf process has stopped"
- sleep 10s
- echo "Installed at `date`" > ${SDNC_HOME}/.installed
+echo "Installed at `date`" > ${SDNC_HOME}/.installed
fi
- appcInstallEndTime=$(date +%s)
- echo "Total Appc install took $(expr $appcInstallEndTime - $appcInstallStartTime) seconds"
-
echo "Starting cdt-proxy-service jar, logging to ${APPC_HOME}/cdt-proxy-service/jar.log"
java -jar ${APPC_HOME}/cdt-proxy-service/cdt-proxy-service.jar > ${APPC_HOME}/cdt-proxy-service/jar.log &
+echo "Starting ODL/APPC"
exec ${ODL_HOME}/bin/karaf server