aboutsummaryrefslogtreecommitdiffstats
path: root/volumes
diff options
context:
space:
mode:
authorRamesh Parthasarathy <rp6768@att.com>2018-09-24 15:20:24 -0700
committerRamesh Parthasarathy <rp6768@att.com>2018-09-25 14:57:46 +0000
commitd93db5e52f19ca27a62953a45d3b0b3ecbf7a27e (patch)
treee9e052a2251b134b0f4c5de7b794c2b2fa0f5be8 /volumes
parentc32c60fd80827bae075797c5f4f48640a523ce4b (diff)
Create additional users with SO-MariaDB
Create a regular and admin user with SO-MariaDB to be used by the containers Change-Id: I8c32496816adf6a1845eb392cbe2b06e246129ad Issue-ID: SO-1086 Signed-off-by: Ramesh Parthasarathy(rp6768)<rp6768@att.com>
Diffstat (limited to 'volumes')
-rw-r--r--volumes/mariadb/docker-entrypoint-initdb.d/04-create-so-user.sh34
-rw-r--r--volumes/mariadb/docker-entrypoint-initdb.d/05-create-so-admin.sh34
2 files changed, 68 insertions, 0 deletions
diff --git a/volumes/mariadb/docker-entrypoint-initdb.d/04-create-so-user.sh b/volumes/mariadb/docker-entrypoint-initdb.d/04-create-so-user.sh
new file mode 100644
index 0000000..d6d1c20
--- /dev/null
+++ b/volumes/mariadb/docker-entrypoint-initdb.d/04-create-so-user.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+#
+# ECOMP and OpenECOMP are trademarks
+# and service marks of AT&T Intellectual Property.
+#
+
+echo "Creating so user . . ."
+
+mysql -uroot -p$MYSQL_ROOT_PASSWORD << 'EOF' || exit 1
+DELETE FROM mysql.user WHERE User='so_user';
+CREATE USER 'so_user';
+GRANT USAGE ON *.* TO 'so_user'@'%' IDENTIFIED BY 'so_User123';
+GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, SHOW VIEW ON `requestdb`.* TO 'so_user'@'%';
+GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, SHOW VIEW ON `catalogdb`.* TO 'so_user'@'%';
+GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, SHOW VIEW ON `camundabpmn`.* TO 'so_user'@'%';
+FLUSH PRIVILEGES;
+EOF
diff --git a/volumes/mariadb/docker-entrypoint-initdb.d/05-create-so-admin.sh b/volumes/mariadb/docker-entrypoint-initdb.d/05-create-so-admin.sh
new file mode 100644
index 0000000..6a42d97
--- /dev/null
+++ b/volumes/mariadb/docker-entrypoint-initdb.d/05-create-so-admin.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+#
+# ECOMP and OpenECOMP are trademarks
+# and service marks of AT&T Intellectual Property.
+#
+
+echo "Creating so admin user . . ."
+
+mysql -uroot -p$MYSQL_ROOT_PASSWORD << 'EOF' || exit 1
+DELETE FROM mysql.user WHERE User='so_admin';
+CREATE USER 'so_admin';
+GRANT USAGE ON *.* TO 'so_admin'@'%' IDENTIFIED BY 'so_Admin123';
+GRANT ALL PRIVILEGES ON `camundabpmn`.* TO 'so_admin'@'%' WITH GRANT OPTION;
+GRANT ALL PRIVILEGES ON `requestdb`.* TO 'so_admin'@'%' WITH GRANT OPTION;
+GRANT ALL PRIVILEGES ON `catalogdb`.* TO 'so_admin'@'%' WITH GRANT OPTION;
+FLUSH PRIVILEGES;
+EOF