Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 3 | source /var/onap/functions |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 4 | |
Victor Morales | 7ba7647 | 2017-08-23 15:19:36 -0500 | [diff] [blame] | 5 | # _build_vid_images() - Function that builds VID docker images |
| 6 | function _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 |
| 14 | function 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 Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 21 | } |
| 22 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 23 | # install_vid() - Download and configure Vid source code |
| 24 | function install_vid { |
Victor Morales | 7ba7647 | 2017-08-23 15:19:36 -0500 | [diff] [blame] | 25 | vid_image=`docker images | grep vid | grep latest| awk '{print $1 ":" $2}'` |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 26 | |
| 27 | docker rm -f vid-mariadb |
| 28 | docker rm -f vid-server |
| 29 | |
Victor Morales | 9d205bc | 2017-12-01 17:52:07 -0800 | [diff] [blame] | 30 | 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 Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | # init_vid() - Function that initialize Vid services |
| 35 | function init_vid { |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 36 | if [[ "$clone_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 37 | clone_repos "vid" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 38 | if [[ "$compile_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 39 | compile_repos "vid" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 40 | fi |
Victor Morales | 7ba7647 | 2017-08-23 15:19:36 -0500 | [diff] [blame] | 41 | fi |
| 42 | |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 43 | if [[ "$skip_get_images" == "False" ]]; then |
| 44 | get_vid_images |
| 45 | if [[ "$skip_install" == "False" ]]; then |
| 46 | install_vid |
| 47 | fi |
| 48 | fi |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 49 | } |