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" |
Instrumental | 377ea9a | 2018-10-19 12:43:22 -0500 | [diff] [blame^] | 38 | LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 39 | ;; |
| 40 | "locate") |
| 41 | PORTMAP="8095:8095" |
Instrumental | 377ea9a | 2018-10-19 12:43:22 -0500 | [diff] [blame^] | 42 | LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 43 | ;; |
| 44 | "oauth") |
| 45 | PORTMAP="8140:8140" |
Instrumental | 377ea9a | 2018-10-19 12:43:22 -0500 | [diff] [blame^] | 46 | LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 47 | ;; |
| 48 | "gui") |
| 49 | PORTMAP="8200:8200" |
| 50 | ;; |
| 51 | "cm") |
| 52 | PORTMAP="8150:8150" |
Instrumental | 93871ff | 2018-10-15 07:37:28 -0500 | [diff] [blame] | 53 | LINKS="--link aaf_cass:cassandra " |
Instrumental | 377ea9a | 2018-10-19 12:43:22 -0500 | [diff] [blame^] | 54 | LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 55 | ;; |
| 56 | "hello") |
| 57 | PORTMAP="8130:8130" |
| 58 | ;; |
| 59 | "fs") |
| 60 | PORTMAP="80:8096" |
| 61 | ;; |
| 62 | esac |
| 63 | |
| 64 | echo Starting aaf_$AAF_COMPONENT... |
| 65 | |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 66 | 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" |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 74 | done |
| 75 | |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 76 | $DOCKER run \ |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 77 | -d \ |
| 78 | --name aaf_$AAF_COMPONENT \ |
| 79 | --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \ |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 80 | $ADD_HOST \ |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 81 | ${LINKS} \ |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 82 | --env AAF_ENV=${AAF_ENV} \ |
| 83 | --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \ |
| 84 | --env LATITUDE=${LATITUDE} \ |
| 85 | --env LONGITUDE=${LONGITUDE} \ |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 86 | --publish $PORTMAP \ |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 87 | -v "aaf_config:$CONF_ROOT_DIR" \ |
Instrumental | e44d2f7 | 2018-08-16 17:22:45 -0500 | [diff] [blame] | 88 | ${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 89 | done |