Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o xtrace |
| 4 | |
| 5 | source /var/onap/functions |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 6 | source /var/onap/asserts |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 7 | |
| 8 | # install_mariadb() - Pull and create a MariaDB container |
| 9 | function 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 |
| 16 | function install_portal { |
| 17 | local src_folder=/opt/portal |
| 18 | clone_repo portal $src_folder |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 19 | clone_repo portal/sdk $src_folder/sdk |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 20 | install_docker |
| 21 | docker rm -f ecompdb_portal |
| 22 | docker rm -f 1610-1 |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 23 | pushd $src_folder/deliveries |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 24 | if [[ "$build_image" == "True" ]]; then |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 25 | install_maven |
| 26 | |
| 27 | clone_repo ecompsdkos $src_folder/ecompsdkos |
| 28 | clone_repo "ui/dmaapbc" $src_folder/dmaapbc |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 29 | chmod +x *.sh |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 30 | export MVN=$(which mvn) |
| 31 | export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml |
| 32 | export SETTINGS_FILE=$HOME/.m2/settings.xml |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 33 | bash run.sh |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 34 | compile_src $src_folder/ecomp-portal-widget-ms |
| 35 | build_docker_image $src_folder/ecomp-portal-widget-ms |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 36 | else |
| 37 | pull_openecomp_image portaldb ecompdb:portal |
| 38 | pull_openecomp_image portalapps ep:1610-1 |
| 39 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 40 | fi |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 41 | 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 |
| 58 | IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) |
| 59 | install_package mysql-client |
| 60 | mysql -u root -p'Aa123456' -h $IP_ADDRESS < Apps_Users_OnBoarding_Script.sql |
| 61 | echo "yes" > /opt/config/boot.txt |
| 62 | fi |
| 63 | popd |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | # init_portal() - Function that initialize Portal services |
| 67 | function init_portal { |
| 68 | install_mariadb |
| 69 | install_portal |
| 70 | } |