diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-07-13 15:49:26 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-07-13 15:59:11 -0500 |
commit | 4ad4763d8c9191998cc671a884d1af5da6ba8bb9 (patch) | |
tree | 124d864d0c3e1e03015ecb70a960e434775a59ef /auth/docker | |
parent | 9af4623faed6fd0bda1567cbf28899b5b5363be0 (diff) |
Make Container Config Strategy
Issue-ID: AAF-378
Change-Id: I57186f66b9713262643e0f440f5b9eb78154c155
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/docker')
-rw-r--r-- | auth/docker/.gitignore | 1 | ||||
-rw-r--r-- | auth/docker/Dockerfile | 24 | ||||
-rw-r--r-- | auth/docker/Dockerfile.config | 2 | ||||
-rw-r--r-- | auth/docker/Dockerfile.ms | 2 | ||||
-rw-r--r-- | auth/docker/README.txt | 31 | ||||
-rw-r--r-- | auth/docker/agent.sh | 15 | ||||
-rw-r--r-- | auth/docker/dbounce.sh | 4 | ||||
-rwxr-xr-x | auth/docker/dbuild.sh | 28 | ||||
-rw-r--r-- | auth/docker/dclean.sh | 9 | ||||
-rw-r--r-- | auth/docker/dpush.sh | 4 | ||||
-rw-r--r-- | auth/docker/drun.sh | 101 | ||||
-rw-r--r-- | auth/docker/dstart.sh | 9 | ||||
-rw-r--r-- | auth/docker/dstop.sh | 8 |
13 files changed, 119 insertions, 119 deletions
diff --git a/auth/docker/.gitignore b/auth/docker/.gitignore index f08acc75..a03737d0 100644 --- a/auth/docker/.gitignore +++ b/auth/docker/.gitignore @@ -1 +1,2 @@ +local d.props diff --git a/auth/docker/Dockerfile b/auth/docker/Dockerfile deleted file mode 100644 index d744d69c..00000000 --- a/auth/docker/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM rmannfv/aaf-base:xenial -MAINTAINER AAF Team, AT&T 2018 -ENV VERSION=${AAF_VERSION} - -LABEL description="aaf ${AAF_COMPONENT}" -LABEL version=${AAF_VERSION} - - -COPY lib /opt/app/aaf/${AAF_COMPONENT}/lib -COPY theme /opt/app/aaf/${AAF_COMPONENT}/theme -COPY bin /opt/app/aaf/${AAF_COMPONENT}/bin - -CMD ["/bin/bash","-c","/opt/app/aaf/${AAF_COMPONENT}/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/Dockerfile.config b/auth/docker/Dockerfile.config index a5811e09..1855fae2 100644 --- a/auth/docker/Dockerfile.config +++ b/auth/docker/Dockerfile.config @@ -7,7 +7,7 @@ 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 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 diff --git a/auth/docker/Dockerfile.ms b/auth/docker/Dockerfile.ms index 121bd06c..b8ef6d9a 100644 --- a/auth/docker/Dockerfile.ms +++ b/auth/docker/Dockerfile.ms @@ -5,6 +5,8 @@ ENV VERSION=${AAF_VERSION} LABEL description="aaf_${AAF_COMPONENT}" LABEL version=${AAF_VERSION} +COPY theme /opt/app/aaf/theme + CMD ["/bin/bash","-c","/opt/app/aaf/bin/${AAF_COMPONENT}"] # For Debugging installation diff --git a/auth/docker/README.txt b/auth/docker/README.txt new file mode 100644 index 00000000..32ed3489 --- /dev/null +++ b/auth/docker/README.txt @@ -0,0 +1,31 @@ +# Start the container in bash mode, so it stays up +sh agent.sh bash + + +# in another shell, find out your Container name +docker container ls | grep aaf_agent + +# copy keystore for this AAF Env +docker container cp -L org.osaaf.aaf.p12 <Your Container>:/opt/app/osaaf/local +# (in Agent Window) +agent encrypt cadi_keystore_password + +# If you intend to use Certman to sign certs, it is a "local" CA +# copy Signing Keystore into container +docker container cp -L org.osaaf.aaf.signer.p12 <Your Container>:/opt/app/osaaf/local +# (in Agent Window) +agent encrypt cm_ca.local + +# Add in Cassandra Password +agent encrypt cassandra.clusters.password + +# Check to make sure all passwords are set +grep "enc:" *.props + + +# When good, run AAF +bash drun.sh + +# watch logs in Agent Window +cd ../logs +sh taillog diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh index 68027947..f734c629 100644 --- a/auth/docker/agent.sh +++ b/auth/docker/agent.sh @@ -1,9 +1,12 @@ #!/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 + -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" \ + --name aaf_agent_$USER \ + ${ORG}/${PROJECT}/aaf_config:${VERSION} \ + /bin/bash "$@" diff --git a/auth/docker/dbounce.sh b/auth/docker/dbounce.sh new file mode 100644 index 00000000..e6367957 --- /dev/null +++ b/auth/docker/dbounce.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sh ./dstop.sh "$@" +sh ./dstart.sh "$@" diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh index ec5cd5cb..ba7a8095 100755 --- a/auth/docker/dbuild.sh +++ b/auth/docker/dbuild.sh @@ -1,46 +1,42 @@ -#!/bin/bash +#!/bin/bash # # 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 + cp d.props.init d.props 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 +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 +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 '\.'` + AAF_COMPONENTS=$(ls ../aaf_*HOT/bin | grep -v '\.') else - AAF_COMPONENTS=$1 + AAF_COMPONENTS=$1 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.ms > ../aaf_${VERSION}/Dockerfile - cd .. - docker build -t ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION} - rm aaf_${VERSION}/Dockerfile - cd - + echo Building aaf_$AAF_COMPONENT... + sed -e 's/${AAF_VERSION}/'${VERSION}'/g' -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' Dockerfile.ms >../aaf_${VERSION}/Dockerfile + cd .. + 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 163272d0..0bca9ef7 100644 --- a/auth/docker/dclean.sh +++ b/auth/docker/dclean.sh @@ -1,17 +1,18 @@ -#!/bin/bash +#!/bin/bash # Pull in Variables from d.props . ./d.props if [ "$1" == "" ]; then - AAF_COMPONENTS=`ls ../aaf_${VERSION}/bin | grep -v '\.'` + AAF_COMPONENTS=$(ls ../aaf_${VERSION}/bin | grep -v '\.') else - AAF_COMPONENTS=$1 + AAF_COMPONENTS=$1 fi +docker image rm $ORG/$PROJECT/aaf_config:${VERSION} docker image rm $ORG/$PROJECT/aaf_core:${VERSION} echo "Y" | docker container prune for AAF_COMPONENT in ${AAF_COMPONENTS}; do - docker image rm $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/dpush.sh b/auth/docker/dpush.sh index 78129796..761ae2a8 100644 --- a/auth/docker/dpush.sh +++ b/auth/docker/dpush.sh @@ -12,7 +12,7 @@ fi for AAF_COMPONENT in ${AAF_COMPONENTS}; do docker push ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${OLD_VERSION} - docker push ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} - docker push ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${NEW_VERSION} + docker push ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} + docker push ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${NEW_VERSION} done diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh index a7378b75..c62adfc2 100644 --- a/auth/docker/drun.sh +++ b/auth/docker/drun.sh @@ -1,65 +1,52 @@ -#!/bin/bash +#!/bin/bash # 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 '\.'` + AAF_COMPONENTS=$(ls -r ../aaf_${VERSION}/bin | grep -v '\.') else - AAF_COMPONENTS=$1 + AAF_COMPONENTS="$@" fi - -for AAF_COMPONENT in ${AAF_COMPONENTS}; do - case "$AAF_COMPONENT" in - "service") - PORTMAP="8100:8100" - LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" - ;; - "locate") - PORTMAP="8095:8095" - LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" - ;; - "oauth") - PORTMAP="8140:8140" - LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" - ;; - "gui") - PORTMAP="8200:8200" - ;; - "cm") - PORTMAP="8150:8150" - LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" - ;; - "hello") - PORTMAP="8130:8130" - ;; - "fs") - PORTMAP="80:8096" - ;; - esac - - echo Starting aaf_$AAF_COMPONENT... - docker run \ - -d \ - --name aaf_$AAF_COMPONENT \ - --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \ - --add-host="$HOSTNAME:$HOST_IP" \ - --add-host="aaf.osaaf.org:$HOST_IP" \ - ${LINKS} \ - --publish $PORTMAP \ - --mount type=bind,source=$CONF_ROOT_DIR,target=/opt/app/osaaf \ - ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} +for AAF_COMPONENT in ${AAF_COMPONENTS}; do + case "$AAF_COMPONENT" in + "service") + PORTMAP="8100:8100" + LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" + ;; + "locate") + PORTMAP="8095:8095" + LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" + ;; + "oauth") + PORTMAP="8140:8140" + LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" + ;; + "gui") + PORTMAP="8200:8200" + ;; + "cm") + PORTMAP="8150:8150" + LINKS="--link aaf_cass:cassandra --add-host=$CASS_HOST" + ;; + "hello") + PORTMAP="8130:8130" + ;; + "fs") + PORTMAP="80:8096" + ;; + esac + + echo Starting aaf_$AAF_COMPONENT... + + docker run \ + -d \ + --name aaf_$AAF_COMPONENT \ + --hostname="${AAF_COMPONENT}.aaf.osaaf.org" \ + --add-host="$HOSTNAME:$HOST_IP" \ + --add-host="aaf.osaaf.org:$HOST_IP" \ + ${LINKS} \ + --publish $PORTMAP \ + --mount 'type=volume,src=aaf_config,dst='$CONF_ROOT_DIR',volume-driver=local' \ + ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} done diff --git a/auth/docker/dstart.sh b/auth/docker/dstart.sh index ae6ed02d..4c0a46f4 100644 --- a/auth/docker/dstart.sh +++ b/auth/docker/dstart.sh @@ -1,14 +1,13 @@ -#!/bin/bash +#!/bin/bash # Pull in Props . ./d.props - if [ "$1" == "" ]; then - AAF_COMPONENTS=`ls -r ../aaf_${VERSION}/bin | grep -v '\.'` + AAF_COMPONENTS=$(ls -r ../aaf_${VERSION}/bin | grep -v '\.') else - AAF_COMPONENTS=$1 + AAF_COMPONENTS="$@" fi for AAF_COMPONENT in ${AAF_COMPONENTS}; do - docker start aaf_$AAF_COMPONENT + docker start aaf_$AAF_COMPONENT done diff --git a/auth/docker/dstop.sh b/auth/docker/dstop.sh index 4c8d4425..c6e1cfeb 100644 --- a/auth/docker/dstop.sh +++ b/auth/docker/dstop.sh @@ -1,13 +1,13 @@ -#!/bin/bash +#!/bin/bash # Pull in Properties . ./d.props if [ "$1" == "" ]; then - AAF_COMPONENTS=`ls ../aaf_${VERSION}/bin | grep -v '\.'` + AAF_COMPONENTS=$(ls ../aaf_${VERSION}/bin | grep -v '\.') else - AAF_COMPONENTS=$1 + AAF_COMPONENTS="$@" fi for AAF_COMPONENT in ${AAF_COMPONENTS}; do - docker stop aaf_$AAF_COMPONENT + docker stop aaf_$AAF_COMPONENT done |