gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-grid5k] 11/189: update permissions for db


From: gnunet
Subject: [taler-grid5k] 11/189: update permissions for db
Date: Thu, 28 Apr 2022 10:46:21 +0200

This is an automated email from the git hooks/post-receive script.

marco-boss pushed a commit to branch master
in repository grid5k.

commit bcdc571aac4f342e3bd4adb4eb1c493c74a36de5
Author: Boss Marco <bossm8@bfh.ch>
AuthorDate: Sun Feb 20 14:12:53 2022 +0100

    update permissions for db
---
 experiment/scripts/database.sh | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/experiment/scripts/database.sh b/experiment/scripts/database.sh
index 4ec8e45..db3ee25 100755
--- a/experiment/scripts/database.sh
+++ b/experiment/scripts/database.sh
@@ -145,6 +145,8 @@ function setup_distributed_db() {
   chmod o+r /usr/share/taler/sql/exchange/exchange-0001.sql
   chmod o+r /usr/share/taler/sql/exchange/exchange-0002.sql
 
+  sudo -u taler-exchange-httpd taler-exchange-dbinit -r || true
+  sudo -u taler-exchange-httpd taler-exchange-dbinit -s || true
   sudo -u taler-exchange-httpd taler-exchange-dbinit
 }
 
@@ -174,6 +176,9 @@ psql -d "${DB_NAME}" -tAc "SELECT 
create_shard_server('${SHOST}',
 psql -d "${DB_NAME}" -tAc "GRANT ALL PRIVILEGES ON
                            FOREIGN SERVER \"shard_${SHARD_NAME}\"
                            TO \"taler-exchange-httpd\";"
+psql -d "${DB_NAME}" -tAc "CREATE USER MAPPING IF NOT EXISTS FOR \"${DB_USER}\"
+                           SERVER \"shard_${SHARD_NAME}\"
+                           OPTIONS (user '${DB_USER}', password 
'${DB_PASSWORD}');"
 EOF
   let "i=i+1"
   done
@@ -205,17 +210,6 @@ psql -tAc "SELECT 1 FROM pg_database WHERE 
datname='${DB_NAME}'" | \
   createdb -O taler-exchange-httpd "${DB_NAME}"
 EOF
  
-  sudo -u taler-exchange-httpd taler-exchange-dbinit -r || true
-  sudo -u taler-exchange-httpd taler-exchange-dbinit -s || true
-  
-  if [ "${SHARD_DB}" = "true" ]; then
-    setup_shards
-  elif [ "${PARTITION_DB}" = "true" ]; then
-    setup_partitions
-  else
-    sudo -u taler-exchange-httpd taler-exchange-dbinit
-  fi
-
   # Create the remote user "$DB_USER" and load pg_stat_statements for metrics
   su postgres << EOF
 psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='${DB_USER}'" | \
@@ -226,6 +220,16 @@ psql postgres -tAc "SELECT 1 FROM pg_roles WHERE 
rolname='${DB_USER}'" | \
 END
 EOF
 
+  if [ "${SHARD_DB}" = "true" ]; then
+    setup_shards
+  elif [ "${PARTITION_DB}" = "true" ]; then
+    setup_partitions
+  else
+    sudo -u taler-exchange-httpd taler-exchange-dbinit -r || true
+    sudo -u taler-exchange-httpd taler-exchange-dbinit -s || true
+    sudo -u taler-exchange-httpd taler-exchange-dbinit
+  fi
+
   # Grant access to the databse to the remote user
   su taler-exchange-httpd -s /bin/bash << EOF
 psql -d "${DB_NAME}"

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]