blob: c6914a09f2758f8722c4a077a1e9f48e515b738e [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 "
Instrumental4ad47632018-07-13 15:49:26 -050054 ;;
55 "hello")
56 PORTMAP="8130:8130"
57 ;;
58 "fs")
59 PORTMAP="80:8096"
60 ;;
61 esac
62
63 echo Starting aaf_$AAF_COMPONENT...
64
Instrumental1e3be602018-10-03 19:40:44 -050065 if [ -n "$AAF_REGISTER_AS" ] && [ "$HOSTNAME" != "$AAF_REGISTER_AS" ]; then
66 AH_ROOT="$HOSTNAME $AAF_REGISTER_AS"
67 else
68 AH_ROOT="$HOSTNAME"
69 fi
70
71 for A in aaf.osaaf.org $AH_ROOT; do
72 ADD_HOST="$ADD_HOST --add-host=$A:$HOST_IP"
Instrumental1e3be602018-10-03 19:40:44 -050073 done
74
Instrumental94053612018-10-08 11:27:18 -050075 $DOCKER run \
Instrumental4ad47632018-07-13 15:49:26 -050076 -d \
77 --name aaf_$AAF_COMPONENT \
78 --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \
Instrumental1e3be602018-10-03 19:40:44 -050079 $ADD_HOST \
Instrumental4ad47632018-07-13 15:49:26 -050080 ${LINKS} \
Instrumental1e3be602018-10-03 19:40:44 -050081 --env AAF_ENV=${AAF_ENV} \
82 --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \
83 --env LATITUDE=${LATITUDE} \
84 --env LONGITUDE=${LONGITUDE} \
Instrumental4ad47632018-07-13 15:49:26 -050085 --publish $PORTMAP \
Instrumental94053612018-10-08 11:27:18 -050086 -v "aaf_config:$CONF_ROOT_DIR" \
Instrumentale44d2f72018-08-16 17:22:45 -050087 ${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION}
Instrumental71037c32018-03-26 13:51:48 -070088done