Make Container Config Strategy
Issue-ID: AAF-378
Change-Id: I57186f66b9713262643e0f440f5b9eb78154c155
Signed-off-by: Instrumental <jonathan.gathman@att.com>
diff --git a/auth/docker/.gitignore b/auth/docker/.gitignore
index f08acc7..a03737d 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 d744d69..0000000
--- 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 a5811e0..1855fae 100644
--- a/auth/docker/Dockerfile.config
+++ b/auth/docker/Dockerfile.config
@@ -7,7 +7,7 @@
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 121bd06..b8ef6d9 100644
--- a/auth/docker/Dockerfile.ms
+++ b/auth/docker/Dockerfile.ms
@@ -5,6 +5,8 @@
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 0000000..32ed348
--- /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 6802794..f734c62 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 0000000..e636795
--- /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 ec5cd5c..ba7a809 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 163272d..0bca9ef 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 7812979..761ae2a 100644
--- a/auth/docker/dpush.sh
+++ b/auth/docker/dpush.sh
@@ -12,7 +12,7 @@
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 a7378b7..c62adfc 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 ae6ed02..4c0a46f 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 4c8d442..c6e1cfe 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