summaryrefslogtreecommitdiffstats
path: root/auth/docker/drun.sh
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-01-22 10:27:32 -0600
committerInstrumental <jonathan.gathman@att.com>2019-01-22 10:32:14 -0600
commit12414fe43077e12d7ef711951b1633ad31d73573 (patch)
tree475166cee68c104b2f36625ef864a912aab50fa4 /auth/docker/drun.sh
parenta5bcce655e339151445fbce2c129687e3bc8610a (diff)
Public and Private Locate entries
Issue-ID: AAF-723 Change-Id: I9dcd2e732ce64b39aaa57a6e9404f275f7ad540c Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/docker/drun.sh')
-rw-r--r--auth/docker/drun.sh112
1 files changed, 44 insertions, 68 deletions
diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh
index 9f770055..ed62e573 100644
--- a/auth/docker/drun.sh
+++ b/auth/docker/drun.sh
@@ -18,29 +18,11 @@
# limitations under the License.
# ============LICENSE_END====================================================
#
-# Validate for realtime Cassandra info
-
-# check if outside Cluster defined... otherwise, set CASS_HOST for using expected Docker based Cass
-if [ -z "$(grep -e '^CASS_CLUSTER=.*' d.props)" ]; then
- if [ "$(uname)" = "Darwin" ]; then
- SED="sed -i .bak"
- else
- SED="sed -i"
- fi
-
- CASSANDRA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' aaf_cass)
- if [ -z "$(grep -e '^CASS_HOST.*' d.props)" ]; then
- $SED "s/# CASS_HOST=.*/CASS_HOST=cass.aaf.osaaf.org:$CASSANDRA_IP/" d.props
- else
- $SED "s/CASS_HOST=.*/CASS_HOST=cass.aaf.osaaf.org:$CASSANDRA_IP/" d.props
- fi
- echo "Updated d.props for CASSANDRA Name/IP"
- grep -e '^CASS_HOST.*' d.props
-fi
-
# Pull in Variables from d.props
. ./d.props
+CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER:=$CASSANDRA_DOCKER}
+
DOCKER=${DOCKER:=docker}
# Running without params keeps from being TTY
@@ -55,83 +37,77 @@ fi
for AAF_COMPONENT in ${AAF_COMPONENTS}; do
LINKS=""
CMD_LINE=""
- PORTMAP=""
+ PUBLISH=""
case "$AAF_COMPONENT" in
"service")
- PORTMAP="8100:8100"
- LINKS="--link aaf_cass:cassandra "
- # CASS_HOST is for Container based Cassadra
- if [ -z "$CASS_HOST" ]; then
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_service sleep 0 cd /opt/app/aaf;bin/service"
+ PUBLISH="--publish 8100:8100"
+ if [ -z "$CASSANDRA_DOCKER" ]; then
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-service && exec bin/service"
else
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_service aaf_cass cd /opt/app/aaf;bin/service"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-service aaf-cass && exec bin/service"
+ LINKS="--link $CASSANDRA_DOCKER"
+ echo $CASSANDRA_CLUSTER
fi
;;
"locate")
- PORTMAP="8095:8095"
- LINKS="--link aaf_cass:cassandra "
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_locate aaf_service cd /opt/app/aaf;bin/locate"
+ PUBLISH="--publish 8095:8095"
+ LINKS="--link aaf-cass --link aaf-service"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-locate aaf-service && exec bin/locate"
;;
"oauth")
- PORTMAP="8140:8140"
- LINKS="--link aaf_cass:cassandra "
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_oauth aaf_service cd /opt/app/aaf;bin/oauth"
- ;;
- "gui")
- PORTMAP="8200:8200"
- LINKS=""
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_gui aaf_locate cd /opt/app/aaf;bin/gui"
+ PUBLISH="--publish 8140:8140"
+ LINKS="--link aaf-cass --link aaf-service --link aaf-locate"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-oauth aaf-service && exec bin/oauth"
;;
"cm")
- PORTMAP="8150:8150"
- LINKS="--link aaf_cass:cassandra "
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_cm aaf_locate cd /opt/app/aaf;bin/cm"
+ PUBLISH="--publish 8150:8150"
+ LINKS="--link aaf-cass --link aaf-service --link aaf-locate"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-cm aaf-locate && exec bin/cm"
;;
- "hello")
- PORTMAP="8130:8130"
- LINKS=""
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_hello aaf_locate cd /opt/app/aaf;bin/hello"
+ "gui")
+ PUBLISH="--publish 8200:8200"
+ LINKS="--link aaf-service --link aaf-locate --link aaf-oauth --link aaf-cm"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-gui aaf-locate && exec bin/gui"
;;
"fs")
- PORTMAP="80:8096"
+ PUBLISH="--publish 80:8096"
LINKS=""
- CMD_LINE="/bin/bash /opt/app/aaf/pod/pod_wait.sh aaf_fs aaf_locate cd /opt/app/aaf;bin/fs"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-fs aaf-locate && exec bin/fs"
+ ;;
+ "hello")
+ PUBLISH="--publish 8130:8130"
+ LINKS="--link aaf-service --link aaf-locate --link aaf-oauth --link aaf-cm"
+ CMD_LINE="cd /opt/app/aaf && /bin/bash pod/pod_wait.sh aaf-hello aaf-locate && exec bin/hello"
;;
esac
- echo Starting aaf_$AAF_COMPONENT...
-
- if [ -n "$AAF_REGISTER_AS" ] && [ "$HOSTNAME" != "$AAF_REGISTER_AS" ]; then
- AH_ROOT="$HOSTNAME $AAF_REGISTER_AS"
- else
- AH_ROOT="$HOSTNAME"
- fi
+ echo Starting aaf-$AAF_COMPONENT...
- for A in aaf.osaaf.org $AH_ROOT; do
- ADD_HOST="$ADD_HOST --add-host=$A:$HOST_IP"
- done
+ #for A in aaf.osaaf.org $AH_ROOT; do
+ #ADD_HOST="$ADD_HOST --add-host=$A:$HOST_IP"
+ #done
- if [ ! -z "$LINKS" ] && [[ "$CASS_HOST" =~ ":" ]]; then
- ADD_HOST="$ADD_HOST --add-host=$CASS_HOST"
- fi
- $DOCKER run \
+ #if [ ! -z "$LINKS" ] && [[ "$CASS_HOST" =~ ":" ]]; then
+ #ADD_HOST="$ADD_HOST --add-host=$CASS_HOST"
+ #fi
+ #--hostname="${AAF_COMPONENT}.${NAMESPACE}" \
+ # $ADD_HOST \
+ $DOCKER run \
-d \
- --name aaf_$AAF_COMPONENT \
- --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \
- $ADD_HOST \
+ --name aaf-$AAF_COMPONENT \
${LINKS} \
--env AAF_ENV=${AAF_ENV} \
- --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \
+ --env aaf_locator_container=docker \
+ --env aaf_locator_fqdn=$HOSTNAME \
--env LATITUDE=${LATITUDE} \
--env LONGITUDE=${LONGITUDE} \
- --env CASS_HOST=${CASS_HOST} \
--env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \
--env CASSANDRA_USER=${CASSANDRA_USER} \
--env CASSANDRA_PASSWORD=${CASSANDRA_PASSWORD} \
--env CASSANDRA_PORT=${CASSANDRA_PORT} \
- --publish $PORTMAP \
+ $PUBLISH \
-v "aaf_config:$CONF_ROOT_DIR" \
-v "aaf_status:/opt/app/aaf/status" \
${PREFIX}${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} \
- $CMD_LINE
+ /bin/bash -c "$CMD_LINE"
done