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