From 7ae05a4cc53bf3298090ade8091485ce2388af1f Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Tue, 22 Aug 2017 14:39:00 -0500 Subject: Fixed Setup Titan AAI process The way to configure properties files was wrong causing problems during the DB creation. This change files that function as well as others related with that function. Change-Id: I5cc637e170b64e15fff5de4cb04bdcbd2506ea87 Signed-off-by: Victor Morales Issue-Id: INT-18 --- bootstrap/vagrant-onap/lib/aai | 26 ++++++++++++++++---------- bootstrap/vagrant-onap/lib/commons | 21 +++++++++++++++++++++ bootstrap/vagrant-onap/lib/functions | 18 +++++++++--------- 3 files changed, 46 insertions(+), 19 deletions(-) (limited to 'bootstrap/vagrant-onap/lib') diff --git a/bootstrap/vagrant-onap/lib/aai b/bootstrap/vagrant-onap/lib/aai index cbf5c5f7d..faf916d9b 100755 --- a/bootstrap/vagrant-onap/lib/aai +++ b/bootstrap/vagrant-onap/lib/aai @@ -33,14 +33,18 @@ function install_hadoop { # install_haproxy() - Function that install HAProxy function install_haproxy { + if is_package_installed haproxy; then + return + fi + install_package software-properties-common + add-apt-repository -y ppa:vbernat/haproxy-1.7 install_package haproxy - sed -i "s|ENABLED=0|ENABLED=1|g" /etc/default/haproxy -# cp /var/onap/files/haproxy.cfg /etc/haproxy/ + cp /var/onap/files/haproxy.cfg /etc/haproxy/ cp /var/onap/files/aai.pem /etc/ssl/private/ chmod 640 /etc/ssl/private/aai.pem chown root:ssl-cert /etc/ssl/private/aai.pem mkdir /usr/local/etc/haproxy - echo "127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org" >> /etc/hosts + #echo "127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org" >> /etc/hosts service haproxy restart } @@ -66,26 +70,28 @@ function compile_aai_repos { # setup_titan() - Function that configures AAI services to connect to Hadoop Titan function setup_titan { - local $subdirectory=bundleconfig-local/etc/appprops + local subdirectory="bundleconfig-local/etc/appprops" install_python_package crudini - for dirc in resources/aai-resources traversal/aai-travers; do + for dirc in resources/aai-resources traversal/aai-traversal; do for file in titan-cached.properties titan-realtime.properties; do - crudini --set --existing $aai_src_folder/$dirc/$subdirectory/$file "" storage.backend cassandra - crudini --set --existing $aai_src_folder/$dirc/$subdirectory/$file "" storage.hostname localhost + crudini --set "$aai_src_folder/$dirc/$subdirectory/$file" "" "storage.backend" "cassandra" + crudini --set "$aai_src_folder/$dirc/$subdirectory/$file" "" "storage.hostname" "localhost" done done - # Addthe schema to the local isntance + # Add the schema to the local isntance + compile_src $aai_src_folder/resources/aai-resources/ + uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless pushd $aai_src_folder - install_java java -DAJSC_HOME=$aai_src_folder/resources/aai-resources -DBUNDLECONFIG_DIR="bundleconfig-local" -cp aai-common/aai-core/target/aai-core-1.1.0-SNAPSHOT.jar:resources/aai-resources/target/aai-resources.jar:resources/aai-resources/target/userjars/* org.openecomp.aai.dbgen.GenTester popd } # start_aai_microservices() - Function that starts AAI microservices function start_aai_microservices { - MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n" + install_maven + export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n" for svc in resources traversal; do pushd $aai_src_folder/resources mvn -P runAjsc diff --git a/bootstrap/vagrant-onap/lib/commons b/bootstrap/vagrant-onap/lib/commons index 019eeb5c2..26e2cc26a 100755 --- a/bootstrap/vagrant-onap/lib/commons +++ b/bootstrap/vagrant-onap/lib/commons @@ -31,6 +31,13 @@ function is_package_installed { dpkg -s "$@" > /dev/null 2> /dev/null } +# install_packages() - Install a list of packages +function install_packages { + local package=$@ + update_repos + apt-get install -y -qq $package +} + # install_package() - Install specific package if doesn't exist function install_package { local package=$1 @@ -39,3 +46,17 @@ function install_package { apt-get install -y -qq $package fi } + +# uninstall_packages() - Uninstall a list of packages +function uninstall_packages { + local packages=$@ + apt-get purge -y -qq $packages +} + +# uninstall_package() - Uninstall specific package if exists +function uninstall_package { + local package=$1 + if is_package_installed $package; then + apt-get purge -y -qq $package + fi +} diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions index 709d7ebc0..16e774178 100755 --- a/bootstrap/vagrant-onap/lib/functions +++ b/bootstrap/vagrant-onap/lib/functions @@ -58,15 +58,12 @@ function clone_repo { # install_dev_tools() - Install basic dependencies function install_dev_tools { - install_package apt-transport-https - install_package ca-certificates - install_package curl + install_packages apt-transport-https ca-certificates curl } # _install_bind() - Install bind utils function _install_bind { - install_package bind9 - install_package bind9utils + install_packages bind9 bind9utils } # install_java() - Install java binaries @@ -76,6 +73,10 @@ function install_java { fi install_package software-properties-common add-apt-repository -y ppa:openjdk-r/ppa + + # Remove Java 7 + uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless + install_package openjdk-8-jdk # ca-certificates-java is not a dependency in the Oracle JDK/JRE so this must be explicitly installed. /var/lib/dpkg/info/ca-certificates-java.postinst configure @@ -91,8 +92,8 @@ function install_maven { add-apt-repository -y ppa:andrei-pozolotin/maven3 install_package maven3 - # Force Maven3 to use jdk8 - apt-get purge openjdk-7-jdk -y + # Remove Java 7 + uninstall_package openjdk-7-jdk _configure_maven } @@ -124,8 +125,7 @@ function install_nodejs { # install_python() - Install Python 2.7 and other tools necessary for development. function install_python { - install_package python2.7 - install_package python-dev + install_packages python2.7 python-dev } # _install_pip() - Install Python Package Manager -- cgit 1.2.3-korg