Add vnfres docker build files
[vfc/gvnfm/vnfres.git] / res / docker / instance_init.sh
1 #!/bin/bash
2
3 function install_python_libs {
4     cd /service/vfc/gvnfm/vnfres/res/
5     pip install -r requirements.txt
6 }
7
8 function start_redis_server {
9     redis-server &
10 }
11
12 function start_mysql {
13     su mysql -c /usr/bin/mysqld_safe &
14     service mysql start
15     # Wait for mysql to initialize; Set mysql root password
16     for i in {1..10}; do
17         sleep $i
18         bash /usr/bin/mysqladmin -u root password $MYSQL_ROOT_PASSWORD &> /dev/null && break
19     done
20 }
21
22 function create_database {
23     cd /service/vfc/gvnfm/vnfres/res/assembly/bin
24     bash initDB.sh root $MYSQL_ROOT_PASSWORD 3306 127.0.0.1
25     cd /service
26 }
27
28 install_python_libs
29 start_redis_server
30 start_mysql
31 create_database