From 32cdd553a8668e6d03a9cf5b11b360d35a63c87f Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 19 Jul 2018 13:29:32 -0500 Subject: Configuration and Auto-Certificates Issue-ID: AAF-378 Change-Id: Ic820a4e43684a6130f00b28b415a974876099fc3 Signed-off-by: Instrumental --- auth/docker/Dockerfile.client | 15 ++++++++++ auth/docker/Dockerfile.config | 4 +-- auth/docker/aaf.props | 14 +++++++++ auth/docker/aaf.sh | 16 ++++++++++ auth/docker/agent.sh | 69 ++++++++++++++++++++++++++++++++++++++----- auth/docker/dbuild.sh | 13 ++++++-- auth/docker/dclean.sh | 1 + 7 files changed, 121 insertions(+), 11 deletions(-) create mode 100644 auth/docker/Dockerfile.client create mode 100644 auth/docker/aaf.props create mode 100644 auth/docker/aaf.sh (limited to 'auth/docker') diff --git a/auth/docker/Dockerfile.client b/auth/docker/Dockerfile.client new file mode 100644 index 00000000..64ed4c03 --- /dev/null +++ b/auth/docker/Dockerfile.client @@ -0,0 +1,15 @@ +FROM rmannfv/aaf-base:xenial +MAINTAINER AAF Team, AT&T 2018 +ENV VERSION=${AAF_VERSION} + +LABEL description="aaf_agent" +LABEL version=${AAF_VERSION} + +COPY logs /opt/app/aaf_config/logs +COPY bin/client.sh /opt/app/aaf_config/bin/agent.sh +COPY bin/aaf-cadi*full.jar /opt/app/aaf_config/bin/ +COPY public/*all.jks /opt/app/aaf_config/public/ + +ENTRYPOINT ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"] +CMD [] + diff --git a/auth/docker/Dockerfile.config b/auth/docker/Dockerfile.config index 1855fae2..f3bd6bc9 100644 --- a/auth/docker/Dockerfile.config +++ b/auth/docker/Dockerfile.config @@ -2,7 +2,7 @@ FROM rmannfv/aaf-base:xenial MAINTAINER AAF Team, AT&T 2018 ENV VERSION=${AAF_VERSION} -LABEL description="aaf_agent" +LABEL description="aaf_config" LABEL version=${AAF_VERSION} COPY data/sample.identities.dat /opt/app/aaf_config/data/ @@ -10,7 +10,7 @@ COPY etc /opt/app/aaf_config/etc COPY local /opt/app/aaf_config/local COPY public /opt/app/aaf_config/public COPY logs /opt/app/aaf_config/logs -COPY bin /opt/app/aaf_config/bin +COPY bin/service.sh /opt/app/aaf_config/bin/agent.sh ENTRYPOINT ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"] CMD [] diff --git a/auth/docker/aaf.props b/auth/docker/aaf.props new file mode 100644 index 00000000..8d18f55d --- /dev/null +++ b/auth/docker/aaf.props @@ -0,0 +1,14 @@ +FQI=clamp@clamp.onap.org +VOLUME=clamp_aaf +LONGITUDE=-92 +FQDN=meriadoc.mithril.sbc.com +VERSION=2.1.2-SNAPSHOT +DRIVER=local +LATITUDE=38 +FQDN_IP=192.168.99.100 +AAF_FQDN=meriadoc.mithril.sbc.com +AAF_AAF_FQDN_IP=192.168.99.100 +DEPLOY_FQI=deployer@people.osaaf.org +DEPLOY_PASSWORD=demo123456! +APP_FQDN=meriadoc.mithril.sbc.com +APP_FQI=clamp@clamp.onap.org diff --git a/auth/docker/aaf.sh b/auth/docker/aaf.sh new file mode 100644 index 00000000..441cf2b4 --- /dev/null +++ b/auth/docker/aaf.sh @@ -0,0 +1,16 @@ +#!/bin/bash +. ./d.props + +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} \ + --env LATITUDE=${LATITUDE} \ + --env LONGITUDE=${LONGITUDE} \ + --name aaf_config_$USER \ + ${ORG}/${PROJECT}/aaf_config:${VERSION} \ + /bin/bash "$@" 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 "$@" diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh index ba7a8095..10ca9d95 100755 --- a/auth/docker/dbuild.sh +++ b/auth/docker/dbuild.sh @@ -9,14 +9,23 @@ fi . ./d.props -# Create the Config (Security) Image -sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile.config >../sample/Dockerfile +# Create the AAF Config (Security) Images cd .. cp ../cadi/aaf/target/aaf-cadi-aaf-${VERSION}-full.jar sample/bin + +# AAF Config image (for AAF itself) +sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' docker/Dockerfile.config > sample/Dockerfile docker build -t ${ORG}/${PROJECT}/aaf_config:${VERSION} sample + +# AAF Agent Image (for Clients) +sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' docker/Dockerfile.client > sample/Dockerfile +docker build -t ${ORG}/${PROJECT}/aaf_agent:${VERSION} sample + +# Clean up rm sample/Dockerfile sample/bin/aaf-cadi-aaf-${VERSION}-full.jar cd - +######## # Second, build a core Docker Image echo Building aaf_$AAF_COMPONENT... # Apply currrent Properties to Docker file, and put in place. diff --git a/auth/docker/dclean.sh b/auth/docker/dclean.sh index 0bca9ef7..b502c022 100644 --- a/auth/docker/dclean.sh +++ b/auth/docker/dclean.sh @@ -8,6 +8,7 @@ else AAF_COMPONENTS=$1 fi +docker image rm $ORG/$PROJECT/aaf_agent:${VERSION} docker image rm $ORG/$PROJECT/aaf_config:${VERSION} docker image rm $ORG/$PROJECT/aaf_core:${VERSION} -- cgit 1.2.3-korg