summaryrefslogtreecommitdiffstats
path: root/auth/docker/agent.sh
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-07-19 13:29:32 -0500
committerInstrumental <jonathan.gathman@att.com>2018-07-19 13:29:44 -0500
commit32cdd553a8668e6d03a9cf5b11b360d35a63c87f (patch)
tree48c02e4be820d87efb777d7be20bad57d517b61c /auth/docker/agent.sh
parent9c8a8b0926b13b07fb1e5394903401e7a3f1ff79 (diff)
Configuration and Auto-Certificates
Issue-ID: AAF-378 Change-Id: Ic820a4e43684a6130f00b28b415a974876099fc3 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/docker/agent.sh')
-rw-r--r--auth/docker/agent.sh69
1 files changed, 62 insertions, 7 deletions
diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh
index 8636cdd1..aa3db663 100644
--- a/auth/docker/agent.sh
+++ b/auth/docker/agent.sh
@@ -1,16 +1,71 @@
#!/bin/bash
-. ./d.props
+
+CADI_VERSION=2.1.2-SNAPSHOT
+
+# Fill out "aaf.props" if not filled out already
+if [ ! -e aaf.props ]; then
+ > ./aaf.props
+fi
+for V in VERSION AAF_FQDN DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do
+ if [ "$(grep $V ./aaf.props)" = "" ]; then
+ unset DEF
+ case $V in
+ AAF_FQDN) PROMPT="AAF's FQDN";;
+ DEPLOY_FQI) PROMPT="Deployer's FQI";;
+ APP_FQI) PROMPT="App's FQI";;
+ APP_FQDN) PROMPT="App's Root FQDN";;
+ VOLUME) PROMPT="APP's AAF Configuration Volume";;
+ DRIVER) PROMPT=$V;DEF=local;;
+ VERSION) PROMPT="CADI Version";DEF=$CADI_VERSION;;
+ LATITUDE|LONGITUDE) PROMPT="$V of Node";;
+ *) PROMPT=$V;;
+ esac
+ if [ "$DEF" = "" ]; then
+ PROMPT="$PROMPT: "
+ else
+ PROMPT="$PROMPT ($DEF): "
+ fi
+ read -p "$PROMPT" VAR
+ if [ "$VAR" = "" ]; then
+ if [ "$DEF" = "" ]; then
+ echo "agent.sh needs each value queried. Please start again."
+ exit
+ else
+ VAR=$DEF
+ fi
+ fi
+ echo "$V=$VAR" >> ./aaf.props
+ fi
+done
+. ./aaf.props
+
+# Need AAF_FQDN's IP, because not might not be available in mini-container
+if [ "$AAF_AAF_FQDN_IP" = "" ]; then
+ AAF_AAF_FQDN_IP=$(host $AAF_FQDN | grep "has address" | tail -1 | cut -f 4 -d ' ')
+ if [ "$AAF_AAF_FQDN_IP" = "" ]; then
+ read -p "IP of $AAF_FQDN: " AAF_AAF_FQDN_IP
+ echo "AAF_AAF_FQDN_IP=$AAF_AAF_FQDN_IP" >> ./aaf.props
+ fi
+fi
+
+# Make sure Container Volume exists
+if [ "$(docker volume ls | grep ${VOLUME})" = "" ]; then
+ echo -n "Creating Volume: "
+ docker volume create -d ${DRIVER} ${VOLUME}
+fi
docker run \
-it \
--rm \
- --mount 'type=volume,src=aaf_config,dst='$CONF_ROOT_DIR',volume-driver=local' \
- --add-host="$HOSTNAME:$HOST_IP" \
- --add-host="aaf.osaaf.org:$HOST_IP" \
- --env AAF_ENV=${AAF_ENV} \
- --env AAF_REGISTER_AS=${AAF_REGISTER_AS} \
+ --mount 'type=volume,src='${VOLUME}',dst=/opt/app/osaaf,volume-driver='${DRIVER} \
+ --add-host="$AAF_FQDN:$AAF_AAF_FQDN_IP" \
+ --env AAF_FQDN=${AAF_FQDN} \
+ --env DEPLOY_FQI=${DEPLOY_FQI} \
+ --env DEPLOY_PASSWORD=${DEPLOY_PASSWORD} \
+ --env APP_FQI=${APP_FQI} \
+ --env APP_FQDN=${APP_FQDN} \
--env LATITUDE=${LATITUDE} \
--env LONGITUDE=${LONGITUDE} \
--name aaf_agent_$USER \
- ${ORG}/${PROJECT}/aaf_config:${VERSION} \
+ onap/aaf/aaf_agent:$VERSION \
/bin/bash "$@"