aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot/aaf_install.sh9
-rw-r--r--boot/aaf_vm_init.sh57
2 files changed, 53 insertions, 13 deletions
diff --git a/boot/aaf_install.sh b/boot/aaf_install.sh
index 0378a4e7..ea80e47f 100644
--- a/boot/aaf_install.sh
+++ b/boot/aaf_install.sh
@@ -95,8 +95,13 @@ resolvconf -u
cd /opt
git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO
chmod +x /opt/authz/auth/auth-cass/docker/dinstall.sh
+chmod +x /opt/authz/auth/auth-cass/docker/backup/backup.sh
+chmod +x /opt/authz/auth/docker/dbuild.sh
chmod +x /opt/authz/auth/docker/drun.sh
-chmod +x /opt/authz/auth/docker/d.props
+chmod +x /opt/authz/auth/docker/dstart.sh
+chmod +x /opt/authz/auth/docker/dstop.sh
+# d.props is not a startable shell
+# chmod +x /opt/authz/auth/docker/d.props
#Update maven settings
cat > /usr/share/maven/conf/settings.xml << EOF
@@ -513,4 +518,4 @@ then
fi
cd /opt
-./aaf_vm_init.sh \ No newline at end of file
+./aaf_vm_init.sh
diff --git a/boot/aaf_vm_init.sh b/boot/aaf_vm_init.sh
index f3ca911e..ea64c3e5 100644
--- a/boot/aaf_vm_init.sh
+++ b/boot/aaf_vm_init.sh
@@ -4,25 +4,60 @@ NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt)
-LOCAL_IP=$(cat /opt/config/local_ip.txt)
-CASSANDRA_CONTAINER_NAME="aaf_cass"
+HOSTNAME=`hostname`
+FQDN=aaf.api.simpledemo.onap.org
+HOST_IP=$(cat /opt/config/dns_ip_addr.txt)
docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
cd /opt/authz
git pull
-cd /opt/authz/auth/auth-cass/docker
-./dinstall.sh
-sleep 2
+if [ "`docker container ls | grep aaf_cass`" = "" ]; then
+ # Cassandra Install
+ cd /opt/authz/auth/auth-cass/docker
+ # Phase 1
+ ./dinstall.sh
+ echo "Waiting for Cassandra to startup"
+ sleep 15
+ # Phase 2
+ if [ "`docker container ls | grep aaf_cass`" = "" ]; then
+ echo "Error on Cassandra install"
+ exit
+ else
+ ./dinstall.sh
+ fi
+fi
+
+CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4`
+CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP
-#Update configuration file
-CASSANDRA_CONTAINER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CASSANDRA_CONTAINER_NAME)
sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY="$NEXUS_DOCKER_REPO"/g" /opt/authz/auth/docker/d.props
-sed -i "s/VERSION=.*/VERSION="$DOCKER_IMAGE_VERSION"/g" /opt/authz/auth/docker/d.props
-sed -i "s/HOSTNAME=.*/HOSTNAME="$(hostname)"/g" /opt/authz/auth/docker/d.props
-sed -i "s/HOST_IP=.*/HOST_IP="$LOCAL_IP"/g" /opt/authz/auth/docker/d.props
-sed -i "s/CASS_HOST=cass.aaf.osaaf.org:.*/CASS_HOST=cass.aaf.osaaf.org:"$CASSANDRA_CONTAINER_IP"/g" /opt/authz/auth/docker/d.props
+#sed -i "s/VERSION=.*/VERSION="$DOCKER_IMAGE_VERSION"/g" /opt/authz/auth/docker/d.props
+sed -i "s/HOSTNAME=.*/HOSTNAME="$HOSTNAME"/g" /opt/authz/auth/docker/d.props
+sed -i "s/HOST_IP=.*/HOST_IP="$HOST_IP"/g" /opt/authz/auth/docker/d.props
+sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" /opt/authz/auth/docker/d.props
+
+if [ ! -e "/opt/app/osaaf/etc" ]; then
+ # Nothing installed, install sample
+ mkdir -p /opt/app/osaaf/logs
+ cd /opt/app/osaaf/logs
+ mkdir fs cm gui hello locate oauth service
+ cd /opt
+ cp -Rf /opt/authz/auth/sample/* /opt/app/osaaf
+fi
+# Set Location information
+# Need new Deployment system properties
+CADI_LATITUDE=37.781
+CADI_LONGITUDE=-122.261
+
+CADI_TRUST_MASKS="${HOST_IP%\.[0-9]*}\\/24,${CASS_IP%\.[0-9]*}\\/24"
+sed -i "s/cadi_latitude=.*/cadi_latitude="$CADI_LATITUDE"/g" /opt/app/osaaf/local/org.osaaf.location.props
+sed -i "s/cadi_longitude=.*/cadi_longitude="$CADI_LONGITUDE"/g" /opt/app/osaaf/local/org.osaaf.location.props
+sed -i "s/cadi_registration_hostname=.*/cadi_registration_hostname="$FQDN"/g" /opt/app/osaaf/local/org.osaaf.location.props
+sed -i "s/cadi_trust_masks=.*/cadi_trust_masks="$CADI_TRUST_MASKS"/g" /opt/app/osaaf/local/org.osaaf.location.props
cd /opt/authz/auth/docker
+./dbuild.sh
+sleep 5
./drun.sh \ No newline at end of file