blob: fc622c3c2843dac3a43ab9928ee7cf872af602dc [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
3set -o xtrace
4
Victor Moralesdd074802017-07-26 16:06:35 -05005source /var/onap/functions
Victor Moralesdd074802017-07-26 16:06:35 -05006
Victor Morales7ba76472017-08-23 15:19:36 -05007vid_src_folder=$git_src_folder/vid
Victor Morales89ce3212017-06-16 18:32:48 -05008
Victor Moralesdd074802017-07-26 16:06:35 -05009# clone_all_vid_repos() - Function that clones VID source code.
10function clone_all_vid_repos {
Victor Morales7ba76472017-08-23 15:19:36 -050011 clone_repo vid $vid_src_folder
12 clone_repo vid/asdcclient $vid_src_folder/asdcclient
Victor Moralesdd074802017-07-26 16:06:35 -050013}
14
15# compile_all_vid_repos() - Function that compiles VID source repo.
16function compile_all_vid_repos {
Victor Morales7ba76472017-08-23 15:19:36 -050017 compile_src $vid_src_folder/asdcclient
18 compile_src $vid_src_folder
19}
20
21# _build_vid_images() - Function that builds VID docker images
22function _build_vid_images {
23 if [[ "$compile_repo" != "True" ]]; then
24 compile_src $vid_src_folder
25 fi
26 build_docker_image $vid_src_folder/deliveries
27}
28
29# get_vid_images() - Function that retrieves VID docker images
30function get_vid_images {
31 if [[ "$build_image" == "True" ]]; then
32 _build_vid_images
33 else
34 pull_openecomp_image vid
35 fi
36 pull_docker_image mariadb:10
Victor Moralesdd074802017-07-26 16:06:35 -050037}
38
Victor Morales89ce3212017-06-16 18:32:48 -050039# install_vid() - Download and configure Vid source code
40function install_vid {
Victor Morales7ba76472017-08-23 15:19:36 -050041 vid_image=`docker images | grep vid | grep latest| awk '{print $1 ":" $2}'`
Victor Morales89ce3212017-06-16 18:32:48 -050042
43 docker rm -f vid-mariadb
44 docker rm -f vid-server
45
46 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
Victor Moralesdd074802017-07-26 16:06:35 -050047 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
Victor Morales89ce3212017-06-16 18:32:48 -050048}
49
50# init_vid() - Function that initialize Vid services
51function init_vid {
Victor Morales7ba76472017-08-23 15:19:36 -050052 clone_all_vid_repos
53 if [[ "$compile_repo" == "True" ]]; then
54 compile_all_vid_repos
55 fi
56
57 get_vid_images
Victor Morales89ce3212017-06-16 18:32:48 -050058 install_vid
59}