Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o xtrace |
| 4 | |
| 5 | # pull_mariadb_image() - Pull MariaDB container image from a Docker Registry Hub |
| 6 | function pull_mariadb_image { |
| 7 | is_package_installed docker-ce || install_docker |
| 8 | docker login -u $nexus_username -p $nexus_password $nexus_docker_repo |
| 9 | docker pull $nexus_docker_repo/library/mariadb:10 |
| 10 | } |
| 11 | |
| 12 | # install_vid() - Download and configure Vid source code |
| 13 | function install_vid { |
| 14 | local src_folder=/opt/vid |
| 15 | clone_repo vid $src_folder |
| 16 | pull_openecomp_image vid |
| 17 | pull_mariadb_image |
| 18 | |
| 19 | docker rm -f vid-mariadb |
| 20 | docker rm -f vid-server |
| 21 | |
| 22 | 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 |
| 23 | 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 $nexus_docker_repo/openecomp/vid:$docker_version |
| 24 | } |
| 25 | |
| 26 | # init_vid() - Function that initialize Vid services |
| 27 | function init_vid { |
| 28 | install_vid |
| 29 | } |