Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o xtrace |
| 4 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 5 | source /var/onap/functions |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 6 | |
Victor Morales | 7ba7647 | 2017-08-23 15:19:36 -0500 | [diff] [blame] | 7 | vid_src_folder=$git_src_folder/vid |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 8 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 9 | # clone_all_vid_repos() - Function that clones VID source code. |
| 10 | function clone_all_vid_repos { |
Victor Morales | 7ba7647 | 2017-08-23 15:19:36 -0500 | [diff] [blame] | 11 | clone_repo vid $vid_src_folder |
| 12 | clone_repo vid/asdcclient $vid_src_folder/asdcclient |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 13 | } |
| 14 | |
| 15 | # compile_all_vid_repos() - Function that compiles VID source repo. |
| 16 | function compile_all_vid_repos { |
Victor Morales | 7ba7647 | 2017-08-23 15:19:36 -0500 | [diff] [blame] | 17 | compile_src $vid_src_folder/asdcclient |
| 18 | compile_src $vid_src_folder |
| 19 | } |
| 20 | |
| 21 | # _build_vid_images() - Function that builds VID docker images |
| 22 | function _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 |
| 30 | function 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 Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 37 | } |
| 38 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 39 | # install_vid() - Download and configure Vid source code |
| 40 | function install_vid { |
Victor Morales | 7ba7647 | 2017-08-23 15:19:36 -0500 | [diff] [blame] | 41 | vid_image=`docker images | grep vid | grep latest| awk '{print $1 ":" $2}'` |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 42 | |
| 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 Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 47 | 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 Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | # init_vid() - Function that initialize Vid services |
| 51 | function init_vid { |
Victor Morales | 7ba7647 | 2017-08-23 15:19:36 -0500 | [diff] [blame] | 52 | clone_all_vid_repos |
| 53 | if [[ "$compile_repo" == "True" ]]; then |
| 54 | compile_all_vid_repos |
| 55 | fi |
| 56 | |
| 57 | get_vid_images |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 58 | install_vid |
| 59 | } |