aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common/postgres-init/resources/config
diff options
context:
space:
mode:
authorAbdelmuhaimen Seaudi <abdelmuhaimen.seaudi@orange.com>2021-09-23 21:11:44 +0000
committerAbdelmuhaimen Seaudi <abdelmuhaimen.seaudi@orange.com>2021-10-12 16:48:05 +0000
commit988aeedf9344fefb417af0d8377666b711eb80ce (patch)
tree00c0aa0642e655d593a27268f46aba6effb306e7 /kubernetes/common/postgres-init/resources/config
parent05da03322b0a0539e85819bd84cffd2c7a9c3c1e (diff)
[CPS] Use common postgres for CPS
Add option for CPS to use common postgres Issue-ID: OOM-2839 Signed-off-by: Abdelmuhaimen Seaudi <abdelmuhaimen.seaudi@orange.com> Change-Id: Ida133999f26cf50d59103aa30a90c97fba3e66a0
Diffstat (limited to 'kubernetes/common/postgres-init/resources/config')
-rw-r--r--kubernetes/common/postgres-init/resources/config/setup.sql19
1 files changed, 19 insertions, 0 deletions
diff --git a/kubernetes/common/postgres-init/resources/config/setup.sql b/kubernetes/common/postgres-init/resources/config/setup.sql
new file mode 100644
index 0000000000..06e07245be
--- /dev/null
+++ b/kubernetes/common/postgres-init/resources/config/setup.sql
@@ -0,0 +1,19 @@
+--- User Setup
+CREATE USER "${PG_USER}" LOGIN;
+ALTER USER "${PG_USER}" PASSWORD '${PG_PASSWORD}';
+
+CREATE DATABASE ${PG_DATABASE};
+GRANT ALL PRIVILEGES ON DATABASE ${PG_DATABASE} TO "${PG_USER}";
+
+--- PG_DATABASE Setup
+
+\c ${PG_DATABASE}
+
+CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
+CREATE EXTENSION IF NOT EXISTS pgaudit;
+
+--- Create schema for PG_USER
+
+\c ${PG_DATABASE}
+
+CREATE SCHEMA IF NOT EXISTS "${PG_USER}" AUTHORIZATION "${PG_USER}";