From 9ec2895301056a9e8967eadb139e56f03776fe26 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 12 Jul 2018 11:14:10 -0500 Subject: Configuration Agent and MS for AAF Issue-ID: AAF-361 Change-Id: I26f3d49e3d7eae4a932489bd677cf0b903fb7977 Signed-off-by: Instrumental --- auth/docker/.gitignore | 1 + auth/docker/Dockerfile.config | 17 +++++++++++++++++ auth/docker/Dockerfile.core | 10 ++++++++++ auth/docker/Dockerfile.ms | 19 +++++++++++++++++++ auth/docker/agent.sh | 9 +++++++++ auth/docker/d.props | 15 --------------- auth/docker/d.props.init | 12 ++++++++++++ auth/docker/dbuild.sh | 30 +++++++++++++++++++++++++----- auth/docker/dclean.sh | 4 +++- auth/docker/drun.sh | 14 +++++++++++++- auth/docker/dstart.sh | 1 + 11 files changed, 110 insertions(+), 22 deletions(-) create mode 100644 auth/docker/.gitignore create mode 100644 auth/docker/Dockerfile.config create mode 100644 auth/docker/Dockerfile.core create mode 100644 auth/docker/Dockerfile.ms create mode 100644 auth/docker/agent.sh delete mode 100644 auth/docker/d.props create mode 100644 auth/docker/d.props.init (limited to 'auth/docker') diff --git a/auth/docker/.gitignore b/auth/docker/.gitignore new file mode 100644 index 00000000..f08acc75 --- /dev/null +++ b/auth/docker/.gitignore @@ -0,0 +1 @@ +d.props diff --git a/auth/docker/Dockerfile.config b/auth/docker/Dockerfile.config new file mode 100644 index 00000000..a5811e09 --- /dev/null +++ b/auth/docker/Dockerfile.config @@ -0,0 +1,17 @@ +FROM rmannfv/aaf-base:xenial +MAINTAINER AAF Team, AT&T 2018 +ENV VERSION=${AAF_VERSION} + +LABEL description="aaf_agent" +LABEL version=${AAF_VERSION} + +COPY data/sample.identities.dat /opt/app/aaf_config/data/ +COPY etc /opt/app/aaf_config/etc +COPY local/*.props /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 + +ENTRYPOINT ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"] +CMD [] + diff --git a/auth/docker/Dockerfile.core b/auth/docker/Dockerfile.core new file mode 100644 index 00000000..c4e8a461 --- /dev/null +++ b/auth/docker/Dockerfile.core @@ -0,0 +1,10 @@ +FROM rmannfv/aaf-base:xenial +MAINTAINER AAF Team, AT&T 2018 +ENV VERSION=${AAF_VERSION} + +LABEL description="aaf_core" +LABEL version=${AAF_VERSION} + +COPY lib /opt/app/aaf/lib +COPY bin /opt/app/aaf/bin + diff --git a/auth/docker/Dockerfile.ms b/auth/docker/Dockerfile.ms new file mode 100644 index 00000000..121bd06c --- /dev/null +++ b/auth/docker/Dockerfile.ms @@ -0,0 +1,19 @@ +FROM onap/aaf/aaf_core:${AAF_VERSION} +MAINTAINER AAF Team, AT&T 2018 +ENV VERSION=${AAF_VERSION} + +LABEL description="aaf_${AAF_COMPONENT}" +LABEL version=${AAF_VERSION} + +CMD ["/bin/bash","-c","/opt/app/aaf/bin/${AAF_COMPONENT}"] + +# For Debugging installation +# CMD ["/bin/bash","-c","pwd;cd /opt/app/osaaf;find /opt/app/osaaf -depth;df -k; cat /opt/app/aaf/${AAF_COMPONENT}/bin/${AAF_COMPONENT};cat /etc/hosts;/opt/app/aaf/${AAF_COMPONENT}/bin/${AAF_COMPONENT}"] +# Java Debugging VM Args +# "-Xdebug",\ +# "-Xnoagent",\ +# "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000",\ + +# TLS Debugging VM Args +# "-Djavax.net.debug","ssl", \ + diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh new file mode 100644 index 00000000..68027947 --- /dev/null +++ b/auth/docker/agent.sh @@ -0,0 +1,9 @@ +#!/bin/bash +. ./d.props +docker run \ + -it \ + --mount 'type=volume,src=aaf_config,dst=/opt/app/osaaf,volume-driver=local' \ + --name aaf_agent_$USER \ + ${ORG}/${PROJECT}/aaf_config:${VERSION} \ + /bin/bash $* +docker container rm aaf_agent_$USER > /dev/null diff --git a/auth/docker/d.props b/auth/docker/d.props deleted file mode 100644 index e56d4597..00000000 --- a/auth/docker/d.props +++ /dev/null @@ -1,15 +0,0 @@ -# Variables for building Docker entities -ORG=onap -PROJECT=aaf -DOCKER_REPOSITORY=nexus3.onap.org:10003 -OLD_VERSION=2.1.0-SNAPSHOT -NEW_VERSION=2.1.1 -VERSION=2.1.1-SNAPSHOT -CONF_ROOT_DIR=/opt/app/osaaf - -# Local Env info -HOSTNAME= -HOST_IP= -CASS_HOST= - - diff --git a/auth/docker/d.props.init b/auth/docker/d.props.init new file mode 100644 index 00000000..d65c11bb --- /dev/null +++ b/auth/docker/d.props.init @@ -0,0 +1,12 @@ +# Variables for building Docker entities +ORG=onap +PROJECT=aaf +DOCKER_REPOSITORY=nexus3.onap.org:10003 +VERSION=2.1.2-SNAPSHOT +CONF_ROOT_DIR=/opt/app/osaaf + +# Local Env info +HOSTNAME= +HOST_IP= +CASS_HOST= + diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh index ce299171..ec5cd5cb 100755 --- a/auth/docker/dbuild.sh +++ b/auth/docker/dbuild.sh @@ -3,8 +3,30 @@ # Docker Building Script. Reads all the components generated by install, on per-version basis # # Pull in Variables from d.props +if [ ! -e ./d.props ]; then + cp d.props.init d.props +fi + . ./d.props -# TODO add ability to do DEBUG settings + +# Create the Config (Security) Image +sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile.config > ../sample/Dockerfile +cd .. +cp ../cadi/aaf/target/aaf-cadi-aaf-${VERSION}-full.jar sample/bin +docker build -t ${ORG}/${PROJECT}/aaf_config:${VERSION} sample +rm sample/Dockerfile sample/bin/aaf-cadi-aaf-${VERSION}-full.jar +cd - + +exit + +# Second, build a core Docker Image +echo Building aaf_$AAF_COMPONENT... +# Apply currrent Properties to Docker file, and put in place. +sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile.core > ../aaf_${VERSION}/Dockerfile +cd .. +docker build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_${VERSION} +rm aaf_${VERSION}/Dockerfile +cd - if ["$1" == ""]; then AAF_COMPONENTS=`ls ../aaf_*HOT/bin | grep -v '\.'` @@ -14,11 +36,9 @@ fi for AAF_COMPONENT in ${AAF_COMPONENTS}; do echo Building aaf_$AAF_COMPONENT... - sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile > ../aaf_${VERSION}/Dockerfile + sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile.ms > ../aaf_${VERSION}/Dockerfile cd .. - docker build -t ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION} - docker tag ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${OLD_VERSION} - docker tag ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${NEW_VERSION} + docker build -t ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION} rm aaf_${VERSION}/Dockerfile cd - done diff --git a/auth/docker/dclean.sh b/auth/docker/dclean.sh index 7887b677..163272d0 100644 --- a/auth/docker/dclean.sh +++ b/auth/docker/dclean.sh @@ -8,8 +8,10 @@ else AAF_COMPONENTS=$1 fi +docker image rm $ORG/$PROJECT/aaf_core:${VERSION} + echo "Y" | docker container prune for AAF_COMPONENT in ${AAF_COMPONENTS}; do - docker image rm $DOCKER_REPOSITORY/$ORG/$PROJECT/aaf_$AAF_COMPONENT:${VERSION} + docker image rm $ORG/$PROJECT/aaf_$AAF_COMPONENT:${VERSION} done echo "Y" | docker image prune diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh index 7aee605c..a7378b75 100644 --- a/auth/docker/drun.sh +++ b/auth/docker/drun.sh @@ -2,6 +2,18 @@ # Pull in Variables from d.props . ./d.props +# Create Volumes, if not exist already +for VOL in aaf_config aaf_cass_data; do + HAS_VOLUME=`docker volume ls | grep $VOL` + if [ "$HAS_VOLUME" = "" ]; then + docker volume create --name $VOL + fi +done + docker run \ + -d \ + --name aaf_config \ + --mount 'type=volume,src=aaf_config,dst=/opt/app/osaaf,volume-driver=local' \ + ${ORG}/${PROJECT}/aaf_agent:${VERSION} if [ "$1" == "" ]; then AAF_COMPONENTS=`ls -r ../aaf_${VERSION}/bin | grep -v '\.'` @@ -49,5 +61,5 @@ for AAF_COMPONENT in ${AAF_COMPONENTS}; do ${LINKS} \ --publish $PORTMAP \ --mount type=bind,source=$CONF_ROOT_DIR,target=/opt/app/osaaf \ - ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} + ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} done diff --git a/auth/docker/dstart.sh b/auth/docker/dstart.sh index 0fb993ae..ae6ed02d 100644 --- a/auth/docker/dstart.sh +++ b/auth/docker/dstart.sh @@ -2,6 +2,7 @@ # Pull in Props . ./d.props + if [ "$1" == "" ]; then AAF_COMPONENTS=`ls -r ../aaf_${VERSION}/bin | grep -v '\.'` else -- cgit 1.2.3-korg