From d802fd9a6c6aaffa330a30b68f7896ffebaa4fcd Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Thu, 15 Aug 2024 12:39:19 +0100 Subject: Change default database to PostgreSQL Issue-ID: POLICY-5118 Change-Id: I22ece93aca3cbc5e406e4942ce5255a7b7b60761 Signed-off-by: adheli.tavares --- compose/config/db-pg/db-pg.conf | 11 ++++++----- compose/config/db-pg/db-pg.sh | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'compose/config/db-pg') diff --git a/compose/config/db-pg/db-pg.conf b/compose/config/db-pg/db-pg.conf index d4d58cec..ee26454e 100644 --- a/compose/config/db-pg/db-pg.conf +++ b/compose/config/db-pg/db-pg.conf @@ -1,4 +1,4 @@ -# Copyright 2022 Nordix Foundation. All rights reserved +# Copyright (C) 2022, 2024 Nordix Foundation. 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. @@ -11,7 +11,8 @@ # 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. -MYSQL_ROOT_PASSWORD=secret -MYSQL_USER=policy_user -MYSQL_PASSWORD=policy_user -PGPASSWORD=policy_user \ No newline at end of file +PGSQL_ROOT_PASSWORD=secret +PGSQL_USER=policy_user +PGSQL_PASSWORD=policy_user +PGPASSWORD=policy_user +POSTGRES_PASSWORD=policy_user diff --git a/compose/config/db-pg/db-pg.sh b/compose/config/db-pg/db-pg.sh index 14816f08..681191f9 100755 --- a/compose/config/db-pg/db-pg.sh +++ b/compose/config/db-pg/db-pg.sh @@ -1,5 +1,5 @@ #!/bin/bash -xv -# Copyright 2022 Nordix Foundation. All rights reserved +# Copyright (C) 2022, 2024 Nordix Foundation. 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. @@ -13,10 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -psql -U postgres -d postgres --command "CREATE USER ${MYSQL_USER} WITH PASSWORD '${MYSQL_PASSWORD}';" +psql -U postgres -d postgres --command "CREATE USER ${PGSQL_USER} WITH PASSWORD '${PGSQL_PASSWORD}';" for db in migration pooling policyadmin policyclamp operationshistory clampacm do psql -U postgres -d postgres --command "CREATE DATABASE ${db};" - psql -U postgres -d postgres --command "GRANT ALL PRIVILEGES ON DATABASE ${db} TO ${MYSQL_USER} ;" + psql -U postgres -d postgres --command "ALTER DATABASE ${db} OWNER TO ${PGSQL_USER} ;" + psql -U postgres -d postgres --command "GRANT ALL PRIVILEGES ON DATABASE ${db} TO ${PGSQL_USER} ;" done \ No newline at end of file -- cgit 1.2.3-korg