diff options
author | 2017-10-10 15:54:38 -0400 | |
---|---|---|
committer | 2017-10-10 15:55:51 -0400 | |
commit | 6a4a349a1be3ad5460e507dc4e2098936fd23859 (patch) | |
tree | ea66e04551023fe6b5cc49fa7c9f3d504a815a86 /deliveries/start-apps-cmd.sh | |
parent | 18f397918fb3139902e131772af6f400a7692e6f (diff) |
Extend deployment for CSIT env quirks
Define new environment variables so a host IP and name can be
added to a docker container /etc/hosts file for inter-app comms
using the semi-well-known name portal.api.simpledemo.openecomp.org
Issue: PORTAL-59
Change-Id: If1c23a77a4b227aac314d966f41e5d5aaad846f8
Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'deliveries/start-apps-cmd.sh')
-rwxr-xr-x | deliveries/start-apps-cmd.sh | 47 |
1 files changed, 45 insertions, 2 deletions
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 |