blob: 4a6b1c77c03ec6e01b3e67e17c8e59abff6100f4 [file] [log] [blame]
Instrumental4ad47632018-07-13 15:49:26 -05001#!/bin/bash
Instrumental12f7f462018-04-23 15:43:47 -05002# Pull in Variables from d.props
Instrumentalf482ea02018-04-10 15:03:24 -05003. ./d.props
Sai Gandhamce6a67f2018-04-10 14:25:35 +00004
Instrumental567a9632018-08-14 13:55:32 -05005# Only need Cassandra Link Info when initializing the container.
6if [ ! -e ./cass.props ]; then
7 cp cass.props.init cass.props
Instrumentala05704f2018-09-17 13:58:02 -05008fi
Instrumental94053612018-10-08 11:27:18 -05009. ./cass.props
10
11DOCKER=${DOCKER:=docker}
Instrumentala05704f2018-09-17 13:58:02 -050012
13CASS_IS_SET="$(grep '<Cass IP>' cass.props)"
14if [ -n "$CASS_IS_SET" ]; then
Instrumental94053612018-10-08 11:27:18 -050015 CASS_IP="$($DOCKER container inspect aaf_cass | grep \"IPAddress\": -m 1 | cut -d '"' -f 4)"
Instrumentala05704f2018-09-17 13:58:02 -050016 if [ -n "$CASS_IP" ]; then
17 sed -i -e "s/\(^.*:\).*/\1$CASS_IP/" cass.props
18 else
19 echo "Set CASSASNDRA IP in cass.props"
20 exit
21 fi
Instrumental567a9632018-08-14 13:55:32 -050022fi
23
24. ./cass.props
25
Instrumentalbc299c02018-09-25 06:42:31 -050026bash aaf.sh onap
27
Instrumental71037c32018-03-26 13:51:48 -070028if [ "$1" == "" ]; then
Instrumentale44d2f72018-08-16 17:22:45 -050029 AAF_COMPONENTS=$(cat components)
Instrumental71037c32018-03-26 13:51:48 -070030else
Instrumental4ad47632018-07-13 15:49:26 -050031 AAF_COMPONENTS="$@"
Instrumental71037c32018-03-26 13:51:48 -070032fi
Instrumental679f1422018-04-06 14:59:36 -050033
Instrumental4ad47632018-07-13 15:49:26 -050034for AAF_COMPONENT in ${AAF_COMPONENTS}; do
35 case "$AAF_COMPONENT" in
36 "service")
37 PORTMAP="8100:8100"
Instrumentalc03496d2018-10-19 13:59:24 -050038 LINKS="--link aaf_cass:cassandra "
Instrumental4ad47632018-07-13 15:49:26 -050039 ;;
40 "locate")
41 PORTMAP="8095:8095"
Instrumentalc03496d2018-10-19 13:59:24 -050042 LINKS="--link aaf_cass:cassandra "
Instrumental4ad47632018-07-13 15:49:26 -050043 ;;
44 "oauth")
45 PORTMAP="8140:8140"
Instrumentalc03496d2018-10-19 13:59:24 -050046 LINKS="--link aaf_cass:cassandra "
Instrumental4ad47632018-07-13 15:49:26 -050047 ;;
48 "gui")
49 PORTMAP="8200:8200"
50 ;;
51 "cm")
52 PORTMAP="8150:8150"
Instrumental93871ff2018-10-15 07:37:28 -050053 LINKS="--link aaf_cass:cassandra "
Instrumentalc03496d2018-10-19 13:59:24 -050054 LINKS="--link aaf_cass:cassandra "
Instrumental4ad47632018-07-13 15:49:26 -050055 ;;
56 "hello")
57 PORTMAP="8130:8130"
58 ;;
59 "fs")
60 PORTMAP="80:8096"
61 ;;
62 esac
63
64 echo Starting aaf_$AAF_COMPONENT...
65
Instrumental1e3be602018-10-03 19:40:44 -050066 if [ -n "$AAF_REGISTER_AS" ] && [ "$HOSTNAME" != "$AAF_REGISTER_AS" ]; then
67 AH_ROOT="$HOSTNAME $AAF_REGISTER_AS"
68 else
69 AH_ROOT="$HOSTNAME"
70 fi
71
72 for A in aaf.osaaf.org $AH_ROOT; do
73 ADD_HOST="$ADD_HOST --add-host=$A:$HOST_IP"
Instrumental1e3be602018-10-03 19:40:44 -050074 done
75
Instrumental94053612018-10-08 11:27:18 -050076 $DOCKER run \
Instrumental4ad47632018-07-13 15:49:26 -050077 -d \
78 --name aaf_$AAF_COMPONENT \
79 --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \
Instrumental1e3be602018-10-03 19:40:44 -050080 $ADD_HOST \
Instrumental4ad47632018-07-13 15:49:26 -050081 ${LINKS} \
Instrumental1e3be602018-10-03 19:40:44 -050082 --env AAF_ENV=${AAF_ENV} \
83 --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \
84 --env LATITUDE=${LATITUDE} \
85 --env LONGITUDE=${LONGITUDE} \
Instrumental4ad47632018-07-13 15:49:26 -050086 --publish $PORTMAP \
Instrumental94053612018-10-08 11:27:18 -050087 -v "aaf_config:$CONF_ROOT_DIR" \
Instrumentale44d2f72018-08-16 17:22:45 -050088 ${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION}
Instrumental71037c32018-03-26 13:51:48 -070089done