aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/lib/portal
blob: 6c8e7d0a91e3c3439b99fe80ef9e7f0526b07635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash

set -o xtrace

source /var/onap/functions
source /var/onap/asserts

# install_mariadb() - Pull and create a MariaDB container
function install_mariadb {
    is_package_installed docker-ce || install_docker
    docker pull mariadb
    docker create --name data_vol_portal -v /var/lib/mysql mariadb
}

# install_portal() - Function that pulls and install the source code of Portal
function install_portal {
    local src_folder=/opt/portal
    clone_repo portal $src_folder
    clone_repo portal/sdk $src_folder/sdk
    install_docker
    docker rm -f ecompdb_portal
    docker rm -f 1610-1
    pushd $src_folder/deliveries
    if [[ "$build_image" == "True" ]]; then
        install_maven

        clone_repo ecompsdkos $src_folder/ecompsdkos
        clone_repo "ui/dmaapbc" $src_folder/dmaapbc
        chmod +x *.sh
        export MVN=$(which mvn)
        export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml
        export SETTINGS_FILE=$HOME/.m2/settings.xml
        bash run.sh
        compile_src $src_folder/ecomp-portal-widget-ms
        build_docker_image $src_folder/ecomp-portal-widget-ms
    else
        pull_openecomp_image portaldb ecompdb:portal
        pull_openecomp_image portalapps ep:1610-1

    fi
    for image in ecompdb:portal ep:1610-1; do
        asserts_image $image
    done

    chmod +x new_start.sh
    chmod +x new_stop.sh
    chmod +x dbstart.sh
    mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
    install_package unzip
    unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/

    bash dbstart.sh
    bash new_start.sh

    sleep 180

    if [ ! -e /opt/config/boot.txt ]; then
        IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
        install_package mysql-client
        mysql -u root -p'Aa123456' -h $IP_ADDRESS < Apps_Users_OnBoarding_Script.sql
        echo "yes" > /opt/config/boot.txt
    fi
    popd
}

# init_portal() - Function that initialize Portal services
function init_portal {
    install_mariadb
    install_portal
}