blob: 902c45540732ccf8656efc1688a8714ddca61d28 [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
6source /var/onap/asserts
7
8src_folder=/opt/vid
9
Victor Morales89ce3212017-06-16 18:32:48 -050010# pull_mariadb_image() - Pull MariaDB container image from a Docker Registry Hub
11function pull_mariadb_image {
Victor Moralesdd074802017-07-26 16:06:35 -050012 docker_openecomp_login
Victor Morales89ce3212017-06-16 18:32:48 -050013 docker pull $nexus_docker_repo/library/mariadb:10
14}
15
Victor Moralesdd074802017-07-26 16:06:35 -050016# clone_all_vid_repos() - Function that clones VID source code.
17function clone_all_vid_repos {
18 clone_repo vid $src_folder
19 clone_repo vid/asdcclient $src_folder/asdcclient
20}
21
22# compile_all_vid_repos() - Function that compiles VID source repo.
23function compile_all_vid_repos {
24 compile_src $src_folder
25 compile_src $src_folder/asdcclient
26}
27
Victor Morales89ce3212017-06-16 18:32:48 -050028# install_vid() - Download and configure Vid source code
29function install_vid {
Victor Moralesdd074802017-07-26 16:06:35 -050030 local vid_image=openecomp/vid
31
32 clone_all_vid_repos
33 if [[ "$compile_repo" == "True" ]]; then
34 compile_all_vid_repos
35 fi
36
37 if [[ "$build_image" == "True" ]]; then
38 compile_src $src_folder
39 build_docker_image $src_folder/deliveries
40 asserts_image $vid_image
41 vid_image=`docker images | grep vid | grep latest| awk '{print $1 ":" $2}'`
42 else
43 pull_openecomp_image vid
44 vid_image=$nexus_docker_repo/$vid_image:$docker_version
45 fi
Victor Morales89ce3212017-06-16 18:32:48 -050046 pull_mariadb_image
47
48 docker rm -f vid-mariadb
49 docker rm -f vid-server
50
51 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 -050052 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 -050053}
54
55# init_vid() - Function that initialize Vid services
56function init_vid {
57 install_vid
58}