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 |
| 6 | source /var/onap/asserts |
| 7 | |
| 8 | src_folder=/opt/vid |
| 9 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 10 | # pull_mariadb_image() - Pull MariaDB container image from a Docker Registry Hub |
| 11 | function pull_mariadb_image { |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 12 | docker_openecomp_login |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 13 | docker pull $nexus_docker_repo/library/mariadb:10 |
| 14 | } |
| 15 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 16 | # clone_all_vid_repos() - Function that clones VID source code. |
| 17 | function 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. |
| 23 | function compile_all_vid_repos { |
| 24 | compile_src $src_folder |
| 25 | compile_src $src_folder/asdcclient |
| 26 | } |
| 27 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 28 | # install_vid() - Download and configure Vid source code |
| 29 | function install_vid { |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 30 | 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 Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 46 | 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 Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 52 | 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] | 53 | } |
| 54 | |
| 55 | # init_vid() - Function that initialize Vid services |
| 56 | function init_vid { |
| 57 | install_vid |
| 58 | } |