Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 1 | #!/bin/bash |
Instrumental | 12f7f46 | 2018-04-23 15:43:47 -0500 | [diff] [blame] | 2 | # Pull in Variables from d.props |
Instrumental | f482ea0 | 2018-04-10 15:03:24 -0500 | [diff] [blame] | 3 | . ./d.props |
Sai Gandham | ce6a67f | 2018-04-10 14:25:35 +0000 | [diff] [blame] | 4 | |
Instrumental | 567a963 | 2018-08-14 13:55:32 -0500 | [diff] [blame] | 5 | # Only need Cassandra Link Info when initializing the container. |
| 6 | if [ ! -e ./cass.props ]; then |
| 7 | cp cass.props.init cass.props |
Instrumental | a05704f | 2018-09-17 13:58:02 -0500 | [diff] [blame] | 8 | fi |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 9 | . ./cass.props |
| 10 | |
| 11 | DOCKER=${DOCKER:=docker} |
Instrumental | a05704f | 2018-09-17 13:58:02 -0500 | [diff] [blame] | 12 | |
| 13 | CASS_IS_SET="$(grep '<Cass IP>' cass.props)" |
| 14 | if [ -n "$CASS_IS_SET" ]; then |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 15 | CASS_IP="$($DOCKER container inspect aaf_cass | grep \"IPAddress\": -m 1 | cut -d '"' -f 4)" |
Instrumental | a05704f | 2018-09-17 13:58:02 -0500 | [diff] [blame] | 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 |
Instrumental | 567a963 | 2018-08-14 13:55:32 -0500 | [diff] [blame] | 22 | fi |
| 23 | |
| 24 | . ./cass.props |
| 25 | |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 26 | bash aaf.sh onap |
| 27 | |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 28 | if [ "$1" == "" ]; then |
Instrumental | e44d2f7 | 2018-08-16 17:22:45 -0500 | [diff] [blame] | 29 | AAF_COMPONENTS=$(cat components) |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 30 | else |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 31 | AAF_COMPONENTS="$@" |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 32 | fi |
Instrumental | 679f142 | 2018-04-06 14:59:36 -0500 | [diff] [blame] | 33 | |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 34 | for 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 | |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 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" |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 73 | done |
| 74 | |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 75 | $DOCKER run \ |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 76 | -d \ |
| 77 | --name aaf_$AAF_COMPONENT \ |
| 78 | --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \ |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 79 | $ADD_HOST \ |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 80 | ${LINKS} \ |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 81 | --env AAF_ENV=${AAF_ENV} \ |
| 82 | --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \ |
| 83 | --env LATITUDE=${LATITUDE} \ |
| 84 | --env LONGITUDE=${LONGITUDE} \ |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 85 | --publish $PORTMAP \ |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 86 | -v "aaf_config:$CONF_ROOT_DIR" \ |
Instrumental | e44d2f7 | 2018-08-16 17:22:45 -0500 | [diff] [blame] | 87 | ${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 88 | done |