fc5f905df7a004b4fbd567c03ccf6faaf8dffc84
[oom.git] / kubernetes / so / components / so-mariadb / resources / config / docker-entrypoint-initdb.d / 01-create-camundabpmn.sh
1 #!/bin/sh
2 {{/*
3 #
4 # ============LICENSE_START==========================================
5 # ===================================================================
6 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
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 # ECOMP and OpenECOMP are trademarks
22 # and service marks of AT&T Intellectual Property.
23 #
24 */}}
25
26 echo "Creating camundabpmn database . . ." 1>/tmp/mariadb-camundabpmn.log 2>&1
27
28 mysql -uroot -p$MYSQL_ROOT_PASSWORD << EOF || exit 1
29 DROP DATABASE IF EXISTS camundabpmn;
30 CREATE DATABASE camundabpmn;
31 DROP USER IF EXISTS '${CAMUNDA_DB_USER}';
32 CREATE USER '${CAMUNDA_DB_USER}';
33 GRANT ALL on camundabpmn.* to '${CAMUNDA_DB_USER}' identified by '${CAMUNDA_DB_PASSWORD}' with GRANT OPTION;
34 FLUSH PRIVILEGES;
35 EOF
36
37 cd /docker-entrypoint-initdb.d/db-sql-scripts
38
39 mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < mariadb_engine_7.14.0.sql || exit 1
40 mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < mariadb_identity_7.14.0.sql || exit 1
41
42 echo "Created camundabpmn database . . ." 1>>/tmp/mariadb-camundabpmn.log 2>&1