diff options
-rw-r--r-- | mgr/docker/Dockerfile | 7 | ||||
-rw-r--r-- | mgr/docker/createdb.sql | 15 | ||||
-rw-r--r-- | mgr/docker/createobj.sql | 12 | ||||
-rwxr-xr-x | mgr/docker/instance_init.sh | 5 |
4 files changed, 9 insertions, 30 deletions
diff --git a/mgr/docker/Dockerfile b/mgr/docker/Dockerfile index 45c1545..c59b229 100644 --- a/mgr/docker/Dockerfile +++ b/mgr/docker/Dockerfile @@ -34,6 +34,13 @@ RUN wget -q -O vfc-gvnfm-vnfmgr.zip 'https://nexus.onap.org/service/local/artifa unzip vfc-gvnfm-vnfmgr.zip && \ rm -rf vfc-gvnfm-vnfmgr.zip +# get db scripts from nexus +RUN wget -q -O vfc-gvnfm-vnfres-res.zip 'https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.vfc.gvnfm.vnfres&a=vfc-gvnfm-vnfres-res&v=LATEST&e=zip' && \ + unzip vfc-gvnfm-vnfres-res.zip vfc/gvnfm/vnfres/res/assembly/*.* && \ + mv ./vfc/gvnfm/vnfres/res/assembly/bin ./bin && \ + mv ./vfc/gvnfm/vnfres/res/assembly/dbscripts ./dbscripts && \ + rm -rf vfc-gvnfm-vnfres-res.zip + RUN sed -i "s|bind-address.*|# bind-address = 127.0.0.1|" /etc/mysql/my.cnf WORKDIR /service/vfc/gvnfm/vnfmgr/mgr diff --git a/mgr/docker/createdb.sql b/mgr/docker/createdb.sql deleted file mode 100644 index 41d2435..0000000 --- a/mgr/docker/createdb.sql +++ /dev/null @@ -1,15 +0,0 @@ -/******************drop old database and user***************************/ -use mysql; -drop database IF EXISTS gvnfm; -delete from user where User='gvnfm'; -FLUSH PRIVILEGES; - -/******************create new database and user***************************/ -create database gvnfm CHARACTER SET utf8; - -GRANT ALL PRIVILEGES ON gvnfm.* TO 'gvnfm'@'%' IDENTIFIED BY 'gvnfm' WITH GRANT OPTION; -GRANT ALL PRIVILEGES ON mysql.* TO 'gvnfm'@'%' IDENTIFIED BY 'gvnfm' WITH GRANT OPTION; - -GRANT ALL PRIVILEGES ON gvnfm.* TO 'gvnfm'@'localhost' IDENTIFIED BY 'gvnfm' WITH GRANT OPTION; -GRANT ALL PRIVILEGES ON mysql.* TO 'gvnfm'@'localhost' IDENTIFIED BY 'gvnfm' WITH GRANT OPTION; -FLUSH PRIVILEGES;
\ No newline at end of file diff --git a/mgr/docker/createobj.sql b/mgr/docker/createobj.sql deleted file mode 100644 index 71beee1..0000000 --- a/mgr/docker/createobj.sql +++ /dev/null @@ -1,12 +0,0 @@ -use gvnfm; - -CREATE TABLE `VNF_REG` ( - `ID` varchar(200) NOT NULL PRIMARY KEY, - `IP` varchar(200) NOT NULL, - `PORT` varchar(200) NOT NULL, - `USERNAME` varchar(255) NOT NULL, - `PASSWORD` varchar(255) NOT NULL -) -; - -COMMIT;
\ No newline at end of file diff --git a/mgr/docker/instance_init.sh b/mgr/docker/instance_init.sh index 0be5e8f..90f0810 100755 --- a/mgr/docker/instance_init.sh +++ b/mgr/docker/instance_init.sh @@ -10,9 +10,8 @@ function start_mysql { } function create_database { - cd /service/vfc/gvnfm/vnfmgr/mgr/docker - mysql -uroot -proot < createdb.sql - mysql -uroot -proot < createobj.sql + cd /service/bin + bash initDB.sh root $MYSQL_ROOT_PASSWORD 3306 127.0.0.1 cd /service } |