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 |
| 9 | |
| 10 | CASS_IS_SET="$(grep '<Cass IP>' cass.props)" |
| 11 | if [ -n "$CASS_IS_SET" ]; then |
| 12 | CASS_IP="$(docker container inspect aaf_cass | grep \"IPAddress\": -m 1 | cut -d '"' -f 4)" |
| 13 | if [ -n "$CASS_IP" ]; then |
| 14 | sed -i -e "s/\(^.*:\).*/\1$CASS_IP/" cass.props |
| 15 | else |
| 16 | echo "Set CASSASNDRA IP in cass.props" |
| 17 | exit |
| 18 | fi |
Instrumental | 567a963 | 2018-08-14 13:55:32 -0500 | [diff] [blame] | 19 | fi |
| 20 | |
| 21 | . ./cass.props |
| 22 | |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 23 | if [ "$1" == "" ]; then |
Instrumental | e44d2f7 | 2018-08-16 17:22:45 -0500 | [diff] [blame] | 24 | AAF_COMPONENTS=$(cat components) |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 25 | else |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 26 | AAF_COMPONENTS="$@" |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 27 | fi |
Instrumental | 679f142 | 2018-04-06 14:59:36 -0500 | [diff] [blame] | 28 | |
Instrumental | 4ad4763 | 2018-07-13 15:49:26 -0500 | [diff] [blame] | 29 | for AAF_COMPONENT in ${AAF_COMPONENTS}; do |
| 30 | case "$AAF_COMPONENT" in |
| 31 | "service") |
| 32 | PORTMAP="8100:8100" |
| 33 | LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" |
| 34 | ;; |
| 35 | "locate") |
| 36 | PORTMAP="8095:8095" |
| 37 | LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" |
| 38 | ;; |
| 39 | "oauth") |
| 40 | PORTMAP="8140:8140" |
| 41 | LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" |
| 42 | ;; |
| 43 | "gui") |
| 44 | PORTMAP="8200:8200" |
| 45 | ;; |
| 46 | "cm") |
| 47 | PORTMAP="8150:8150" |
| 48 | LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" |
| 49 | ;; |
| 50 | "hello") |
| 51 | PORTMAP="8130:8130" |
| 52 | ;; |
| 53 | "fs") |
| 54 | PORTMAP="80:8096" |
| 55 | ;; |
| 56 | esac |
| 57 | |
| 58 | echo Starting aaf_$AAF_COMPONENT... |
| 59 | |
| 60 | docker run \ |
| 61 | -d \ |
| 62 | --name aaf_$AAF_COMPONENT \ |
| 63 | --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \ |
| 64 | --add-host="$HOSTNAME:$HOST_IP" \ |
| 65 | --add-host="aaf.osaaf.org:$HOST_IP" \ |
| 66 | ${LINKS} \ |
| 67 | --publish $PORTMAP \ |
| 68 | --mount 'type=volume,src=aaf_config,dst='$CONF_ROOT_DIR',volume-driver=local' \ |
Instrumental | e44d2f7 | 2018-08-16 17:22:45 -0500 | [diff] [blame] | 69 | ${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} |
Instrumental | 71037c3 | 2018-03-26 13:51:48 -0700 | [diff] [blame] | 70 | done |