diff options
author | Instrumental <jgonap@stl.gathman.org> | 2020-03-24 17:07:27 -0500 |
---|---|---|
committer | Instrumental <jgonap@stl.gathman.org> | 2020-03-26 01:28:32 -0500 |
commit | 96bf6a2771dfe992fb27bd6361d191d83b6ff605 (patch) | |
tree | b26581f65d15574fe81f5dfa3e061b93744ef7fd /auth/docker | |
parent | 48bcfb9d4b03ac3e2e6915f7bdf72599c8794d43 (diff) |
AAF Services non root, all platforms2.1.20
adjust Agent for JDK 11
Included redoing Config and Agent Init Containers
refit for "hello" (sample)
Issue-ID: AAF-1102
Signed-off-by: Instrumental <jgonap@stl.gathman.org>
Change-Id: Ia957b1ccce34d164580ccb0a6d02d7b800e4887e
Diffstat (limited to 'auth/docker')
-rw-r--r-- | auth/docker/Dockerfile.agent | 13 | ||||
-rw-r--r-- | auth/docker/Dockerfile.base | 15 | ||||
-rw-r--r-- | auth/docker/Dockerfile.config | 16 | ||||
-rw-r--r-- | auth/docker/Dockerfile.core | 14 | ||||
-rw-r--r-- | auth/docker/Dockerfile.hello | 19 | ||||
-rw-r--r-- | auth/docker/agent.sh | 4 | ||||
-rw-r--r-- | auth/docker/components | 1 | ||||
-rw-r--r-- | auth/docker/dbuild.sh | 249 | ||||
-rw-r--r-- | auth/docker/dclean.sh | 4 | ||||
-rw-r--r-- | auth/docker/drun.sh | 50 | ||||
-rw-r--r-- | auth/docker/dstop.sh | 7 |
11 files changed, 238 insertions, 154 deletions
diff --git a/auth/docker/Dockerfile.agent b/auth/docker/Dockerfile.agent index e974dc49..71f70098 100644 --- a/auth/docker/Dockerfile.agent +++ b/auth/docker/Dockerfile.agent @@ -27,9 +27,14 @@ LABEL version=${AAF_VERSION} COPY bin/client.sh /opt/app/aaf_config/bin/agent.sh COPY bin/pod_wait.sh /opt/app/aaf_config/bin/pod_wait.sh COPY bin/aaf-cadi-aaf-${JAR_VERSION}-full.jar /opt/app/aaf_config/bin/ -COPY bin/aaf-cadi-servlet-sample-*-sample.jar /opt/app/aaf_config/bin/ +#COPY bin/aaf-cadi-servlet-sample-*-sample.jar /opt/app/aaf_config/bin/ COPY cert/*trust*.b64 /opt/app/aaf_config/cert/ -RUN chmod 755 /opt/app/aaf_config/bin/* &&\ - if [ -n "${DUSER}" ]; then chown -R ${DUSER}:${DUSER} /opt/app/aaf_config; fi -USER ${DUSER} + CMD [] + +RUN mkdir -p /opt/app/osaaf/local && \ + if [ -n "${DUSER}" ]; then \ + addgroup ${DUSER} && adduser ${DUSER} -G ${DUSER} -D -s /bin/bash; \ + chown ${DUSER}:${DUSER} /opt/app/osaaf/local; \ + fi +# Note: User added if in d.props diff --git a/auth/docker/Dockerfile.base b/auth/docker/Dockerfile.base index 523d63f0..4d305d7a 100644 --- a/auth/docker/Dockerfile.base +++ b/auth/docker/Dockerfile.base @@ -18,19 +18,20 @@ # ============LICENSE_END==================================================== # # Use dbuild.sh input parameter to set registry -#FROM ${REGISTRY}/openjdk:11-jre-slim #FROM ${REGISTRY}/openjdk:8-jdk-alpine FROM ${REGISTRY}/alpine -#FROM openjdk:12-jdk-alpine -#FROM openjdk:13-jdk-alpine MAINTAINER AAF Team, AT&T 2018 LABEL description="aaf_base" ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk -RUN apk --no-cache add openjdk11 &&\ - apk add --no-cache bash &&\ + +RUN apk add --no-cache bash &&\ + apk --no-cache add openjdk11 &&\ apk add --no-cache openssl &&\ - apk add --no-cache curl &&\ - if [ -n "${DUSER}" ]; then addgroup ${DUSER} && adduser ${DUSER} -G ${DUSER} -D -s /bin/bash; fi + apk add --no-cache curl + +# mkdir -p /opt/app/aaf/status +# addgroup ${DUSER} && adduser ${DUSER} -G ${DUSER} -D -s /bin/bash +# Note: User added if in d.props diff --git a/auth/docker/Dockerfile.config b/auth/docker/Dockerfile.config index b2263ecc..3d9aa352 100644 --- a/auth/docker/Dockerfile.config +++ b/auth/docker/Dockerfile.config @@ -36,8 +36,16 @@ COPY bin/pod_wait.sh /opt/app/aaf_config/bin/pod_wait.sh COPY bin/aaf-auth-cmd-${JAR_VERSION}-full.jar /opt/app/aaf_config/bin/ COPY bin/aaf-auth-batch-${JAR_VERSION}-full.jar /opt/app/aaf_config/bin/ -RUN mkdir -p /opt/app/osaaf &&\ - chmod 755 /opt/app/aaf_config/bin/*.sh &&\ - if [ -n "${DUSER}" ]; then chown ${DUSER}:${DUSER} /opt/app/osaaf && chown -R ${DUSER}:${DUSER} /opt/app/aaf_config; fi -USER ${DUSER} +RUN mkdir -p /opt/app/aaf /opt/app/osaaf/logs && \ + if [ -n "${DUSER}" ]; then \ + addgroup ${DUSER} && adduser ${DUSER} -G ${DUSER} -D -s /bin/bash; \ + chown -R ${DUSER}:${DUSER} /opt/app/aaf /opt/app/osaaf /opt/app/aaf_config; \ + fi && \ + chmod 774 /opt/app/aaf_config/bin/*.sh + CMD ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"] +# Note: User added if in d.props +# if [ -n "${DUSER}" ]; then \ +# addgroup ${DUSER} && adduser ${DUSER} -G ${DUSER} -D -s /bin/bash; \ +# chown -R ${DUSER}:${DUSER} /opt/app/aaf /opt/app/aaf_config; \ +# fi && \ diff --git a/auth/docker/Dockerfile.core b/auth/docker/Dockerfile.core index 4179c5e7..206d1c4d 100644 --- a/auth/docker/Dockerfile.core +++ b/auth/docker/Dockerfile.core @@ -30,11 +30,11 @@ COPY lib /opt/app/aaf/lib COPY bin /opt/app/aaf/bin COPY theme/ /opt/app/aaf/theme/ -RUN mkdir -p /opt/app/osaaf &&\ - mkdir -p /opt/app/aaf/status &&\ - chmod 755 /opt/app/aaf/bin/* &&\ - if [ -n "${DUSER}" ]; then chown ${DUSER}:${DUSER} /opt/app/aaf/status \ - && chown ${DUSER}:${DUSER} /opt/app/osaaf \ - && chown -R ${DUSER}:${DUSER} /opt/app/aaf;\ +RUN mkdir -p /opt/app/aaf && \ + if [ -n "${DUSER}" ]; then \ + addgroup ${DUSER} && adduser ${DUSER} -G ${DUSER} -D -s /bin/bash ;\ + chown -R ${DUSER}:${DUSER} /opt/app/aaf ;\ + chmod 774 /opt/app/aaf/bin/* ;\ fi -USER ${DUSER} + +# Note: User added if in d.props diff --git a/auth/docker/Dockerfile.hello b/auth/docker/Dockerfile.hello index 82d9a9f5..e8a60566 100644 --- a/auth/docker/Dockerfile.hello +++ b/auth/docker/Dockerfile.hello @@ -27,15 +27,16 @@ LABEL version=${AAF_VERSION} COPY bin/pod_wait.sh /opt/app/aaf/bin/ COPY lib /opt/app/aaf/lib COPY bin/hello /opt/app/aaf/bin/ -COPY etc /opt/app/aaf/etc -COPY logs /opt/app/aaf/logs +COPY etc /opt/app/osaaf/etc +COPY logs /opt/app/osaaf/logs -RUN mkdir -p /opt/app/osaaf &&\ - mkdir -p /opt/app/aaf/status &&\ - chmod 755 /opt/app/aaf/bin/* &&\ - if [ -n "${DUSER}" ]; then chown ${DUSER}:${DUSER} /opt/app/aaf/status \ - && chown ${DUSER}:${DUSER} /opt/app/osaaf \ - && chown -R ${DUSER}:${DUSER} /opt/app/aaf;\ +RUN mkdir -p /opt/app/aaf /opt/app/osaaf/logs/hello /opt/app/osaaf/local && \ + if [ -n "${DUSER}" ]; then \ + addgroup ${DUSER} && adduser ${DUSER} -G ${DUSER} -D -s /bin/bash ;\ + chown -R ${DUSER}:${DUSER} /opt/app/aaf /opt/app/osaaf;\ + chmod 774 /opt/app/aaf/bin/* ;\ fi -USER ${DUSER} + CMD [] + +# Note: User added if in d.props diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh index f59bd228..0abce9c6 100644 --- a/auth/docker/agent.sh +++ b/auth/docker/agent.sh @@ -111,8 +111,9 @@ function run_it() { fi $DOCKER run -it --rm \ ${USER_LINE} \ - -v "${VOLUME}:/opt/app/osaaf" \ + -v "${VOLUME}:/opt/app/osaaf/local" \ --add-host="$AAF_FQDN:$AAF_FQDN_IP" \ + $USER_LINE \ --env AAF_FQDN=${AAF_FQDN} \ --env DEPLOY_FQI=${DEPLOY_FQI} \ --env DEPLOY_PASSWORD=${DEPLOY_PASSWORD} \ @@ -138,6 +139,7 @@ function reset_sso { mkdir -p ~/.aaf > $HOME/.aaf/sso.props sso aaf_locate_url "https://$AAF_FQDN:8095" + sso aaf_url_cm "https://$AAF_FQDN:8150" sso cadi_latitude "$LATITUDE" sso cadi_longitude "$LONGITUDE" sso cadi_loglevel "DEBUG" diff --git a/auth/docker/components b/auth/docker/components index 7f58dc33..bb5f27b2 100644 --- a/auth/docker/components +++ b/auth/docker/components @@ -3,5 +3,4 @@ locate oauth cm gui -hello fs diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh index 0a816461..e768904b 100644 --- a/auth/docker/dbuild.sh +++ b/auth/docker/dbuild.sh @@ -31,6 +31,19 @@ fi # Remove "SNAPSHOT" from AAF Jars in Containers JAR_VERSION=${VERSION/-SNAPSHOT/} +function SCP() { + SANS=${1/-SNAPSHOT/} + echo $1 = $SANS + if [ -e $SANS ]; then + cp $SANS $2 + else + + ln $1 $SANS + cp $SANS $2 + rm $SANS + fi +} + # process input. originally, an optional positional parameter is used to designate a component. # A flagged parameter has been added to optionally indicate docker pull registry. Ideally, options # would be flagged but we're avoiding ripple effect of changing original usage @@ -46,6 +59,7 @@ if [ $# -gt 0 ]; then else DOCKER_PULL_REGISTRY=$3 fi + shift fi fi fi @@ -54,81 +68,82 @@ grep -v '#' d.props | grep '=' | grep -v -e "=$" DOCKER=${DOCKER:=docker} -echo "Building Containers for aaf components, version $VERSION" -# AAF_cass now needs a version... -echo "### Build Cass" -cd ../auth-cass/docker -pwd -bash ./dbuild.sh $DOCKER_PULL_REGISTRY -cd - - ######## -# First, build a AAF Base version - set the core image, etc -echo "### Build Base" -sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ - -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ - -e 's/${DUSER}/'${DUSER}'/g' \ - -e 's/${REGISTRY}/'${DOCKER_PULL_REGISTRY}'/g' \ - Dockerfile.base > Dockerfile -$DOCKER build -t ${ORG}/${PROJECT}/aaf_base:${VERSION} . -$DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:${VERSION} -$DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:latest -rm Dockerfile - -function SCP() { - SANS=${1/-SNAPSHOT/} - echo $1 = $SANS - if [ -e $SANS ]; then - cp $SANS $2 - else - - ln $1 $SANS - cp $SANS $2 - rm $SANS - fi -} +# Preliminary: if Cass exists, build that first +if [[ -z "$1" || "$1" = "cass" ]]; then + echo "#### Delegate to Cassandra build" + echo "Building Containers for aaf components, version $VERSION" + # AAF_cass now needs a version... + echo "### Build Cass" + cd ../auth-cass/docker + bash ./dbuild.sh $DOCKER_PULL_REGISTRY + cd - +fi -######## -# Second, Create the AAF Config (Security) Images +if [[ -z "$1" || "$1" = "base" ]]; then + ######## + # First, build a AAF Base version - set the core image, etc + echo "### Build Base" + sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ + -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ + -e 's/${REGISTRY}/'${DOCKER_PULL_REGISTRY}'/g' \ + Dockerfile.base > Dockerfile + $DOCKER build -t ${ORG}/${PROJECT}/aaf_base:${VERSION} . + $DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:${VERSION} + $DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:latest + rm Dockerfile +fi + +# Common copies cd .. -# Note: only 2 jars each in Agent/Config -SCP auth-cmd/target/aaf-auth-cmd-$VERSION-full.jar sample/bin -SCP auth-batch/target/aaf-auth-batch-$VERSION-full.jar sample/bin SCP ../cadi/aaf/target/aaf-cadi-aaf-${VERSION}-full.jar sample/bin -SCP ../cadi/servlet-sample/target/aaf-cadi-servlet-sample-${VERSION}-sample.jar sample/bin -cp -Rf ../conf/CA sample - -# AAF Config image (for AAF itself) -echo "### Build Config" -sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ - -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ - -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ - -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${DUSER}/'${DUSER}'/g' \ - docker/Dockerfile.config > sample/Dockerfile -$DOCKER build -t ${ORG}/${PROJECT}/aaf_config:${VERSION} sample -$DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:${VERSION} -$DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:latest - - -# AAF Agent Image (for Clients) -echo "### Build Agent" -sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ - -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ - -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ - -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${DUSER}/'${DUSER}'/g' \ - docker/Dockerfile.agent > sample/Dockerfile -$DOCKER build -t ${ORG}/${PROJECT}/aaf_agent:${VERSION} sample -$DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:${VERSION} -$DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:latest + +if [[ -z "$1" || "$1" = "config" ]]; then + ######## + # Second, Create the AAF Config (Security) Images + # Note: only 2 jars each in Agent/Config + SCP auth-cmd/target/aaf-auth-cmd-$VERSION-full.jar sample/bin + SCP auth-batch/target/aaf-auth-batch-$VERSION-full.jar sample/bin + SCP ../cadi/servlet-sample/target/aaf-cadi-servlet-sample-${VERSION}-sample.jar sample/bin + cp -Rf ../conf/CA sample + + # AAF Config image (for AAF itself) + echo "### Build Config" + sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ + -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ + -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ + -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ + docker/Dockerfile.config > sample/Dockerfile + # Note: do Config as Root, to get directories correct + $DOCKER build -t ${ORG}/${PROJECT}/aaf_config:${VERSION} sample + $DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:${VERSION} + $DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:latest +fi + +if [[ -z "$1" || "$1" = "agent" ]]; then + # AAF Agent Image (for Clients) + echo "### Build Agent" + sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ + -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ + -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ + -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ + docker/Dockerfile.agent > sample/Dockerfile + #if [ -n "$DUSER" ]; then + # echo "USER $DUSER" >> sample/Dockerfile + #fi + $DOCKER build -t ${ORG}/${PROJECT}/aaf_agent:${VERSION} sample + $DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:${VERSION} + $DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:latest + +fi # Clean up -rm sample/Dockerfile sample/bin/aaf-*-*.jar -rm -Rf sample/CA +rm -Rf sample/Dockerfile sample/bin/aaf-*-*.jar sample/CA cd - - ######## # Third Copy AAF Executables to a BUILD Directory, for easy Cleanup echo "### Copy to aaf_DBUILD" @@ -155,53 +170,65 @@ if [ ! "$VERSION" = "$JAR_VERSION" ]; then done cd ${START_DIR} fi - -######## -# Third, build a core Docker Image to be used for all AAF Components cp ../sample/bin/pod_wait.sh ../aaf_DBUILD/bin -# Apply currrent Properties to Docker file, and put in place. -sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ - -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ - -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ - -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${DUSER}/'${DUSER}'/g' \ - Dockerfile.core >../aaf_DBUILD/Dockerfile -cd .. - -echo "### Building Core" -# Don't need "Hello" App in core -mv aaf_DBUILD/lib/aaf-auth-hello-${JAR_VERSION}* /tmp -$DOCKER build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_DBUILD -$DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:${VERSION} -$DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:latest -rm aaf_DBUILD/Dockerfile -mv /tmp/aaf-auth-hello-${JAR_VERSION}* aaf_DBUILD/lib - -######## -# Fourth, do Hello -# Apply currrent Properties to Docker file, and put in place. -echo "### Building Hello" -cd - -sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ - -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ - -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${DUSER}/'${DUSER}'/g' \ - Dockerfile.hello >../aaf_DBUILD/Dockerfile -cd .. - -cp -Rf sample/etc aaf_DBUILD -cp -Rf sample/logs aaf_DBUILD - -for C in cass certman cmd deforg fs gui locate oauth service; do - rm aaf_DBUILD/lib/aaf-auth-$C-* -done +if [[ -z "$1" || "$1" = "core" ]]; then + ######## + # Fourth, build a core Docker Image to be used for all AAF Components + # Apply currrent Properties to Docker file, and put in place. + sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ + -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ + -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ + -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ + Dockerfile.core >../aaf_DBUILD/Dockerfile + if [ -n "$DUSER" ]; then + echo "USER $DUSER" >> ../aaf_DBUILD/Dockerfile + fi + cd .. + + $DOCKER build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_DBUILD + $DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:${VERSION} + $DOCKER tag ${ORG}/${PROJECT}/aaf_core:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_core:latest + rm aaf_DBUILD/Dockerfile + + cd - +fi -$DOCKER build -t ${ORG}/${PROJECT}/aaf_hello:${VERSION} aaf_DBUILD -$DOCKER tag ${ORG}/${PROJECT}/aaf_hello:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_hello:${VERSION} -$DOCKER tag ${ORG}/${PROJECT}/aaf_hello:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_hello:latest +if [[ -z "$1" || "$1" = "hello" ]]; then + ######## + # Fifth, do Hello + # Apply currrent Properties to Docker file, and put in place. + echo "### Building Hello" + cp ../sample/bin/client.sh ../aaf_DBUILD/bin + cp ../sample/hello/init.sh ../aaf_DBUILD/bin/hello_init.sh + SCP ../../cadi/aaf/target/aaf-cadi-aaf-${VERSION}-full.jar ../aaf_DBUILD/bin + + sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ + -e 's/${JAR_VERSION}/'${JAR_VERSION}'/g' \ + -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ + Dockerfile.hello >../aaf_DBUILD/Dockerfile + #if [ -n "$DUSER" ]; then + # echo "USER $DUSER" >> ../aaf_DBUILD/Dockerfile + #fi + + cd .. + cp -Rf sample/etc aaf_DBUILD + cp -Rf sample/logs aaf_DBUILD + cp -Rf sample/cert aaf_DBUILD + + for C in cass certman cmd deforg fs gui locate oauth service; do + rm aaf_DBUILD/lib/aaf-auth-$C-* + done + $DOCKER build -t ${ORG}/${PROJECT}/aaf_hello:${VERSION} aaf_DBUILD + if [ -n ${DOCKER_REPOSITORY} ]; then + $DOCKER tag ${ORG}/${PROJECT}/aaf_hello:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_hello:${VERSION} + $DOCKER tag ${ORG}/${PROJECT}/aaf_hello:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_hello:latest + fi + cd - +fi # Final cleanup -rm -Rf aaf_DBUILD +rm -Rf ../aaf_DBUILD -cd - diff --git a/auth/docker/dclean.sh b/auth/docker/dclean.sh index f27cc4ec..867f4c69 100644 --- a/auth/docker/dclean.sh +++ b/auth/docker/dclean.sh @@ -22,6 +22,10 @@ . ./d.props DOCKER=${DOCKER:=docker} +if [ "$1" == "all" ]; then + AAF_COMPONENTS=cass + shift +fi if [ "$1" == "" ]; then AAF_COMPONENTS="$(cat components) config core agent base " else diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh index 57a61676..86fe5984 100644 --- a/auth/docker/drun.sh +++ b/auth/docker/drun.sh @@ -34,6 +34,14 @@ else AAF_COMPONENTS="$@" fi +# All the NORMAL services use common directory +# remove this for Hello, which we want non shared +CONFIG="-v aaf_config:$CONF_ROOT_DIR" +if [ -n "${DUSER}" ]; then + THE_USER="--user $DUSER" +fi +IMAGE="${PREFIX}${ORG}/${PROJECT}/aaf_core:${VERSION}" + for AAF_COMPONENT in ${AAF_COMPONENTS}; do LINKS="" CMD_LINE="" @@ -75,17 +83,40 @@ for AAF_COMPONENT in ${AAF_COMPONENTS}; do CMD_LINE="cd /opt/app/aaf && /bin/bash bin/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 bin/pod_wait.sh aaf-hello aaf-locate && exec bin/hello" + CONFIG="-v aaf_hello_config:/opt/app/osaaf/local" + + # Since Helm based element have init-containers, take the same approach here. + if [ -z "$(docker volume ls | grep aaf_hello_config)" ]; then + echo Init Hello Config Container + + echo -n "Creating Volume: " + $DOCKER volume create -d local aaf_hello_config + + $DOCKER run --rm --name aaf_hello_config ${LINKS} \ + $CONFIG \ + --env AAF_FQDN=$HOSTNAME \ + --env DEPLOY_FQI=deployer@people.osaaf.org \ + --env DEPLOY_PASSWORD=demo123456! \ + --env APP_FQI=aaf@aaf.osaaf.org \ + --env APP_FQDN=aaf-hello \ + --env LATITUDE=$LATITUDE \ + --env LONGITUDE=$LONGITUDE \ + --env aaf_locator_container_ns=onap \ + --env aaf_locator_container=docker \ + $LINKS \ + "${PREFIX}${ORG}/${PROJECT}/aaf_agent:${VERSION}" \ + bash -c "bash /opt/app/aaf_config/bin/agent.sh && chown -R ${DUSER}:${DUSER} /opt/app/osaaf/local" + fi + + PUBLISH="--publish 8130:8130" + #CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-hello aaf-locate aaf-cm && sleep 240" + CMD_LINE="cd /opt/app/aaf && /bin/bash bin/pod_wait.sh aaf-hello aaf-locate aaf-cm && exec bin/hello" + IMAGE="${PREFIX}${ORG}/${PROJECT}/aaf_hello:${VERSION}" ;; esac echo Starting aaf-$AAF_COMPONENT... - if [ -n "${DUSER}" ]; then - THE_USER="--user $DUSER" - fi - $DOCKER run \ -d \ @@ -104,9 +135,10 @@ for AAF_COMPONENT in ${AAF_COMPONENTS}; do --env CASSANDRA_USER=${CASSANDRA_USER} \ --env CASSANDRA_PASSWORD=${CASSANDRA_PASSWORD} \ --env CASSANDRA_PORT=${CASSANDRA_PORT} \ - $PUBLISH \ - -v "aaf_config:$CONF_ROOT_DIR" \ -v "aaf_status:/opt/app/aaf/status" \ - ${PREFIX}${ORG}/${PROJECT}/aaf_core:${VERSION} \ + $PUBLISH \ + $CONFIG \ + $IMAGE \ /bin/bash -c "$CMD_LINE" + done diff --git a/auth/docker/dstop.sh b/auth/docker/dstop.sh index fce79226..6549f3cf 100644 --- a/auth/docker/dstop.sh +++ b/auth/docker/dstop.sh @@ -22,7 +22,11 @@ . ./d.props DOCKER=${DOCKER:=docker} -if [ "$1" == "" ]; then +if [ "$1" = "all" ]; then + AAF_COMPONENTS="cass" + shift +fi +if [ -z "$1" ]; then for C in $(cat components); do AAF_COMPONENTS="$C $AAF_COMPONENTS" done @@ -33,3 +37,4 @@ fi for AAF_COMPONENT in ${AAF_COMPONENTS}; do $DOCKER stop aaf-$AAF_COMPONENT done + |