blob: 6a358bf97541cfdc65d9c02c24a4352cacc1e36f [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
Victor Moralesdd074802017-07-26 16:06:35 -05003source /var/onap/functions
Victor Moralesdd074802017-07-26 16:06:35 -05004
Victor Morales7ba76472017-08-23 15:19:36 -05005vid_src_folder=$git_src_folder/vid
Victor Morales21404d72017-10-20 13:18:26 -07006vid_repos=("vid" "vid/asdcclient")
Victor Morales89ce3212017-06-16 18:32:48 -05007
Victor Morales7ba76472017-08-23 15:19:36 -05008# _build_vid_images() - Function that builds VID docker images
9function _build_vid_images {
10 if [[ "$compile_repo" != "True" ]]; then
11 compile_src $vid_src_folder
12 fi
13 build_docker_image $vid_src_folder/deliveries
14}
15
16# get_vid_images() - Function that retrieves VID docker images
17function get_vid_images {
18 if [[ "$build_image" == "True" ]]; then
19 _build_vid_images
20 else
21 pull_openecomp_image vid
22 fi
23 pull_docker_image mariadb:10
Victor Moralesdd074802017-07-26 16:06:35 -050024}
25
Victor Morales89ce3212017-06-16 18:32:48 -050026# install_vid() - Download and configure Vid source code
27function install_vid {
Victor Morales7ba76472017-08-23 15:19:36 -050028 vid_image=`docker images | grep vid | grep latest| awk '{print $1 ":" $2}'`
Victor Morales89ce3212017-06-16 18:32:48 -050029
30 docker rm -f vid-mariadb
31 docker rm -f vid-server
32
33 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 -050034 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 -050035}
36
37# init_vid() - Function that initialize Vid services
38function init_vid {
Idan Amit1690e082017-08-20 08:58:14 +030039 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080040 clone_repos "vid"
Idan Amit1690e082017-08-20 08:58:14 +030041 if [[ "$compile_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080042 compile_repos "vid"
Idan Amit1690e082017-08-20 08:58:14 +030043 fi
Victor Morales7ba76472017-08-23 15:19:36 -050044 fi
45
Victor Morales6a919972017-09-28 18:29:54 -070046 if [[ "$skip_get_images" == "False" ]]; then
47 get_vid_images
48 if [[ "$skip_install" == "False" ]]; then
49 install_vid
50 fi
51 fi
Victor Morales89ce3212017-06-16 18:32:48 -050052}