[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.
- [taler-grid5k] 60/73: fix logbackup so it gets rotated correctly, (continued)
- [taler-grid5k] 60/73: fix logbackup so it gets rotated correctly, gnunet, 2021/12/14
- [taler-grid5k] 57/73: improve wallet script, gnunet, 2021/12/14
- [taler-grid5k] 58/73: sanitize scripts, gnunet, 2021/12/14
- [taler-grid5k] 36/73: Update image build, add install script to install taler binaries in running experiment, gnunet, 2021/12/14
- [taler-grid5k] 63/73: fix, gnunet, 2021/12/14
- [taler-grid5k] 46/73: remove previous builds, gnunet, 2021/12/14
- [taler-grid5k] 62/73: fix monitor, gnunet, 2021/12/14
- [taler-grid5k] 49/73: monitor dns too, change db settings, gnunet, 2021/12/14
- [taler-grid5k] 59/73: fix taler-perf.sh, improve other scripts, gnunet, 2021/12/14
- [taler-grid5k] 56/73: fix startup, gnunet, 2021/12/14
- [taler-grid5k] 45/73: take postgres config to seperate file,
gnunet <=
- [taler-grid5k] 38/73: speedup image build, gnunet, 2021/12/14
- [taler-grid5k] 40/73: document variables, gnunet, 2021/12/14
- [taler-grid5k] 70/73: update plotter README and dashboards, gnunet, 2021/12/14
- [taler-grid5k] 65/73: filter wallet getRecord messages - they spam the logs, gnunet, 2021/12/14
- [taler-grid5k] 51/73: add auto explain - not tested yet, gnunet, 2021/12/14
- [taler-grid5k] 67/73: update dashboards, gnunet, 2021/12/14
- [taler-grid5k] 53/73: add more description about huge pages, gnunet, 2021/12/14
- [taler-grid5k] 71/73: remove unused rpecs and handled notes, gnunet, 2021/12/14
- [taler-grid5k] 69/73: update plotter script, gnunet, 2021/12/14
- [taler-grid5k] 72/73: add possibility to define grid5k repo branch for experiments, gnunet, 2021/12/14