diff options
Diffstat (limited to 'auth/docker')
-rw-r--r-- | auth/docker/.gitignore | 1 | ||||
-rw-r--r-- | auth/docker/Dockerfile.base | 3 | ||||
-rw-r--r-- | auth/docker/Dockerfile.client | 6 | ||||
-rw-r--r-- | auth/docker/Dockerfile.config | 7 | ||||
-rw-r--r-- | auth/docker/Dockerfile.core | 2 | ||||
-rw-r--r-- | auth/docker/Dockerfile.ms | 8 | ||||
-rw-r--r-- | auth/docker/aaf.sh | 5 | ||||
-rw-r--r-- | auth/docker/agent.sh | 56 | ||||
-rw-r--r-- | auth/docker/d.props.init | 3 | ||||
-rwxr-xr-x | auth/docker/dbuild.sh | 10 | ||||
-rw-r--r-- | auth/docker/drun.sh | 5 | ||||
-rw-r--r-- | auth/docker/dstop.sh | 4 |
12 files changed, 77 insertions, 33 deletions
diff --git a/auth/docker/.gitignore b/auth/docker/.gitignore index 1c98ea37..ad950a43 100644 --- a/auth/docker/.gitignore +++ b/auth/docker/.gitignore @@ -8,3 +8,4 @@ /*.orig /.curl_auth /test.sh +/*.tgz diff --git a/auth/docker/Dockerfile.base b/auth/docker/Dockerfile.base index 879c3191..af29b951 100644 --- a/auth/docker/Dockerfile.base +++ b/auth/docker/Dockerfile.base @@ -23,5 +23,6 @@ MAINTAINER AAF Team, AT&T 2018 LABEL description="aaf_base" RUN apk add --no-cache bash RUN apk add --no-cache openssl -RUN addgroup ${USER} && adduser ${USER} -G ${USER} -D -s /bin/bash +RUN apk add --no-cache curl +RUN if [ -n "${DUSER}" ]; then addgroup ${DUSER} && adduser ${DUSER} -G ${DUSER} -D -s /bin/bash; fi diff --git a/auth/docker/Dockerfile.client b/auth/docker/Dockerfile.client index d0c20578..111c3774 100644 --- a/auth/docker/Dockerfile.client +++ b/auth/docker/Dockerfile.client @@ -25,12 +25,12 @@ 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-auth-cmd-${AAF_VERSION}-full.jar /opt/app/aaf_config/bin/ COPY bin/aaf-cadi-servlet-sample-*-sample.jar /opt/app/aaf_config/bin/ +COPY logs /opt/app/aaf_config/logs COPY cert/*trust*.b64 /opt/app/aaf_config/cert/ -RUN chown -R ${USER}:${USER} /opt/app/aaf_config +RUN if [ -n "${DUSER}" ]; then chown -R ${DUSER}:${DUSER} /opt/app/aaf_config; fi -CMD ["/bin/bash","-c","/opt/app/aaf_config/bin/agent.sh"] +CMD [] diff --git a/auth/docker/Dockerfile.config b/auth/docker/Dockerfile.config index a6d6d4f1..7e442b2a 100644 --- a/auth/docker/Dockerfile.config +++ b/auth/docker/Dockerfile.config @@ -28,17 +28,16 @@ LABEL version=${AAF_VERSION} COPY data/sample.identities.dat /opt/app/aaf_config/data/ COPY etc /opt/app/aaf_config/etc COPY local /opt/app/aaf_config/local +COPY logs /opt/app/aaf_config/logs COPY cert /opt/app/aaf_config/cert COPY public /opt/app/aaf_config/public COPY CA /opt/app/aaf_config/CA -COPY logs /opt/app/aaf_config/logs COPY bin/service.sh /opt/app/aaf_config/bin/agent.sh COPY bin/pod_wait.sh /opt/app/aaf_config/bin/ COPY bin/aaf-auth-cmd-${AAF_VERSION}-full.jar /opt/app/aaf_config/bin/ COPY bin/aaf-auth-batch-${AAF_VERSION}-full.jar /opt/app/aaf_config/bin/ -RUN chown -R ${USER}:${USER} /opt/app/aaf_config -RUN mkdir -p /opt/app/osaaf && chown ${USER}:${USER} /opt/app/osaaf +RUN mkdir -p /opt/app/osaaf +RUN if [ -n "${DUSER}" ]; then chown ${DUSER}:${DUSER} /opt/app/osaaf && chown -R ${DUSER}:${DUSER} /opt/app/aaf_config; fi CMD ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"] -CMD [] diff --git a/auth/docker/Dockerfile.core b/auth/docker/Dockerfile.core index 3e87ca56..f74e9fbd 100644 --- a/auth/docker/Dockerfile.core +++ b/auth/docker/Dockerfile.core @@ -30,5 +30,5 @@ COPY lib /opt/app/aaf/lib COPY bin /opt/app/aaf/bin COPY theme /opt/app/aaf/theme -RUN chown -R ${USER}:${USER} /opt/app/aaf +RUN if [ -n "${DUSER}" ]; then chown -R ${DUSER}:${DUSER} /opt/app/aaf; fi diff --git a/auth/docker/Dockerfile.ms b/auth/docker/Dockerfile.ms index d5614316..ead958b3 100644 --- a/auth/docker/Dockerfile.ms +++ b/auth/docker/Dockerfile.ms @@ -25,9 +25,11 @@ LABEL description="aaf_${AAF_COMPONENT}" LABEL version=${AAF_VERSION} COPY bin/pod_wait.sh /opt/app/aaf/bin/ -RUN mkdir -p /opt/app/osaaf && chown ${USER}:${USER} /opt/app/osaaf -RUN mkdir -p /opt/app/aaf/status && chown ${USER}:${USER} /opt/app/aaf/status -RUN chown -R ${USER}:${USER} /opt/app/aaf +RUN mkdir -p /opt/app/osaaf +RUN mkdir -p /opt/app/aaf/status +RUN if [ -n "${DUSER}" ]; then chown ${DUSER}:${DUSER} /opt/app/aaf/status \ + && chown ${DUSER}:${DUSER} /opt/app/osaaf \ + && chown -R ${DUSER}:${DUSER} /opt/app/aaf; fi #CMD ["bash","-c","cd /opt/app/aaf;bin/${AAF_COMPONENT}"] CMD [] diff --git a/auth/docker/aaf.sh b/auth/docker/aaf.sh index ac888390..02d258f8 100644 --- a/auth/docker/aaf.sh +++ b/auth/docker/aaf.sh @@ -26,8 +26,11 @@ DOCKER=${DOCKER:=docker} LINKS="--link $CASSANDRA_DOCKER" function run_it() { + if [ -n "${DUSER}" ]; then + USER_LINE="--user ${DUSER}" + fi $DOCKER run $@ \ - --user aaf \ + $USER_LINE \ -v "aaf_config:$CONF_ROOT_DIR" \ -v "aaf_status:/opt/app/aaf/status" \ $LINKS \ diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh index 86fee5f6..7340d30d 100644 --- a/auth/docker/agent.sh +++ b/auth/docker/agent.sh @@ -30,13 +30,13 @@ fi DOCKER=${DOCKER:=docker} CADI_VERSION=${CADI_VERSION:=2.1.10-SNAPSHOT} -for V in VERSION DOCKER_REPOSITORY HOSTNAME AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do +for V in VERSION DOCKER_REPOSITORY HOSTNAME CONTAINER_NS AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_FQDN APP_FQI VOLUME DRIVER LATITUDE LONGITUDE; do if [ "$(grep $V ./aaf.props)" = "" ]; then unset DEF case $V in DOCKER_REPOSITORY) PROMPT="Docker Repo" - DEF="" + DEF="nexus3.onap.org:10003" ;; HOSTNAME) PROMPT="HOSTNAME (blank for Default)" @@ -47,12 +47,25 @@ for V in VERSION DOCKER_REPOSITORY HOSTNAME AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_ AAF_FQDN_IP) # Need AAF_FQDN's IP, because not might not be available in mini-container PROMPT="AAF FQDN IP" - DEF=$(host $AAF_FQDN | grep "has address" | tail -1 | cut -f 4 -d ' ') + LOOKUP=$(host "${AAF_FQDN}" | grep "has address") + if [ -n "${LOOKUP}" ]; then + DEF=$(echo ${LOOKUP} | tail -1 | cut -f 4 -d ' ') + fi ;; - APP_FQI) PROMPT="App's FQI";; - APP_FQDN) PROMPT="App's Root FQDN";; - VOLUME) PROMPT="APP's AAF Configuration Volume";; + APP_FQDN) PROMPT="App's Root FQDN";; + APP_FQI) PROMPT="App's FQI" + if [[ "${APP_FQDN}" != *"."* ]]; then + DEF="${APP_FQDN}@${APP_FQDN}.onap.org" + fi + ;; + VOLUME) PROMPT="APP's AAF Configuration Volume" + if [[ "${APP_FQDN}" != *"."* ]]; then + DEF="${APP_FQDN}_config" + fi + ;; DRIVER) PROMPT=$V;DEF=local;; + CONTAINER_NS) + PROMPT=$V;DEF=onap;; VERSION) PROMPT="CADI Version";DEF=$CADI_VERSION;; LATITUDE|LONGITUDE) PROMPT="$V of Node";; *) PROMPT=$V;; @@ -74,6 +87,7 @@ for V in VERSION DOCKER_REPOSITORY HOSTNAME AAF_FQDN AAF_FQDN_IP DEPLOY_FQI APP_ fi fi echo "$V=$VAR" >> ./aaf.props + declare "$V"="$VAR" fi done . ./aaf.props @@ -90,9 +104,12 @@ else PREFIX="" fi -$DOCKER run \ - -it \ - --rm \ +function run_it() { + if [ -n "${DUSER}" ]; then + USER_LINE="--user ${DUSER}" + fi + $DOCKER run -it --rm \ + ${USER_LINE} \ -v "${VOLUME}:/opt/app/osaaf" \ --add-host="$AAF_FQDN:$AAF_FQDN_IP" \ --env AAF_FQDN=${AAF_FQDN} \ @@ -102,6 +119,23 @@ $DOCKER run \ --env APP_FQDN=${APP_FQDN} \ --env LATITUDE=${LATITUDE} \ --env LONGITUDE=${LONGITUDE} \ - --name aaf_agent_$USER \ + --env aaf_locator_container_ns=${CONTAINER_NS} \ + --name aaf-agent-$USER \ "$PREFIX"onap/aaf/aaf_agent:$VERSION \ - /bin/bash "$@" + bash -c "bash /opt/app/aaf_config/bin/agent.sh $PARAMS" +} + +PARAMS=$@ +case "$1" in + bash) + PARAMS="&& cd /opt/app/osaaf/local && exec bash" + run_it -it --rm + ;; + taillog) + run_it -it --rm + ;; + *) + run_it --rm + ;; +esac + diff --git a/auth/docker/d.props.init b/auth/docker/d.props.init index 3aaea001..bc5d3583 100644 --- a/auth/docker/d.props.init +++ b/auth/docker/d.props.init @@ -26,7 +26,7 @@ CONF_ROOT_DIR=/opt/app/osaaf # For local builds, set PREFIX= PREFIX="$DOCKER_REPOSITORY/" NAMESPACE=onap -USER=aaf +DUSER=aaf # HOSTNAME=aaf.osaaf.org @@ -39,7 +39,6 @@ LONGITUDE= CADI_X509_ISSUERS="CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_7, OU=OSAAF, O=ONAP, C=US" AAF_INITIAL_X509_P12= AAF_INITIAL_X509_PASSWORD= -CADI_X509_ISSUERS= # CA info (leave blank unless functioning as CA) CM_CA_LOCAL= diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh index f9ff9b3b..3f9bfdaf 100755 --- a/auth/docker/dbuild.sh +++ b/auth/docker/dbuild.sh @@ -38,7 +38,7 @@ cd - # AAF Base version - set the core image, etc sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ - -e 's/${USER}/'${USER}'/g' \ + -e 's/${DUSER}/'${DUSER}'/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} @@ -56,7 +56,7 @@ cp -Rf ../conf/CA sample sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${USER}/'${USER}'/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} @@ -67,7 +67,7 @@ cp ../cadi/servlet-sample/target/aaf-cadi-servlet-sample-${VERSION}-sample.jar s sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${USER}/'${USER}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ docker/Dockerfile.client > 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} @@ -85,7 +85,7 @@ echo Building aaf_$AAF_COMPONENT... sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${USER}/'${USER}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ Dockerfile.core >../aaf_${VERSION}/Dockerfile cd .. $DOCKER build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_${VERSION} @@ -109,7 +109,7 @@ for AAF_COMPONENT in ${AAF_COMPONENTS}; do sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${USER}/'${USER}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ Dockerfile.ms >../aaf_${VERSION}/Dockerfile cd .. $DOCKER build -t ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION} diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh index d7d43d65..994bb556 100644 --- a/auth/docker/drun.sh +++ b/auth/docker/drun.sh @@ -93,9 +93,12 @@ for AAF_COMPONENT in ${AAF_COMPONENTS}; do #--hostname="${AAF_COMPONENT}.${NAMESPACE}" \ # --env aaf_locate_url=https://aaf-locate:8095 \ # $ADD_HOST \ + if [ -n "${DUSER}" ]; then + THE_USER="--user $DUSER" + fi $DOCKER run \ -d \ - --user aaf \ + ${THE_USER} \ --name aaf-$AAF_COMPONENT \ ${LINKS} \ --env AAF_ENV=${AAF_ENV} \ diff --git a/auth/docker/dstop.sh b/auth/docker/dstop.sh index 256385d5..fce79226 100644 --- a/auth/docker/dstop.sh +++ b/auth/docker/dstop.sh @@ -23,7 +23,9 @@ DOCKER=${DOCKER:=docker} if [ "$1" == "" ]; then - AAF_COMPONENTS=$(tail -r components) + for C in $(cat components); do + AAF_COMPONENTS="$C $AAF_COMPONENTS" + done else AAF_COMPONENTS="$@" fi |