Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 1 | #!/bin/bash |
Instrumental | 7a1817b | 2018-11-05 11:11:15 -0600 | [diff] [blame] | 2 | ######### |
| 3 | # ============LICENSE_START==================================================== |
| 4 | # org.onap.aaf |
| 5 | # =========================================================================== |
| 6 | # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. |
| 7 | # =========================================================================== |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | # you may not use this file except in compliance with the License. |
| 10 | # You may obtain a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | # See the License for the specific language governing permissions and |
| 18 | # limitations under the License. |
| 19 | # ============LICENSE_END==================================================== |
| 20 | # |
Instrumental | 12f7f46 | 2018-04-23 15:43:47 -0500 | [diff] [blame] | 21 | # Pull in Variables from d.props |
Instrumental | f482ea0 | 2018-04-10 15:03:24 -0500 | [diff] [blame] | 22 | . ./d.props |
Sai Gandham | ce6a67f | 2018-04-10 14:25:35 +0000 | [diff] [blame] | 23 | |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 24 | CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER:=$CASSANDRA_DOCKER} |
| 25 | |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 26 | DOCKER=${DOCKER:=docker} |
Instrumental | a05704f | 2018-09-17 13:58:02 -0500 | [diff] [blame] | 27 | |
Instrumental | adb7266 | 2018-11-02 12:48:26 -0500 | [diff] [blame] | 28 | # Running without params keeps from being TTY |
Instrumental | ca788dc | 2018-11-03 14:38:21 -0500 | [diff] [blame] | 29 | bash ./aaf.sh |
Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 30 | |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 31 | if [ "$1" == "" ]; then |
Instrumental | e44d2f7 | 2018-08-16 17:22:45 -0500 | [diff] [blame] | 32 | AAF_COMPONENTS=$(cat components) |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 33 | else |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 34 | AAF_COMPONENTS="$@" |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 35 | fi |
Instrumental | 679f142 | 2018-04-06 14:59:36 -0500 | [diff] [blame] | 36 | |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 37 | for AAF_COMPONENT in ${AAF_COMPONENTS}; do |
Instrumental | ca788dc | 2018-11-03 14:38:21 -0500 | [diff] [blame] | 38 | LINKS="" |
| 39 | CMD_LINE="" |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 40 | PUBLISH="" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 41 | case "$AAF_COMPONENT" in |
| 42 | "service") |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 43 | PUBLISH="--publish 8100:8100" |
| 44 | if [ -z "$CASSANDRA_DOCKER" ]; then |
Instrumental | 04c0f75 | 2019-01-23 04:49:48 -0600 | [diff] [blame] | 45 | CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-service && exec bin/service" |
Instrumental | ca788dc | 2018-11-03 14:38:21 -0500 | [diff] [blame] | 46 | else |
Instrumental | 04c0f75 | 2019-01-23 04:49:48 -0600 | [diff] [blame] | 47 | CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-service aaf-cass && exec bin/service" |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 48 | LINKS="--link $CASSANDRA_DOCKER" |
| 49 | echo $CASSANDRA_CLUSTER |
Instrumental | ca788dc | 2018-11-03 14:38:21 -0500 | [diff] [blame] | 50 | fi |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 51 | ;; |
| 52 | "locate") |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 53 | PUBLISH="--publish 8095:8095" |
| 54 | LINKS="--link aaf-cass --link aaf-service" |
Instrumental | 04c0f75 | 2019-01-23 04:49:48 -0600 | [diff] [blame] | 55 | CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-locate aaf-service && exec bin/locate" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 56 | ;; |
| 57 | "oauth") |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 58 | PUBLISH="--publish 8140:8140" |
| 59 | LINKS="--link aaf-cass --link aaf-service --link aaf-locate" |
Instrumental | 04c0f75 | 2019-01-23 04:49:48 -0600 | [diff] [blame] | 60 | CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-oauth aaf-service && exec bin/oauth" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 61 | ;; |
| 62 | "cm") |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 63 | PUBLISH="--publish 8150:8150" |
| 64 | LINKS="--link aaf-cass --link aaf-service --link aaf-locate" |
Instrumental | 04c0f75 | 2019-01-23 04:49:48 -0600 | [diff] [blame] | 65 | CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-cm aaf-locate && exec bin/cm" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 66 | ;; |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 67 | "gui") |
| 68 | PUBLISH="--publish 8200:8200" |
| 69 | LINKS="--link aaf-service --link aaf-locate --link aaf-oauth --link aaf-cm" |
Instrumental | 04c0f75 | 2019-01-23 04:49:48 -0600 | [diff] [blame] | 70 | CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-gui aaf-locate && exec bin/gui" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 71 | ;; |
| 72 | "fs") |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 73 | PUBLISH="--publish 80:8096" |
Instrumental | 3505a52 | 2019-01-31 14:49:24 -0600 | [diff] [blame] | 74 | LINKS="--link aaf-locate" |
Instrumental | 04c0f75 | 2019-01-23 04:49:48 -0600 | [diff] [blame] | 75 | CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-fs aaf-locate && exec bin/fs" |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 76 | ;; |
| 77 | "hello") |
| 78 | PUBLISH="--publish 8130:8130" |
| 79 | LINKS="--link aaf-service --link aaf-locate --link aaf-oauth --link aaf-cm" |
Instrumental | 04c0f75 | 2019-01-23 04:49:48 -0600 | [diff] [blame] | 80 | CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-hello aaf-locate && exec bin/hello" |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 81 | ;; |
| 82 | esac |
| 83 | |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 84 | echo Starting aaf-$AAF_COMPONENT... |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 85 | |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 86 | #for A in aaf.osaaf.org $AH_ROOT; do |
| 87 | #ADD_HOST="$ADD_HOST --add-host=$A:$HOST_IP" |
| 88 | #done |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 89 | |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 90 | #if [ ! -z "$LINKS" ] && [[ "$CASS_HOST" =~ ":" ]]; then |
| 91 | #ADD_HOST="$ADD_HOST --add-host=$CASS_HOST" |
| 92 | #fi |
| 93 | #--hostname="${AAF_COMPONENT}.${NAMESPACE}" \ |
Instrumental | 27afb02 | 2019-02-07 16:36:56 -0600 | [diff] [blame] | 94 | # --env aaf_locate_url=https://aaf-locate:8095 \ |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 95 | # $ADD_HOST \ |
Instrumental | 2b46f76 | 2019-02-20 11:14:41 -0600 | [diff] [blame] | 96 | if [ -n "${DUSER}" ]; then |
| 97 | THE_USER="--user $DUSER" |
| 98 | fi |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 99 | $DOCKER run \ |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 100 | -d \ |
Instrumental | 2b46f76 | 2019-02-20 11:14:41 -0600 | [diff] [blame] | 101 | ${THE_USER} \ |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 102 | --name aaf-$AAF_COMPONENT \ |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 103 | ${LINKS} \ |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 104 | --env AAF_ENV=${AAF_ENV} \ |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 105 | --env aaf_locator_container=docker \ |
Instrumental | 27afb02 | 2019-02-07 16:36:56 -0600 | [diff] [blame] | 106 | --env aaf_locator_container_ns=${NAMESPACE} \ |
| 107 | --env aaf_locator_fqdn=${HOSTNAME} \ |
Instrumental | be7e0d1 | 2019-04-04 21:42:19 -0500 | [diff] [blame] | 108 | --env aaf_locator_public_fqdn=${HOSTNAME} \ |
Instrumental | 1e3be60 | 2018-10-03 19:40:44 -0500 | [diff] [blame] | 109 | --env LATITUDE=${LATITUDE} \ |
| 110 | --env LONGITUDE=${LONGITUDE} \ |
Instrumental | eccc902 | 2018-10-24 13:18:57 -0500 | [diff] [blame] | 111 | --env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \ |
| 112 | --env CASSANDRA_USER=${CASSANDRA_USER} \ |
| 113 | --env CASSANDRA_PASSWORD=${CASSANDRA_PASSWORD} \ |
| 114 | --env CASSANDRA_PORT=${CASSANDRA_PORT} \ |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 115 | $PUBLISH \ |
Instrumental | 9405361 | 2018-10-08 11:27:18 -0500 | [diff] [blame] | 116 | -v "aaf_config:$CONF_ROOT_DIR" \ |
Instrumental | ca788dc | 2018-11-03 14:38:21 -0500 | [diff] [blame] | 117 | -v "aaf_status:/opt/app/aaf/status" \ |
| 118 | ${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} \ |
Instrumental | 12414fe | 2019-01-22 10:27:32 -0600 | [diff] [blame] | 119 | /bin/bash -c "$CMD_LINE" |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 120 | done |