gnunet-svn
[Top][All Lists]
Advanced

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

[taler-grid5k] 45/73: take postgres config to seperate file


From: gnunet
Subject: [taler-grid5k] 45/73: take postgres config to seperate file
Date: Tue, 14 Dec 2021 15:10:27 +0100

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

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

commit d1312a5a40bcc36415c1d4acf380ca82c16eb08d
Author: Boss Marco <bossm8@bfh.ch>
AuthorDate: Thu Dec 2 18:14:39 2021 +0100

    take postgres config to seperate file
---
 configs/etc/postgresql/13/main/exchange.conf | 25 ++++++++++++++++++++
 experiment/README.md                         |  2 +-
 experiment/scripts/database.sh               | 34 +++++-----------------------
 experiment/scripts/helpers.sh                |  7 ++++--
 experiment/scripts/setup.sh                  |  3 +++
 5 files changed, 40 insertions(+), 31 deletions(-)

diff --git a/configs/etc/postgresql/13/main/exchange.conf 
b/configs/etc/postgresql/13/main/exchange.conf
new file mode 100644
index 0000000..7054c3a
--- /dev/null
+++ b/configs/etc/postgresql/13/main/exchange.conf
@@ -0,0 +1,25 @@
+listen_addresses='*'
+log_destination=syslog
+syslog_ident='taler-database'
+log_min_duration_statement=500
+shared_preload_libraries='pg_stat_statements,auto_explain'
+
+# use 25% of the available memory 
+# (https://www.postgresql.org/docs/13/runtime-config-resource.html)
+shared_buffers=$(($(awk '/MemTotal/ {print $2}' /proc/meminfo) / 4 ))kB
+effective_cache_size=$(($(awk '/MemTotal/ {print $2}' /proc/meminfo) * 3/4))kB
+
+# 
(https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-MAX-WAL-SIZE)
+max_wal_size=2GB 
+wal_buffers=16MB
+
+max_worker_processes=$(lscpu | grep "CPU(s)" | head -n 1 | awk '{print $2}')
+max_connections=300
+
+# out of shared memory
+max_locks_per_transaction=85
+
+# Increase work mem to lower I/O utilization (max used =~ work_mem * 
max_connections)
+# NOTE: This formula is not completely correct 
+# work_mem=128MB
+# idle_in_transaction_session_timeout=10000
diff --git a/experiment/README.md b/experiment/README.md
index c6a230e..feff76f 100644
--- a/experiment/README.md
+++ b/experiment/README.md
@@ -51,7 +51,7 @@ export EXCHANGE_COMMIT_SHA=master
 export MERCHANT_COMMIT_SHA=master
 export WALLET_COMMIT_SHA=master
 
-/bin/bash /root/taler/scripts/install.sh
+/bin/bash /root/taler/grid5k/experiment/scripts/install.sh
 # /bin/bash /root/scripts/install.sh
 ```
 
diff --git a/experiment/scripts/database.sh b/experiment/scripts/database.sh
index 5d3db46..737a2c3 100755
--- a/experiment/scripts/database.sh
+++ b/experiment/scripts/database.sh
@@ -10,34 +10,6 @@ function setup_config() {
   sed -i "s\<DB_URL_HERE>\postgresql:///${DB_NAME}\g" \
        /etc/taler/secrets/exchange-db.secret.conf
   
-  echo "
-  listen_addresses='*'
-  log_destination=syslog
-  syslog_ident='taler-database'
-  log_min_duration_statement=500
-  shared_preload_libraries='pg_stat_statements,auto_explain'
-  
-  # use 25% of the available memory 
-  # (https://www.postgresql.org/docs/13/runtime-config-resource.html)
-  shared_buffers=$(($(awk '/MemTotal/ {print $2}' /proc/meminfo) / 4 ))kB
-  effective_cache_size=$(($(awk '/MemTotal/ {print $2}' /proc/meminfo) * 
3/4))kB
-
-  # 
(https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-MAX-WAL-SIZE)
-  max_wal_size=2GB 
-  wal_buffers=16MB
-
-  max_worker_processes=$(lscpu | grep "CPU(s)" | head -n 1 | awk '{print $2}')
-  max_connections=300
-
-  # out of shared memory
-  max_locks_per_transaction=85
-
-  # Increase work mem to lower I/O utilization (max used =~ work_mem * 
max_connections)
-  # NOTE: This formula is not completely correct 
-  work_mem=128MB
-  # idle_in_transaction_session_timeout=10000
-  " >> /etc/postgresql/13/main/postgresql.conf
-  
   # Enable password for taler since this is commonly the case
   # For the postgres user do not enable authentication (used in metrics)
   echo "
@@ -45,6 +17,12 @@ function setup_config() {
   host all postgres 172.16.0.0/12 trust
   " >> /etc/postgresql/13/main/pg_hba.conf
 
+  if ! grep -q "include = 'exchange.conf'" \
+         /etc/postgresql/13/main/postgresql.conf; then
+    echo "include = 'exchange.conf'" >>
+          /etc/postgresql/13/main/postgresql.conf
+  fi
+
   sed -i -e "s/<DB_USER_HERE>/${DB_USER}/g" \
          -e "s/<DB_PASSWORD_HERE>/${DB_PASSWORD}/g" \
          /etc/pgbouncer/userlist.txt
diff --git a/experiment/scripts/helpers.sh b/experiment/scripts/helpers.sh
index 3c64be4..cecb155 100755
--- a/experiment/scripts/helpers.sh
+++ b/experiment/scripts/helpers.sh
@@ -9,14 +9,17 @@ set -x
 function set_ddn() {
   # There are still issues sometimes
   # hostname -I ... failure syntax error
-  while ! hostname -I ; do
+  # Even when looping with while ! hostname -I the next one
+  # can fail.
+  # Try to fix it with eval
+  while ! eval $(echo IP=$(hostname -I)) ; do
     sleep 5;
     systemctl restart dnsmasq
   done
   nsupdate -v << EOF
 server ${DNS_HOSTS}
 zone ${DNS_ZONE}
-update add ${1} 3600 A $(hostname -I)
+update add ${1} 3600 A ${IP}
 send
 EOF
 }
diff --git a/experiment/scripts/setup.sh b/experiment/scripts/setup.sh
index 85b6c5f..11d51d7 100644
--- a/experiment/scripts/setup.sh
+++ b/experiment/scripts/setup.sh
@@ -120,6 +120,9 @@ function setup_dns() {
     # Wait for named to be ready before starting dnsmasq
     sleep 5
     systemctl restart dnsmasq
+    # Wait again in hope that the hostname error is fixed
+    # hostname -I couldn't get address for 'x': failure syntax error
+    sleep 5
   else 
     systemctl restart named
   fi

-- 
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]