3 # ============LICENSE_START=======================================================
5 # ================================================================================
6 # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
7 # Modifications Copyright © 2018 Amdocs,Bell Canada
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END=========================================================
24 SDNC_HOME=${SDNC_HOME:-/opt/onap/ccsdk}
25 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
26 MYSQL_PASSWD=${MYSQL_ROOT_PASSWORD}
28 APPC_DB_USER=${APPC_DB_USER}
29 APPC_DB_PASSWD=${APPC_DB_PASSWD}
30 APPC_DB_DATABASE={{.Values.config.appcdb.dbName}}
31 SDNC_DB_DATABASE={{.Values.config.sdncdb.dbName}}
34 # Create tablespace and user account
35 mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} mysql <<-END
36 CREATE DATABASE ${APPC_DB_DATABASE};
37 CREATE USER '${APPC_DB_USER}'@'localhost' IDENTIFIED BY '${APPC_DB_PASSWD}';
38 CREATE USER '${APPC_DB_USER}'@'%' IDENTIFIED BY '${APPC_DB_PASSWD}';
39 GRANT ALL PRIVILEGES ON ${APPC_DB_DATABASE}.* TO '${APPC_DB_USER}'@'localhost' WITH GRANT OPTION;
40 GRANT ALL PRIVILEGES ON ${APPC_DB_DATABASE}.* TO '${APPC_DB_USER}'@'%' WITH GRANT OPTION;
44 if [ -f ${APPC_HOME}/data/appcctl.dump ]
46 mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} ${APPC_DB_DATABASE} < ${APPC_HOME}/data/appcctl.dump
49 if [ -f ${APPC_HOME}/data/sdnctl.dump ]
51 mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} ${SDNC_DB_DATABASE} < ${APPC_HOME}/data/sdnctl.dump
54 if [ -f ${APPC_HOME}/data/sqlData.dump ]
56 mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} ${SDNC_DB_DATABASE} < ${APPC_HOME}/data/sqlData.dump