blob: f5ca9d29344afd5ee975e010ace754278dd5df84 [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 -05005# _build_vid_images() - Function that builds VID docker images
6function _build_vid_images {
7 if [[ "$compile_repo" != "True" ]]; then
8 compile_src $vid_src_folder
9 fi
10 build_docker_image $vid_src_folder/deliveries
11}
12
13# get_vid_images() - Function that retrieves VID docker images
14function get_vid_images {
15 if [[ "$build_image" == "True" ]]; then
16 _build_vid_images
17 else
18 pull_openecomp_image vid
19 fi
20 pull_docker_image mariadb:10
Victor Moralesdd074802017-07-26 16:06:35 -050021}
22
Victor Morales89ce3212017-06-16 18:32:48 -050023# install_vid() - Download and configure Vid source code
24function install_vid {
Victor Morales7ba76472017-08-23 15:19:36 -050025 vid_image=`docker images | grep vid | grep latest| awk '{print $1 ":" $2}'`
Victor Morales89ce3212017-06-16 18:32:48 -050026
27 docker rm -f vid-mariadb
28 docker rm -f vid-server
29
Victor Morales9d205bc2017-12-01 17:52:07 -080030 run_docker_image --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
31 run_docker_image -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 -050032}
33
34# init_vid() - Function that initialize Vid services
35function init_vid {
Idan Amit1690e082017-08-20 08:58:14 +030036 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080037 clone_repos "vid"
Idan Amit1690e082017-08-20 08:58:14 +030038 if [[ "$compile_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080039 compile_repos "vid"
Idan Amit1690e082017-08-20 08:58:14 +030040 fi
Victor Morales7ba76472017-08-23 15:19:36 -050041 fi
42
Victor Morales6a919972017-09-28 18:29:54 -070043 if [[ "$skip_get_images" == "False" ]]; then
44 get_vid_images
45 if [[ "$skip_install" == "False" ]]; then
46 install_vid
47 fi
48 fi
Victor Morales89ce3212017-06-16 18:32:48 -050049}