gnunet-svn
[Top][All Lists]
Advanced

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

[taler-grid5k] 154/189: more dynamic rsyslog ports, add some info in set


From: gnunet
Subject: [taler-grid5k] 154/189: more dynamic rsyslog ports, add some info in setup.sh
Date: Thu, 28 Apr 2022 10:48:44 +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 4154d46fad222597b3d87b3803069717e85345f2
Author: Boss Marco <bossm8@bfh.ch>
AuthorDate: Fri Apr 15 22:28:02 2022 +0200

    more dynamic rsyslog ports, add some info in setup.sh
---
 additional/persist.sh                |  4 ++--
 configs/etc/rsyslog.d/taler.conf     |  4 ++--
 experiment/scripts/database.sh       |  3 ---
 experiment/scripts/exchange-proxy.sh |  5 -----
 experiment/scripts/helpers.sh        |  2 ++
 experiment/scripts/run.sh            | 15 +++++++++++++--
 experiment/scripts/setup.sh          | 17 ++++++++++++++++-
 experiment/scripts/wallet.sh         |  4 ----
 8 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/additional/persist.sh b/additional/persist.sh
index 70cfc38..dc5aab6 100755
--- a/additional/persist.sh
+++ b/additional/persist.sh
@@ -61,7 +61,7 @@ BACKUP_DIR="archives"
 G5K_BACKUP="g5k-$(date +%s).tar.gz"
 
 echo "Creating archive, this can take some time"
-ssh g5k 'rm -rf grenoble/g5k.tar* && find . -type l -exec tar 
--ignore-failed-read -rf grenoble/g5k.tar -C {} taler-perf exp-data espec-times 
2>&1 \; | grep -vi "no such file"' &
+ssh g5k 'rm -rf grenoble/g5k.tar* && find . -type l -exec tar 
--ignore-failed-read -rf grenoble/g5k.tar -C {} exp-logs exp-data espec-times 
2>&1 \; | grep -vi "no such file"' &
 
 while kill -0 $! > /dev/null 2>&1; do
   work_in_progress
@@ -78,7 +78,7 @@ echo "Copying archive to local machine"
 scp g5k:~/grenoble/g5k.tar.gz ${G5K_BACKUP}
 
 echo "Cleaning up g5k storage"
-ssh g5k 'rm grenoble/g5k.tar.gz && $(find . -type l -exec rm -rf 
{}/taler-perf/ {}/exp-data {}/espec-times \;)' &
+ssh g5k 'rm grenoble/g5k.tar.gz && $(find . -type l -exec rm -rf {}/exp-logs/ 
{}/exp-data {}/espec-times \;)' &
 
 while kill -0 $! > /dev/null 2>&1; do
   work_in_progress
