blob: 648c497ae671b5338c2ed2334ec3239d2bdfa169 [file] [log] [blame]
Instrumental4ad47632018-07-13 15:49:26 -05001#!/bin/bash
Instrumental7a1817b2018-11-05 11:11:15 -06002#########
3# ============LICENSE_START====================================================
4# org.onap.aaf
5# ===========================================================================
6# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
7# ===========================================================================
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19# ============LICENSE_END====================================================
20#
Instrumental12f7f462018-04-23 15:43:47 -050021# Pull in Variables from d.props
Instrumentalf482ea02018-04-10 15:03:24 -050022. ./d.props
Sai Gandhamce6a67f2018-04-10 14:25:35 +000023
Instrumental12414fe2019-01-22 10:27:32 -060024CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER:=$CASSANDRA_DOCKER}
25
Instrumental94053612018-10-08 11:27:18 -050026DOCKER=${DOCKER:=docker}
Instrumentala05704f2018-09-17 13:58:02 -050027
Instrumentaladb72662018-11-02 12:48:26 -050028# Running without params keeps from being TTY
Instrumentalca788dc2018-11-03 14:38:21 -050029bash ./aaf.sh
Instrumentalbc299c02018-09-25 06:42:31 -050030
Instrumental71037c32018-03-26 13:51:48 -070031if [ "$1" == "" ]; then
Instrumentale44d2f72018-08-16 17:22:45 -050032 AAF_COMPONENTS=$(cat components)
Instrumental71037c32018-03-26 13:51:48 -070033else
Instrumental4ad47632018-07-13 15:49:26 -050034 AAF_COMPONENTS="$@"
Instrumental71037c32018-03-26 13:51:48 -070035fi
Instrumental679f1422018-04-06 14:59:36 -050036
Instrumental4ad47632018-07-13 15:49:26 -050037for AAF_COMPONENT in ${AAF_COMPONENTS}; do
Instrumentalca788dc2018-11-03 14:38:21 -050038 LINKS=""
39 CMD_LINE=""
Instrumental12414fe2019-01-22 10:27:32 -060040 PUBLISH=""
Instrumental4ad47632018-07-13 15:49:26 -050041 case "$AAF_COMPONENT" in
42 "service")
Instrumental12414fe2019-01-22 10:27:32 -060043 PUBLISH="--publish 8100:8100"
44 if [ -z "$CASSANDRA_DOCKER" ]; then
Instrumental04c0f752019-01-23 04:49:48 -060045 CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-service && exec bin/service"
Instrumentalca788dc2018-11-03 14:38:21 -050046 else
Instrumental04c0f752019-01-23 04:49:48 -060047 CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-service aaf-cass && exec bin/service"
Instrumental12414fe2019-01-22 10:27:32 -060048 LINKS="--link $CASSANDRA_DOCKER"
49 echo $CASSANDRA_CLUSTER
Instrumentalca788dc2018-11-03 14:38:21 -050050 fi
Instrumental4ad47632018-07-13 15:49:26 -050051 ;;
52 "locate")
Instrumental12414fe2019-01-22 10:27:32 -060053 PUBLISH="--publish 8095:8095"
54 LINKS="--link aaf-cass --link aaf-service"
Instrumental04c0f752019-01-23 04:49:48 -060055 CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-locate aaf-service && exec bin/locate"
Instrumental4ad47632018-07-13 15:49:26 -050056 ;;
57 "oauth")
Instrumental12414fe2019-01-22 10:27:32 -060058 PUBLISH="--publish 8140:8140"
59 LINKS="--link aaf-cass --link aaf-service --link aaf-locate"
Instrumental04c0f752019-01-23 04:49:48 -060060 CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-oauth aaf-service && exec bin/oauth"
Instrumental4ad47632018-07-13 15:49:26 -050061 ;;
62 "cm")
Instrumental12414fe2019-01-22 10:27:32 -060063 PUBLISH="--publish 8150:8150"
64 LINKS="--link aaf-cass --link aaf-service --link aaf-locate"
Instrumental04c0f752019-01-23 04:49:48 -060065 CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-cm aaf-locate && exec bin/cm"
Instrumental4ad47632018-07-13 15:49:26 -050066 ;;
Instrumental12414fe2019-01-22 10:27:32 -060067 "gui")
68 PUBLISH="--publish 8200:8200"
69 LINKS="--link aaf-service --link aaf-locate --link aaf-oauth --link aaf-cm"
Instrumental04c0f752019-01-23 04:49:48 -060070 CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-gui aaf-locate && exec bin/gui"
Instrumental4ad47632018-07-13 15:49:26 -050071 ;;
72 "fs")
Instrumental12414fe2019-01-22 10:27:32 -060073 PUBLISH="--publish 80:8096"
Instrumental3505a522019-01-31 14:49:24 -060074 LINKS="--link aaf-locate"
Instrumental04c0f752019-01-23 04:49:48 -060075 CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-fs aaf-locate && exec bin/fs"
Instrumental12414fe2019-01-22 10:27:32 -060076 ;;
77 "hello")
78 PUBLISH="--publish 8130:8130"
79 LINKS="--link aaf-service --link aaf-locate --link aaf-oauth --link aaf-cm"
Instrumental04c0f752019-01-23 04:49:48 -060080 CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-hello aaf-locate && exec bin/hello"
Instrumental4ad47632018-07-13 15:49:26 -050081 ;;
82 esac
83
Instrumental12414fe2019-01-22 10:27:32 -060084 echo Starting aaf-$AAF_COMPONENT...
Instrumental4ad47632018-07-13 15:49:26 -050085
Instrumental12414fe2019-01-22 10:27:32 -060086 #for A in aaf.osaaf.org $AH_ROOT; do
87 #ADD_HOST="$ADD_HOST --add-host=$A:$HOST_IP"
88 #done
Instrumental1e3be602018-10-03 19:40:44 -050089
Instrumental12414fe2019-01-22 10:27:32 -060090 #if [ ! -z "$LINKS" ] && [[ "$CASS_HOST" =~ ":" ]]; then
91 #ADD_HOST="$ADD_HOST --add-host=$CASS_HOST"
92 #fi
93 #--hostname="${AAF_COMPONENT}.${NAMESPACE}" \
Instrumental27afb022019-02-07 16:36:56 -060094 # --env aaf_locate_url=https://aaf-locate:8095 \
Instrumental12414fe2019-01-22 10:27:32 -060095 # $ADD_HOST \
Instrumental2b46f762019-02-20 11:14:41 -060096 if [ -n "${DUSER}" ]; then
97 THE_USER="--user $DUSER"
98 fi
Instrumental12414fe2019-01-22 10:27:32 -060099 $DOCKER run \
Instrumental4ad47632018-07-13 15:49:26 -0500100 -d \
Instrumental2b46f762019-02-20 11:14:41 -0600101 ${THE_USER} \
Instrumental12414fe2019-01-22 10:27:32 -0600102 --name aaf-$AAF_COMPONENT \
Instrumental4ad47632018-07-13 15:49:26 -0500103 ${LINKS} \
Instrumental1e3be602018-10-03 19:40:44 -0500104 --env AAF_ENV=${AAF_ENV} \
Instrumental12414fe2019-01-22 10:27:32 -0600105 --env aaf_locator_container=docker \
Instrumental27afb022019-02-07 16:36:56 -0600106 --env aaf_locator_container_ns=${NAMESPACE} \
107 --env aaf_locator_fqdn=${HOSTNAME} \
Instrumentalbe7e0d12019-04-04 21:42:19 -0500108 --env aaf_locator_public_fqdn=${HOSTNAME} \
Instrumental1e3be602018-10-03 19:40:44 -0500109 --env LATITUDE=${LATITUDE} \
110 --env LONGITUDE=${LONGITUDE} \
Instrumentaleccc9022018-10-24 13:18:57 -0500111 --env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \
112 --env CASSANDRA_USER=${CASSANDRA_USER} \
113 --env CASSANDRA_PASSWORD=${CASSANDRA_PASSWORD} \
114 --env CASSANDRA_PORT=${CASSANDRA_PORT} \
Instrumental12414fe2019-01-22 10:27:32 -0600115 $PUBLISH \
Instrumental94053612018-10-08 11:27:18 -0500116 -v "aaf_config:$CONF_ROOT_DIR" \
Instrumentalca788dc2018-11-03 14:38:21 -0500117 -v "aaf_status:/opt/app/aaf/status" \
118 ${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} \
Instrumental12414fe2019-01-22 10:27:32 -0600119 /bin/bash -c "$CMD_LINE"
Instrumental71037c32018-03-26 13:51:48 -0700120done