summaryrefslogtreecommitdiffstats
path: root/deliveries
diff options
context:
space:
mode:
Diffstat (limited to 'deliveries')
-rw-r--r--deliveries/.env16
-rw-r--r--deliveries/Dockerfile.portalapps8
-rw-r--r--deliveries/Dockerfile.widgetms15
-rw-r--r--deliveries/docker-compose.yml3
-rwxr-xr-xdeliveries/start-apps-cmd.sh47
-rwxr-xr-xdeliveries/wait-for.sh7
6 files changed, 78 insertions, 18 deletions
diff --git a/deliveries/.env b/deliveries/.env
index f5d1090c..0a3230d7 100644
--- a/deliveries/.env
+++ b/deliveries/.env
@@ -14,6 +14,16 @@ PORTAL_TAG=1.3.0
# Name of directory in apps container (NOT host)
WEBAPPS_DIR=/opt/apache-tomcat-8.0.37/webapps
-# Expected environment variables (NOT defined here):
-# LOGS_DIR
-# PROPS_DIR
+# Required settings with default values.
+# Export shell environment variables on ALL hosts.
+LOGS_DIR=./logs
+PROPS_DIR=./properties_rackspace
+
+# Optional settings with no defaults.
+EXTRA_HOST_IP=""
+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_NAME="-n portal.api.simpledemo.openecomp.org"
diff --git a/deliveries/Dockerfile.portalapps b/deliveries/Dockerfile.portalapps
index c9fab4db..b1bf88c5 100644
--- a/deliveries/Dockerfile.portalapps
+++ b/deliveries/Dockerfile.portalapps
@@ -25,9 +25,6 @@ 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 the wait script
-COPY wait-for.sh /
-
# 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
@@ -61,7 +58,10 @@ 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 /
-# Define default command.
+# Define default command
CMD /start-apps-cmd.sh
diff --git a/deliveries/Dockerfile.widgetms b/deliveries/Dockerfile.widgetms
index 16bf60b1..72a11bb5 100644
--- a/deliveries/Dockerfile.widgetms
+++ b/deliveries/Dockerfile.widgetms
@@ -1,18 +1,19 @@
# Large image
# FROM openjdk:8-jdk
-# Very small image
+# Tiny image; it includes java and nc
FROM frolvlad/alpine-oraclejdk8:slim
# Arguments are supplied by build script;
# the defaults below only support testing
ARG WMS_JAR=build/widget-ms.jar
-# Launch script
-COPY start-wms-cmd.sh /
-# Wait script, which depends on nc
-COPY wait-for.sh /
# Onejar
COPY ${WMS_JAR} /app.jar
RUN sh -c 'touch /app.jar'
-VOLUME /tmp
-ENV JAVA_OPTS=""
+
+# Wait script, which depends on nc
+COPY wait-for.sh /
+# Launch script
+COPY start-wms-cmd.sh /
+
+# Define default command
CMD /start-wms-cmd.sh
diff --git a/deliveries/docker-compose.yml b/deliveries/docker-compose.yml
index 73a19daf..d80b6a03 100644
--- a/deliveries/docker-compose.yml
+++ b/deliveries/docker-compose.yml
@@ -91,5 +91,8 @@ services:
- portal-db:3306
- --
- /start-apps-cmd.sh
+ # see comments in .env file
+ - $EXTRA_HOST_IP
+ - $EXTRA_HOST_NAME
logging:
driver: json-file
diff --git a/deliveries/start-apps-cmd.sh b/deliveries/start-apps-cmd.sh
index bbe2a7cb..7d3a8ada 100755
--- a/deliveries/start-apps-cmd.sh
+++ b/deliveries/start-apps-cmd.sh
@@ -1,5 +1,48 @@
#!/bin/sh
+# Starts the Apache-Tomcat web container with the Portal, EPSDK and DMaaP BC web apps.
+# 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.
-LOGFILE=/opt/apache-tomcat-8.0.37/logs/catalina.out
+hostip=""
+hostname=""
+while [ $# -gt 0 ]; do
+ key="$1"
+ case $key in
+ -i|--ip)
+ hostip="$2"
+ shift # past argument
+ shift # past value
+ ;;
+ -n|--name)
+ hostname="$2"
+ shift # past argument
+ shift # past value
+ ;;
+ *)
+ echo "$0: ignoring argument $key"
+ shift
+ ;;
+ esac
+done
+
+# Optionally add to /etc/hosts
+if [ -z "${hostip}" -o -z "${hostname}" ]; then
+ echo "$0: Arguments for IP and name not found, continuing."
+else
+ echo "$0: Using IP-name arguments $hostip $hostname"
+ grep $hostname /etc/hosts
+ ret_code=$?
+ if [ $ret_code != 0 ]; then
+ echo "$hostip $hostname" >> /etc/hosts
+ fi
+fi
+
+BASE=/opt/apache-tomcat-8.0.37
+if [ ! -d $BASE ] ; then
+ echo "$0: $BASE not found or not a directory"
+ exit 1
+fi
+echo "$0: Starting server from $BASE"
+LOGFILE=${BASE}/logs/catalina.out
echo "`date`:<-------------------- Starting -------------------->" >> $LOGFILE
-exec /opt/apache-tomcat-8.0.37/bin/catalina.sh run 2>&1 | tee -a $LOGFILE
+exec ${BASE}/bin/catalina.sh run 2>&1 | tee -a $LOGFILE
diff --git a/deliveries/wait-for.sh b/deliveries/wait-for.sh
index be9a443f..25258218 100755
--- a/deliveries/wait-for.sh
+++ b/deliveries/wait-for.sh
@@ -23,19 +23,22 @@ USAGE
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 "Operation succeeded on try $i"; fi
+ 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 "Operation timed out" >&2
+ echo "$0: Operation timed out" >&2
exit 1
}