blob: be6795be69dc73f30c4bb4cbdbde0db472102293 [file] [log] [blame]
Sai Gandham67a6d892018-10-10 04:31:59 -05001#!/bin/bash
2# Pull in Variables from d.props
3. ./d.props
4
5# Only need Cassandra Link Info when initializing the container.
6if [ ! -e ./cass.props ]; then
7 cp cass.props.init cass.props
8fi
9. ./cass.props
10
11DOCKER=${DOCKER:=docker}
12
13CASS_IS_SET="$(grep '<Cass IP>' cass.props)"
14if [ -n "$CASS_IS_SET" ]; then
15 CASS_IP="$($DOCKER container inspect aaf_cass | grep \"IPAddress\": -m 1 | cut -d '"' -f 4)"
16 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
22fi
23
24. ./cass.props
25
26bash aaf.sh onap
27
28if [ "$1" == "" ]; then
29 AAF_COMPONENTS=$(cat components)
30else
31 AAF_COMPONENTS="$@"
32fi
33
34for AAF_COMPONENT in ${AAF_COMPONENTS}; do
35 case "$AAF_COMPONENT" in
36 "service")
37 PORTMAP="8100:8100"
38 LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST"
39 ;;
40 "locate")
41 PORTMAP="8095:8095"
42 LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST"
43 ;;
44 "oauth")
45 PORTMAP="8140:8140"
46 LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST"
47 ;;
48 "gui")
49 PORTMAP="8200:8200"
50 ;;
51 "cm")
52 PORTMAP="8150:8150"
53 LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST"
54 ;;
55 "hello")
56 PORTMAP="8130:8130"
57 ;;
58 "fs")
59 PORTMAP="80:8096"
60 ;;
61 esac
62
63 echo Starting aaf_$AAF_COMPONENT...
64
65 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"
73 done
74
75 $DOCKER run \
76 -d \
77 --name aaf_$AAF_COMPONENT \
78 --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \
79 $ADD_HOST \
80 ${LINKS} \
81 --env AAF_ENV=${AAF_ENV} \
82 --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \
83 --env LATITUDE=${LATITUDE} \
84 --env LONGITUDE=${LONGITUDE} \
85 --publish $PORTMAP \
86 -v "aaf_config:$CONF_ROOT_DIR" \
87 ${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION}
88done