blob: 8bd39b7e9436666ae2ffc59f4825093664925ac9 [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
3set -o xtrace
4
5source /var/onap/functions
Victor Moralesdd074802017-07-26 16:06:35 -05006source /var/onap/asserts
Victor Morales89ce3212017-06-16 18:32:48 -05007
8# install_mariadb() - Pull and create a MariaDB container
9function install_mariadb {
10 is_package_installed docker-ce || install_docker
11 docker pull mariadb
12 docker create --name data_vol_portal -v /var/lib/mysql mariadb
13}
14
15# install_portal() - Function that pulls and install the source code of Portal
16function install_portal {
17 local src_folder=/opt/portal
18 clone_repo portal $src_folder
Victor Moralesdd074802017-07-26 16:06:35 -050019 clone_repo portal/sdk $src_folder/sdk
Victor Morales89ce3212017-06-16 18:32:48 -050020 install_docker
21 docker rm -f ecompdb_portal
22 docker rm -f 1610-1
Victor Moralesdd074802017-07-26 16:06:35 -050023 pushd $src_folder/deliveries
Victor Morales89ce3212017-06-16 18:32:48 -050024 if [[ "$build_image" == "True" ]]; then
Victor Morales89ce3212017-06-16 18:32:48 -050025 install_maven
26
27 clone_repo ecompsdkos $src_folder/ecompsdkos
28 clone_repo "ui/dmaapbc" $src_folder/dmaapbc
Victor Morales89ce3212017-06-16 18:32:48 -050029 chmod +x *.sh
Victor Moralesdd074802017-07-26 16:06:35 -050030 export MVN=$(which mvn)
31 export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml
32 export SETTINGS_FILE=$HOME/.m2/settings.xml
Victor Morales89ce3212017-06-16 18:32:48 -050033 bash run.sh
Victor Moralesdd074802017-07-26 16:06:35 -050034 compile_src $src_folder/ecomp-portal-widget-ms
35 build_docker_image $src_folder/ecomp-portal-widget-ms
Victor Morales89ce3212017-06-16 18:32:48 -050036 else
37 pull_openecomp_image portaldb ecompdb:portal
38 pull_openecomp_image portalapps ep:1610-1
39
Victor Morales89ce3212017-06-16 18:32:48 -050040 fi
Victor Moralesdd074802017-07-26 16:06:35 -050041 for image in ecompdb:portal ep:1610-1; do
42 asserts_image $image
43 done
44
45 chmod +x new_start.sh
46 chmod +x new_stop.sh
47 chmod +x dbstart.sh
48 mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
49 install_package unzip
50 unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/
51
52 bash dbstart.sh
53 bash new_start.sh
54
55 sleep 180
56
57 if [ ! -e /opt/config/boot.txt ]; then
Victor Moralesdd074802017-07-26 16:06:35 -050058 install_package mysql-client
59 mysql -u root -p'Aa123456' -h $IP_ADDRESS < Apps_Users_OnBoarding_Script.sql
60 echo "yes" > /opt/config/boot.txt
61 fi
62 popd
Victor Morales89ce3212017-06-16 18:32:48 -050063}
64
65# init_portal() - Function that initialize Portal services
66function init_portal {
67 install_mariadb
68 install_portal
69}