diff --git a/configs/etc/rsyslog.d/taler.conf b/configs/etc/rsyslog.d/taler.conf
index 848afe4..df90ce6 100644
--- a/configs/etc/rsyslog.d/taler.conf
+++ b/configs/etc/rsyslog.d/taler.conf
@@ -11,11 +11,11 @@ if ($programname startswith 'taler' or $syslogtag 
startswith 'taler') then {
   action(type="omfwd"
          protocol="tcp"
          target="<MONITOR_DOMAIN_HERE>"
-         port="1514"
+         port="<PROMTAIL_LOG_PORT_HERE>"
          Template="RSYSLOG_SyslogProtocol23Format"
          TCP_Framing="octet-counted"
          KeepAlive="on")
-  # Write all logs also to the file - will periodcally be rotaded by 
taler-logbackup.service
+  # Write all logs also to the file - will periodcally be rotated by 
taler-logbackup.service
   *.* ?FileName
   # Do not do any further steps with logs which matched this rule
   & stop
diff --git a/experiment/scripts/database.sh b/experiment/scripts/database.sh
index 9f438f6..2c26367 100755
--- a/experiment/scripts/database.sh
+++ b/experiment/scripts/database.sh
@@ -42,9 +42,6 @@ function setup_ram_storage() {
 # Setup the postgresql configuration
 function setup_config() {
 
-  # Use a different port for the database syslog receiver
-  sed -i 's/port="1514"/port="1515"/g' \
-         /etc/rsyslog.d/taler.conf
   restart_rsyslog
 
   # Grid5000 mounts the default disk on /tmp
diff --git a/experiment/scripts/exchange-proxy.sh 
b/experiment/scripts/exchange-proxy.sh
index c65c5d9..ed4854c 100755
--- a/experiment/scripts/exchange-proxy.sh
+++ b/experiment/scripts/exchange-proxy.sh
@@ -45,11 +45,6 @@ function setup_config() {
 
   setup_rsyslog_for_nginx
   
-  # Change the port, since we have to limit the number of log lines to parse
-  # in loki for best performance
-  sed -i 's/port="1514"/port="1516"/g' \
-         /etc/rsyslog.d/taler.conf
-  
   # Allow enough files to be opened by nginx (www-data)
   echo "
   fs.file-max=50000
diff --git a/experiment/scripts/helpers.sh b/experiment/scripts/helpers.sh
index 67953cc..4ac3624 100755
--- a/experiment/scripts/helpers.sh
+++ b/experiment/scripts/helpers.sh
@@ -53,6 +53,7 @@ function enable_netdelay() {
 }
 
 # Setup the log directiories in the Grid5000 shared home directory (NFS)
+# And configure rsyslog to send logs to promtail
 function setup_log() {
   HOST_LOG_DIR=${LOG_DIR}/${TALER_HOST}
   # || true is sill needed when e.g. wallets want to create the same 
@@ -60,6 +61,7 @@ function setup_log() {
   test -d ${HOST_LOG_DIR} || mkdir ${HOST_LOG_DIR} || true 
   # Send all logs about taler to promtail on the monitoring node
   sed -i -e "s/<MONITOR_DOMAIN_HERE>/monitor.${DNS_ZONE}/g" \
+        -e "s/<PROMTAIL_LOG_PORT_HERE>/${PROMTAIL_LOG_PORT}/g" \
          -e "s|<LOG_DIR_HERE>|${HOST_LOG_DIR}|g" \
        /etc/rsyslog.d/taler.conf
   # Enable log rotating for all logs in the host log dir on NFS
diff --git a/experiment/scripts/run.sh b/experiment/scripts/run.sh
index ca11f54..11d298b 100644
--- a/experiment/scripts/run.sh
+++ b/experiment/scripts/run.sh
@@ -1,7 +1,8 @@
 #!/bin/bash
 # Run the experiment
-# Will determine the role of the node
-# based on its hostname and start role specific scripts
+# Will determine the role of the node based on its hostname,
+# set the DNS A record and start role specific scripts
+
 set -euax
 source ~/scripts/helpers.sh
 
@@ -13,11 +14,18 @@ fi
 set_ddn ${NODE_NAME}.${DNS_ZONE}
 set_host ${NODE_NAME}
 
+# Some applications log to different promtail ports
+# so that we have less log lines to filter when
+# calculating prometheus metrics or other things with promtail
+# (default for all is 1514) - see 'configs/etc/monitor/promtail.yaml'
+PROMTAIL_LOG_PORT=1514
+
 if [[ "${HOSTNAME}" =~ ${BANK_HOSTS} ]]; then 
     setup_log
     enable_logrotate
     exec ~/scripts/bank.sh init
 elif [[ "${HOSTNAME}" =~ ${DB_HOSTS} ]]; then 
+    PROMTAIL_LOG_PORT=1515
     setup_log
     enable_logrotate
     exec ~/scripts/database.sh init
@@ -61,6 +69,7 @@ elif [[ "${HOSTNAME}" =~ ${MERCHANT_HOSTS} ]]; then
 elif [[ "${HOSTNAME}" =~ ${MONITOR_HOSTS} ]]; then 
     exec ~/scripts/monitor.sh init
 elif [[ "${HOSTNAME}" =~ ${EPROXY_HOSTS} ]]; then 
+    PROMTAIL_LOG_PORT=1516
     # Single domain for DNS load balancing
     set_ddn ${EXCHANGE_GW_DOMAIN}
     # We need a second domain for monitoring to
@@ -72,6 +81,8 @@ elif [[ "${HOSTNAME}" =~ ${EPROXY_HOSTS} ]]; then
 elif [[ "${HOSTNAME}" =~ ${DNS_HOSTS} ]]; then 
     exec ~/scripts/dns.sh
 else
+    # Be a wallet if no other node matched
+    PROMTAIL_LOG_PORT=1517
     enable_netdelay ${EXCHANGE_GW_DOMAIN}
     setup_log
     exec ~/scripts/wallet.sh init
diff --git a/experiment/scripts/setup.sh b/experiment/scripts/setup.sh
index a86e81b..e3db857 100644
--- a/experiment/scripts/setup.sh
+++ b/experiment/scripts/setup.sh
@@ -1,5 +1,20 @@
 #!/bin/bash
 # Setup nodes for the experiment
+# This script does the following:
+
+# 0. Cleanup data from previous experiments 
+#    (prometheus and loki only when said so in .env)
+# 1. Parse the experiment-info.json from jFed to get
+#    - The user which runs the experiment (used for NFS) - env: G5K_USER
+#    - Which Grid5k node is which node in jFed (used to run the correct script 
later)
+#      This also sets variables like PRIMARY_EXCHANGE, NUM_<NODES>, NODE_NAME 
(jFed) and
+#      G5K_HOST (e.g. dahu-3)
+# 2. Setup the directory where application logs will be stored 
(/home/G5K_USER/exp-logs) 
+#    or /tmp/exp-logs
+# 3. Export all environment to ~/.env and /etc/environment
+# 4. Update the g5k repo from taler.net and copy the configurations 
(g5k-repo/configs) to /
+# 5. Configure and start the DNS server on the DNS node
+
 
 # Set the current user
 echo "G5K_USER=$(cat ~/experiment-info.json | jq -r '.user.name')" >> ~/.env
@@ -58,7 +73,7 @@ function parse_experiment_nodes() {
 # Determine and create the base log directory
 # If NFS exists, it will be created in the users home dir on the NFS
 function setup_log_dir() {
-  LOG_DIR=/home/${G5K_USER}/taler-perf
+  LOG_DIR=/home/${G5K_USER}/exp-logs
   
   if [ -d ${LOG_DIR} ]; then
     # If multiple nodes want to delete the same dir we run into errors
diff --git a/experiment/scripts/wallet.sh b/experiment/scripts/wallet.sh
index a088a9b..0b55178 100755
--- a/experiment/scripts/wallet.sh
+++ b/experiment/scripts/wallet.sh
@@ -18,10 +18,6 @@ source ~/scripts/helpers.sh
 
 # Enable rsyslog and wait until the exchange is ready
 function init_wallets() {
-
-  sed -i 's/port="1514"/port="1517"/g' \
-         /etc/rsyslog.d/taler.conf
-
   restart_rsyslog
   wait_for_keys "${EXCHANGE_GW_DOMAIN}"
   sleep 5

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