blob: 57a61676403104175362352e5ea6fbadc509991d [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"
Instrumentalb3a68142019-07-24 14:42:22 -050064 LINKS="--link aaf-cass --link aaf-service --link aaf-locate --link aaf-oauth"
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...
Instrumental2b46f762019-02-20 11:14:41 -060085 if [ -n "${DUSER}" ]; then
86 THE_USER="--user $DUSER"
87 fi
Instrumentalb3a68142019-07-24 14:42:22 -050088
89
Instrumental12414fe2019-01-22 10:27:32 -060090 $DOCKER run \
Instrumental4ad47632018-07-13 15:49:26 -050091 -d \
Instrumental2b46f762019-02-20 11:14:41 -060092 ${THE_USER} \
Instrumental12414fe2019-01-22 10:27:32 -060093 --name aaf-$AAF_COMPONENT \
Instrumental4ad47632018-07-13 15:49:26 -050094 ${LINKS} \
Instrumental1e3be602018-10-03 19:40:44 -050095 --env AAF_ENV=${AAF_ENV} \
Instrumental12414fe2019-01-22 10:27:32 -060096 --env aaf_locator_container=docker \
Instrumental27afb022019-02-07 16:36:56 -060097 --env aaf_locator_container_ns=${NAMESPACE} \
98 --env aaf_locator_fqdn=${HOSTNAME} \
Instrumentalbe7e0d12019-04-04 21:42:19 -050099 --env aaf_locator_public_fqdn=${HOSTNAME} \
Instrumental355b8862019-06-06 19:33:19 -0500100 --env aaf_deployed_version=${VERSION} \
Instrumental1e3be602018-10-03 19:40:44 -0500101 --env LATITUDE=${LATITUDE} \
102 --env LONGITUDE=${LONGITUDE} \
Instrumentaleccc9022018-10-24 13:18:57 -0500103 --env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \
104 --env CASSANDRA_USER=${CASSANDRA_USER} \
105 --env CASSANDRA_PASSWORD=${CASSANDRA_PASSWORD} \
106 --env CASSANDRA_PORT=${CASSANDRA_PORT} \
Instrumental12414fe2019-01-22 10:27:32 -0600107 $PUBLISH \
Instrumental94053612018-10-08 11:27:18 -0500108 -v "aaf_config:$CONF_ROOT_DIR" \
Instrumentalca788dc2018-11-03 14:38:21 -0500109 -v "aaf_status:/opt/app/aaf/status" \
Instrumental0e302ed2019-07-16 04:02:30 -0500110 ${PREFIX}${ORG}/${PROJECT}/aaf_core:${VERSION} \
Instrumental12414fe2019-01-22 10:27:32 -0600111 /bin/bash -c "$CMD_LINE"
Instrumental71037c32018-03-26 13:51:48 -0700112done