aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/lib/vid
blob: 83b530995126a03b232186746f294cb87bdf91c8 (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
#!/bin/bash

set -o xtrace

source /var/onap/functions

vid_src_folder=$git_src_folder/vid

# clone_all_vid_repos() - Function that clones VID source code.
function clone_all_vid_repos {
    clone_repo vid $vid_src_folder
    clone_repo vid/asdcclient $vid_src_folder/asdcclient
}

# compile_all_vid_repos() - Function that compiles VID source repo.
function compile_all_vid_repos {
    compile_src $vid_src_folder/asdcclient
    compile_src $vid_src_folder
}

# _build_vid_images() - Function that builds VID docker images
function _build_vid_images {
    if [[ "$compile_repo" != "True" ]]; then
        compile_src $vid_src_folder
    fi
    build_docker_image $vid_src_folder/deliveries
}

# get_vid_images() - Function that retrieves VID docker images
function get_vid_images {
    if [[ "$build_image" == "True" ]]; then
        _build_vid_images
    else
        pull_openecomp_image vid
    fi
    pull_docker_image mariadb:10
}

# install_vid() - Download and configure Vid source code
function install_vid {
    vid_image=`docker images | grep vid | grep latest| awk '{print $1 ":" $2}'`

    docker rm -f vid-mariadb
    docker rm -f vid-server

    docker run --name vid-mariadb -e MYSQL_DATABASE=vid_openecomp -e MYSQL_USER=vidadmin -e MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -e MYSQL_ROOT_PASSWORD=LF+tp_1WqgSY -v /opt/vid/lf_config/vid-my.cnf:/etc/mysql/my.cnf -v /opt/vid/lf_config/vid-pre-init.sql:/docker-entrypoint-initdb.d/vid-pre-init.sql -v /var/lib/mysql -d mariadb:10
    docker run -e VID_MYSQL_DBNAME=vid_openecomp -e VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U --name vid-server -p 8080:8080 --link vid-mariadb:vid-mariadb-docker-instance -d $vid_image
}

# init_vid() - Function that initialize Vid services
function init_vid {
    if [[ "$clone_repo" == "True" ]]; then
        clone_all_vid_repos
        if [[ "$compile_repo" == "True" ]]; then
            compile_all_vid_repos
        fi
    fi

    if [[ "$skip_get_images" == "False" ]]; then
        get_vid_images
        if [[ "$skip_install" == "False" ]]; then
            install_vid
        fi
    fi
}