gnunet-svn
[Top][All Lists]
Advanced

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

[taler-grid5k] 84/189: cleaner exchange setup


From: gnunet
Subject: [taler-grid5k] 84/189: cleaner exchange setup
Date: Thu, 28 Apr 2022 10:47:34 +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 077c5be420e9e6cd4f0d7cd2d21c498c31470785
Author: Boss Marco <bossm8@bfh.ch>
AuthorDate: Wed Mar 16 20:42:22 2022 +0100

    cleaner exchange setup
---
 configs/etc/monitor/exchange-exporters.yaml.tpl |  6 --
 configs/etc/monitor/node-exporters.yaml.tpl     | 10 +--
 configs/etc/monitor/prometheus.yaml             |  6 ++
 experiment/env                                  |  5 +-
 experiment/scripts/exchange.sh                  |  4 +-
 experiment/scripts/helpers.sh                   | 11 ++--
 experiment/scripts/merchant.sh                  |  2 +-
 experiment/scripts/monitor.sh                   | 83 +++++++++++--------------
 experiment/scripts/proxy.sh                     | 50 +++++++--------
 experiment/scripts/run.sh                       | 23 +++----
 experiment/scripts/setup.sh                     | 14 ++++-
 experiment/scripts/taler-perf.sh                | 43 +++++--------
 experiment/taler.many.rspec                     |  4 +-
 experiment/taler.rspec                          |  4 +-
 14 files changed, 117 insertions(+), 148 deletions(-)

diff --git a/configs/etc/monitor/exchange-exporters.yaml.tpl 
b/configs/etc/monitor/exchange-exporters.yaml.tpl
deleted file mode 100644
index 74a4992..0000000
--- a/configs/etc/monitor/exchange-exporters.yaml.tpl
+++ /dev/null
@@ -1,6 +0,0 @@
-  - job_name: 'taler'
-    static_configs:
-    - labels:
-        component: 'exchange'
-      targets:
-      # <EXCHANGES_HERE>
diff --git a/configs/etc/monitor/node-exporters.yaml.tpl 
b/configs/etc/monitor/node-exporters.yaml.tpl
index de841bb..69ce5fb 100644
--- a/configs/etc/monitor/node-exporters.yaml.tpl
+++ b/configs/etc/monitor/node-exporters.yaml.tpl
@@ -15,7 +15,7 @@
     - labels:
         component: 'exchange'
       targets:
-      - '${EXCHANGE_DOMAIN}:9100'
+      # <EXCHANGE_NODES_HERE>
     - labels:
         component: 'exchange-aggregator'
       targets:
@@ -39,7 +39,7 @@
     - labels:
         component: 'wallet'
       targets:
-      # <WALLETS_HERE>
+      # <WALLET_NODES_HERE>
     - labels:
         component: 'monitor'
       targets:
@@ -51,8 +51,4 @@
     - labels:
         component: 'shard'
       targets:
-      # <SHARDS_HERE>
-    - labels:
-        component: 'secondary-exchange'
-      targets:
-      # <SECEXCH_HERE>
+      # <SHARD_NODESS_HERE>
diff --git a/configs/etc/monitor/prometheus.yaml 
b/configs/etc/monitor/prometheus.yaml
index c972b1a..28072c5 100644
--- a/configs/etc/monitor/prometheus.yaml
+++ b/configs/etc/monitor/prometheus.yaml
@@ -26,3 +26,9 @@ scrape_configs:
     static_configs:
     - targets: ['127.0.0.1:9080']
   
+  - job_name: 'taler'
+    static_configs:
+    - labels:
+        component: 'exchange'
+      targets:
+      # <EXCHANGES_HERE>
diff --git a/experiment/env b/experiment/env
index 400f1bb..452022f 100644
--- a/experiment/env
+++ b/experiment/env
@@ -8,7 +8,7 @@
 # (used to determine which script to execute in run.sh)
 # Wallets are not needed explicitely since they can (and will be)
 # exported as a wildcard (*).
-NODES="Bank DB DNS Exchange SecExch Aggregator Closer Transfer Wirewatch 
Merchant Monitor Proxy Shard"
+NODES="Bank DB DNS Exchange Aggregator Closer Transfer Wirewatch Merchant 
Monitor Proxy Shard"
 
 # DNS Zone to setup inside the grid for the experiment
 DNS_ZONE=perf.taler
@@ -28,7 +28,7 @@ G5K_COMMIT_SHA=master
     BANK_DOMAIN=bank.${DNS_ZONE}
 DATABASE_DOMAIN=db.${DNS_ZONE}
      DNS_DOMAIN=ns1.${DNS_ZONE}
-EXCHANGE_DOMAIN=exchange.${DNS_ZONE}
+EXCHANGE_DOMAIN=exchange.*.${DNS_ZONE}
 MERCHANT_DOMAIN=merchant.${DNS_ZONE}
  MONITOR_DOMAIN=monitor.${DNS_ZONE}
    PROXY_DOMAIN=proxy.${DNS_ZONE}
@@ -39,7 +39,6 @@ EXCH_AGGREGATOR_DOMAIN=exch-aggregator.${DNS_ZONE}
     EXCH_CLOSER_DOMAIN=exch-closer.${DNS_ZONE}
   EXCH_TRANSFER_DOMAIN=exch-transfer.${DNS_ZONE}
  EXCH_WIREWATCH_DOMAIN=exch-wirewatch.${DNS_ZONE}
- SECONDARY_EXCH_DOMAIN=exch-secondary.*.${DNS_ZONE}
 
 # Arguments to pass to all taler-exchange-* binaries at startup.
 # E.g. -L INFO
diff --git a/experiment/scripts/exchange.sh b/experiment/scripts/exchange.sh
index 90f8411..3e1527b 100755
--- a/experiment/scripts/exchange.sh
+++ b/experiment/scripts/exchange.sh
@@ -55,7 +55,7 @@ function start_other_exchange_binaries() {
 function setup_primary_exchange() {
 
   # Setup the shared key directory when we use a secondary node
-  if [[ ${SECEXCH_HOSTS} != "none" ]]; then
+  if [[ ${NUM_EXCHANGE_HOSTS} != "1" ]]; then
     rm -rf /home/${G5K_USER}/taler || true
     mkdir -p /home/${G5K_USER}/taler/exchange-secmod-{cs,rsa,eddsa}
   fi
@@ -64,7 +64,7 @@ function setup_primary_exchange() {
 
   start_other_exchange_binaries
 
-  wait_for_keys "${EXCHANGE_DOMAIN}:10000/management"
+  wait_for_keys "${PRIMARY_EXCHANGE}:10000/management"
 
   sleep 5
   
diff --git a/experiment/scripts/helpers.sh b/experiment/scripts/helpers.sh
index 948d73b..0f54743 100755
--- a/experiment/scripts/helpers.sh
+++ b/experiment/scripts/helpers.sh
@@ -135,14 +135,13 @@ function setup_exchange_config_without_master_key() {
   sed -i "s/<BANK_HOST_HERE>/${BANK_DOMAIN}/g" \
        /etc/taler/secrets/exchange-accountcredentials.secret.conf
 
-  # TODO Secondary exchanges base url?
   sed -i -e "s/<BANK_HOST_HERE>/${BANK_DOMAIN}/g" \
-         -e "s\<BASE_URL_HERE>\http://${EXCHANGE_DOMAIN}:10000/\g"; \
+         -e 
"s\<BASE_URL_HERE>\http://${EXCHANGE_DOMAIN//\*/${G5K_HOST}}:10000/\g"; \
          -e "s/<MAX_REQUESTS_HERE>/${EXCHANGE_MAX_REQUESTS:-8192}/g" \
          -e "s/<AGGREGATOR_SHARD_SIZE_HERE>/${AGGREGATOR_SHARD_SIZE}/g" \
        /etc/taler/conf.d/exchange-business.conf
 
-  if [[ ${SECEXCH_HOSTS} != "none" ]]; then
+  if [[ ${NUM_EXCHANGE_HOSTS} != "1" ]]; then
     # Use a shared NFS key directory when we have multiple exchange-httpd 
servers
     sed -i "s|<SM_KEY_DIR_HERE>|/home/${G5K_USER}/taler|g" \
         /etc/taler/conf.d/exchange-secmod.conf
@@ -193,7 +192,7 @@ function stop_numbered_services() {
 
 # Get all Grid5000 hosts which are registered under $1
 # Returns only the Grid5000 node - e.g. graoully-1
-# $1: the domain, can contain a wildcard
+# $1: the domain, containing a wildcard at position 2 e.g. x.*.y
 function get_hosts() {
   IFS=$'\n' read -r -d '' -a HOSTS < <(\
     dig -t AXFR "${DNS_ZONE}" "@${DNS_HOSTS}" \
@@ -216,8 +215,8 @@ function get_shard_hosts() {
 
 # Get all Grid5000 hosts which host secondary exchanges
 # Rerurns only the Grid5000 node - e.g. graoully-1
-function get_secondary_exchange_hosts() {
-  get_hosts "${SECONDARY_EXCH_DOMAIN}"
+function get_exchange_hosts() {
+  get_hosts "${EXCHANGE_DOMAIN}"
 }
 
 # Get all exchanges which are registered in the nginx proxy config
diff --git a/experiment/scripts/merchant.sh b/experiment/scripts/merchant.sh
index e35ffbe..d4a63fd 100755
--- a/experiment/scripts/merchant.sh
+++ b/experiment/scripts/merchant.sh
@@ -24,7 +24,7 @@ function configure_merchant() {
        | jq -r '.master_public_key'
   )
   
-  sed -i -e "s\<EXCHANGE_URL_HERE>\http://${EXCHANGE_DOMAIN}/\g"; \
+  sed -i -e "s\<EXCHANGE_URL_HERE>\http://${PROXY_DOMAIN}/\g"; \
          -e "s/<EXCHANGE_MASTER_KEY_HERE>/${MASTER_KEY}/g" \
           /etc/taler/conf.d/merchant.conf
 }
diff --git a/experiment/scripts/monitor.sh b/experiment/scripts/monitor.sh
index 63ec0c4..baa527b 100755
--- a/experiment/scripts/monitor.sh
+++ b/experiment/scripts/monitor.sh
@@ -74,68 +74,60 @@ function configure_prometheus_and_exporters() {
   sed -i "s|<SHARD_DB_URLS_HERE>|${CFG}|g" \
           /etc/default/prometheus-postgres-exporter
   
-  sed -i "s\<PROXY_URL_HERE>\http://${PROXY_DOMAIN}/stub_status\g"; \
+  sed -i "s|<PROXY_URL_HERE>|http://${PROXY_DOMAIN}/stub_status|g" \
           /etc/default/prometheus-nginx-exporter
 }
 
+# Add new exchanges to be monitored
+# $1: N - already running exchange processes
+# $2: N - processes to add
+function add_exchanges_to_prometheus() {
+
+  let "START=$1+10000"
+  let "END=$START+$2"
+
+  for PORT in $(seq $START $END); do
+    for HOST in $(get_exchange_hosts); do 
+      if ! grep -q "${EXCHANGE_DOMAIN//\*${HOST}}" 
/etc/monitor/prometheus.yaml;
+      then
+        sed -i "/<EXCHANGES_HERE>/a  \ \ \ \ \ \ - 
'${EXCHANGE_DOMAIN//\*${HOST}}:${PORT}'" \
+                /etc/monitor/prometheus.yaml
+      fi
+    done
+  done
+}
+
 # Add wallet nodes to be monitored
 # Requires no argument since wallet nodes are retrieved from the DNS
 function add_wallet_nodes_to_prometheus() {
   for WALLET in $(get_wallet_hosts); do
     if ! grep -q "${WALLET_DOMAIN//\*/${WALLET}}:9100" 
/etc/monitor/prometheus.yaml; 
     then
-      sed -i "/<WALLETS_HERE>/a \ \ \ \ \ \ - 
'${WALLET_DOMAIN//\*/${WALLET}}:9100'" \
-              /etc/monitor/prometheus.yaml
-    fi
-  done
-}
-
-# Add new exchanges to be monitored
-# Requires no argument since exchanges are retrieved from the proxy
-function add_exchanges_to_prometheus() {
-  if ! grep -q "${EXCHANGE_DOMAIN}:10000" /etc/monitor/prometheus.yaml; then
-    # unfortunately we do not have access to the other hosts when running from 
ESpec
-    # But when initializing there are no hosts listed in the yaml yet, thus
-    # it's sufficient to search for the exchange from the target
-    for i in $(seq $((${NUM_EXCHANGE_PROCESSES:-10})) ); do
-      let "i+=10000-1"
-      sed -i "/<EXCHANGES_HERE>/a  \ \ \ \ \ \ - '${EXCHANGE_DOMAIN}:${i}'" \
-              /etc/monitor/prometheus.yaml
-      for SECEXCH in $(get_secondary_exchange_hosts); do
-        sed -i "/<EXCHANGES_HERE>/a  \ \ \ \ \ \ - 
'${SECONDARY_EXCH_DOMAIN//\*/${SECEXCH}}:${i}'" \
-                /etc/monitor/prometheus.yaml
-      done
-    done
-    return
-  fi
-  for EXCH in $(get_exchanges); do 
-    if ! grep -q "${EXCH}" /etc/monitor/prometheus.yaml;
-    then
-      sed -i "/<EXCHANGES_HERE>/a  \ \ \ \ \ \ - '${EXCH}'" \
+      sed -i "/<WALLET_NODES_HERE>/a \ \ \ \ \ \ - 
'${WALLET_DOMAIN//\*/${WALLET}}:9100'" \
               /etc/monitor/prometheus.yaml
     fi
   done
 }
 
 # Add shard servers to be monitored
-# Requires no argument, since shard servers are retrieved from dns
+# Requires no argument, since servers are retrieved from dns
 function add_shard_nodes_to_prometheus() {
   for SHARD in $(get_shard_hosts); do
     if ! grep -q "${SHARD}" /etc/monitor/prometheus.yaml;
     then
-      sed -i "/<SHARDS_HERE/a \ \ \ \ \ \ - 
'${SHARD_DOMAIN//\*/${SHARD}}:9100'" \
+      sed -i "/<SHARD_NODES_HERE/a \ \ \ \ \ \ - 
'${SHARD_DOMAIN//\*/${SHARD}}:9100'" \
               /etc/monitor/prometheus.yaml
     fi
   done
 }
 
-# Add secondary exchange nodes to be monitored
-# Requires no argument, since nodes are retrieved from dns
-function add_secondary_exchange_nodes_to_prometheus() {
-  for SECEXCH in $(get_secondary_exchange_hosts); do
-    if ! grep -q "${SECEXCH}" /etc/monitor/prometheus.yaml;
+# Add exchange servers to be monitored
+# Requires no argument, since servers are retrieved from dns
+function add_exchange_nodes_to_prometheus() {
+  for EXCH in $(get_exchange_hosts); do
+    if ! grep -q "${EXCHANGE}" /etc/monitor/prometheus.yaml;
     then
-      sed -i "/<SECEXCH_HERE/a \ \ \ \ \ \ - 
'${SECONDARY_EXCH_DOMAIN//\*/${SECEXCH}}:9100'" \
+      sed -i "/<EXCHANGE_NODES_HERE/a \ \ \ \ \ \ - 
'${EXCHANGE_DOMAIN//\*/${EXCHANGE}}:9100'" \
               /etc/monitor/prometheus.yaml
     fi
   done
@@ -153,10 +145,8 @@ function remove_exchanges_from_prometheus() {
   let "END=$START-$2"
 
   for PORT in $(seq $START $END); do
-    sed -i "/${EXCHANGE_DOMAIN}:${PORT}/d" \
-            /etc/monitor/prometheus.yaml
-    for SECEXCH in $(get_secondary_exchange_hosts); do
-      sed -i "/${SECONDARY_EXCH_DOMAIN//\*/${SECEXCH}}:${PORT}/d" \
+    for HOST in $(get_exchange_hosts); do
+      sed -i "/${EXCHANGE_DOMAIN//\*/${HOST}}:${PORT}/d" \
               /etc/monitor/prometheus.yaml
     done
   done
@@ -179,16 +169,13 @@ function init_monitor() {
       cat /etc/monitor/node-exporters.yaml.tpl | \
            envsubst >> /etc/monitor/prometheus.yaml
       add_wallet_nodes_to_prometheus
+      add_shards_nodes_to_prometheus
+      add_exchange_nodes_to_prometheus
     fi
   fi
 
-  if ! grep -q "job_name: 'taler'" /etc/monitor/prometheus.yaml; then
-    cat /etc/monitor/exchange-exporters.yaml.tpl >> 
/etc/monitor/prometheus.yaml
-    add_exchanges_to_prometheus
-  fi
+  add_exchanges_to_prometheus "0" ${NUM_EXCHANGE_PROCESSES}
 
-  add_shards_nodes_to_prometheus
-  add_secondary_exchange_nodes_to_prometheus
   configure_prometheus_and_exporters
 
   systemctl restart prometheus-nginx-exporter \
@@ -204,7 +191,7 @@ case $1 in
     ;;
   start)
     add_wallet_nodes_to_prometheus
-    add_exchanges_to_prometheus
+    add_exchanges_to_prometheus $2 $3
     ;;
   stop-exchanges)
     remove_exchanges_from_prometheus $2 $3
diff --git a/experiment/scripts/proxy.sh b/experiment/scripts/proxy.sh
index 10ea755..783582e 100755
--- a/experiment/scripts/proxy.sh
+++ b/experiment/scripts/proxy.sh
@@ -17,28 +17,18 @@ set -eux
 source ~/scripts/helpers.sh
 
 # Add N exchanges to the upstream servers in the proxy configuration
-# $1: Number of exchanges to add
+# $1: N - Number of currently running exchanges (per exchange host)
+# $2: N - Number of exchanges to add
 function add_exchanges() {
-  # Determine the number of exchanges which are already added
-  # and calculate new ports based on that info
-  ADDED=$(\
-    grep -r "  server ${EXCHANGE_DOMAIN}:" /etc/nginx/sites-enabled/proxy | \
-    wc -l 
-  )
 
-  sed -i -e "s/<PROXY_DOMAIN_HERE>/${PROXY_DOMAIN}/g" \
-         /etc/nginx/sites-enabled/proxy
+  let "START=$1+10000"
+  let "END=$START+$2"
 
-  
-  for i in $(seq ${1}); do
-    # seq starts at 1 so remove it again
-    # (0 N cannot be used since seq 0 0 would yield 0 while seq N=0 yields 
nothing)
-    let "i+=${ADDED}-1" || true # result might be zero, make sure its still no 
failure
-    let "i+=10000"
-    sed -i -e "/<SERVERS_HERE>/a \ \ server ${EXCHANGE_DOMAIN}:${i};" \
-            /etc/nginx/sites-enabled/proxy
-    for SECEXCH in $(get_secondary_exchange_hosts); do
-      sed -i -e "/<SERVERS_HERE>/a \ \ server 
${SECONDARY_EXCH_DOMAIN//\*/${SECEXCH}}:${i};" \
+  EXCHANGES=$(get_exchange_hosts)
+
+  for PORT in $(seq $START $END); do
+    for HOST in ${EXCHANGES}; do
+      sed -i -e "/<SERVERS_HERE>/a \ \ server 
${EXCHANGE_DOMAIN//\*/${HOST}}:${PORT};" \
               /etc/nginx/sites-enabled/proxy
     done
   done
@@ -55,7 +45,12 @@ function create_cert() {
   
 # Setup the node and proxy configuration
 function setup_config() {
-  add_exchanges ${NUM_EXCHANGE_PROCESSES}
+
+  sed -i -e "s/<PROXY_DOMAIN_HERE>/${PROXY_DOMAIN}/g" \
+         /etc/nginx/sites-enabled/proxy
+
+  
+  add_exchanges "0" ${NUM_EXCHANGE_PROCESSES}
   
   # Nginx will log to our rsyslog directly an then from there it will be 
   # redirected to promtail - there was an issue doing it directly that's
@@ -95,13 +90,14 @@ function init_proxy() {
   
   # Nginx does not start until the destination server is reachable - wait here
   # nginx: [emerg] host not found in upstream "exch.perf.taler" ...
-  wait_for_keys "${EXCHANGE_DOMAIN}:10000"
+  wait_for_keys "${PRIMARY_EXCHANGE}:10000"
   
   systemctl restart nginx
 }
 
 # Remove N exchanges from the upstream list
-# $1: N - number of exchanges to remove
+# $1: N - number of currently running exchanges
+# $2: N - number of exchanges to remove
 function remove_exchanges() {
 
   # We know we started from port 10000
@@ -109,11 +105,11 @@ function remove_exchanges() {
   let "START=$1+10000"
   let "END=$START-$2"
 
+  EXCHANGES=$(get_exchange_hosts)
+
   for PORT in $(seq $START $END); do
-    sed -i "/${EXCHANGE_DOMAIN}:${PORT};/d" \
-            /etc/nginx/sites-enabled/proxy
-    for SECEXCH in $(get_secondary_exchange_hosts); do
-      sed -i "/${SECONDARY_EXCH_DOMAIN//\*/${SECEXCH}}:${PORT};/d" \
+    for HOST in ${EXCHANGES}; do
+      sed -i "/${EXCHANGE_DOMAIN//\*/${HOST}}:${PORT};/d" \
             /etc/nginx/sites-enabled/proxy
     done
   done
@@ -124,7 +120,7 @@ case $1 in
     init_proxy
     ;;
   start)
-    add_exchanges $2
+    add_exchanges $2 $3
     ;;
   stop)
     remove_exchanges $2 $3
diff --git a/experiment/scripts/run.sh b/experiment/scripts/run.sh
index 9f33c2e..6c85c1f 100644
--- a/experiment/scripts/run.sh
+++ b/experiment/scripts/run.sh
@@ -10,8 +10,6 @@ then
   systemctl restart prometheus-node-exporter
 fi
 
-HOST=$(hostname | cut -d '.' -f1)
-
 if [[ "${HOSTNAME}" =~ ${BANK_HOSTS} ]]; then 
     set_host bank
     set_ddn ${BANK_DOMAIN}
@@ -26,24 +24,21 @@ elif [[ "${HOSTNAME}" =~ ${DB_HOSTS} ]]; then
     exec ~/scripts/database.sh init
 elif [[ "${HOSTNAME}" =~ ${SHARD_HOSTS} ]]; then 
     set_host shard
-    set_ddn "${SHARD_DOMAIN//\*/${HOST}}"
+    set_ddn "${SHARD_DOMAIN//\*/${G5K_HOST}}"
     setup_log
     enable_logrotate
     exec ~/scripts/shard.sh init
 elif [[ "${HOSTNAME}" =~ ${EXCHANGE_HOSTS} ]]; then 
     set_host primary-exchange
-    set_ddn ${EXCHANGE_DOMAIN}
-    setup_log
-    enable_logrotate
-    enable_netdelay ${DATABASE_DOMAIN}
-    exec ~/scripts/exchange.sh init-primary
-elif [[ "${HOSTNAME}" =~ ${SECEXCH_HOSTS} ]]; then 
-    set_host secondary-exchange
-    set_ddn ${SECONDARY_EXCH_DOMAIN//\*/${HOST}}
+    set_ddn ${EXCHANGE_DOMAIN//\*/${G5K_HOST}}
     setup_log
     enable_logrotate
     enable_netdelay ${DATABASE_DOMAIN}
-    exec ~/scripts/exchange.sh init-secondary
+    if [[ "${G5K_HOST}" =~ ${PRIMARY_EXCHANGE} ]]; then
+      exec ~/scripts/exchange.sh init-primary
+    else
+      exec ~/scripts/exchange.sh init-secondary
+    fi
 elif [[ "${HOSTNAME}" =~ ${AGGREGATOR_HOSTS} ]]; then 
     set_host exchange-aggregator
     set_ddn ${EXCH_AGGREGATOR_DOMAIN}
@@ -85,7 +80,7 @@ elif [[ "${HOSTNAME}" =~ ${MONITOR_HOSTS} ]]; then
 elif [[ "${HOSTNAME}" =~ ${PROXY_HOSTS} ]]; then 
     set_host proxy
     set_ddn ${PROXY_DOMAIN}
-    enable_netdelay ${EXCHANGE_DOMAIN}
+    enable_netdelay ${PRIMARY_EXCHANGE}
     setup_log
     enable_logrotate
     exec ~/scripts/proxy.sh init
@@ -94,7 +89,7 @@ elif [[ "${HOSTNAME}" =~ ${DNS_HOSTS} ]]; then
     exec ~/scripts/dns.sh
 else
     set_host wallet
-    set_ddn "${WALLET_DOMAIN//\*/${HOST}}"
+    set_ddn "${WALLET_DOMAIN//\*/${G5K_HOST}}"
     enable_netdelay ${PROXY_DOMAIN}
     setup_log
     exec ~/scripts/wallet.sh init
diff --git a/experiment/scripts/setup.sh b/experiment/scripts/setup.sh
index a84d5ce..ca04ec2 100644
--- a/experiment/scripts/setup.sh
+++ b/experiment/scripts/setup.sh
@@ -34,11 +34,23 @@ function parse_experiment_nodes() {
                                   join("|") |
                                  select(. != "") // "none"'
     )
+    if [[ ${NODE} == "Exchange" ]]; then
+      # Dynamically define one exchange node as primary (the one which
+      # is responsible for key creation)
+      PRIMARY_EXCH=$(\
+          echo ${NODES_STR} | \
+          awk -F '|' '{print $1}' | \
+         cut -d '.' -f 1 \
+      )
+      echo "PRIMARY_EXCHANGE=\"${EXCHANGE_DOMAIN//\*${PRIMARY_EXCH}}\"" >> 
~/.env
+    fi
     echo "${NODE^^}_HOSTS=\"${NODES_STR}\"" >> ~/.env
     echo "NUM_${NODE^^}S=$(echo ${NODES_STR} | awk -F '|' '{print NF}')" >> 
~/.env
   done
-  
+
   echo "WALLET_HOSTS=*" >> ~/.env
+
+  echo "G5K_HOST=\"$(hostname | cut -d '.' -f1)\"" >> ~/.env
 }
 
 # Determine and create the base log directory
diff --git a/experiment/scripts/taler-perf.sh b/experiment/scripts/taler-perf.sh
index ead861f..a11b933 100644
--- a/experiment/scripts/taler-perf.sh
+++ b/experiment/scripts/taler-perf.sh
@@ -3,17 +3,12 @@ set -e
 
 source ~/scripts/helpers.sh
 
-function update_processes() {
-  case "$1" in 
-    prometheus)
-      ssh -A -o StrictHostKeyChecking=no ${MONITOR_DOMAIN} \
-                "/bin/bash /root/scripts/monitor.sh start"
-      ;;
-    *)
-      echo "Unknown argument '$1' for function ${FUNCNAME[0]}"
-      echo "Usage: update [prometheus]"
-      ;;
-  esac
+function get_running_exchanges_per_host() {
+  RUNNING=$(\
+    ssh -o StrictHostKeyChecking=no ${PRIMARY_EXCHANGE} \
+           "/bin/bash ps -aux | grep [taler]-exchange-httpd | wc -l" \
+  )
+  echo "${RUNNING}"
 }
 
 function start_wallets() {
@@ -32,24 +27,16 @@ function stop_wallets() {
   wait
 }
 
-function get_running_exchanges_per_host() {
-  RUNNING=$(\
-    ssh -o StrictHostKeyChecking=no ${EXCHANGE_DOMAIN} \
-           "/bin/bash ps -aux | grep [taler-exchange-httpd]@*.service | wc -l" 
\
-  )
-  echo "${RUNNING}"
-}
-
 function start_exchanges() {
-  ssh -o StrictHostKeyChecking=no ${EXCHANGE_DOMAIN} \
-         "/bin/bash /root/scripts/exchange.sh start 
${1:-${NUM_EXCHANGE_PROCESSES}}" 
-  for SECEXCH in $(get_secondary_exchange_hosts); do
-    ssh -o StrictHostKeyChecking=no ${SECONDARY_EXCH_DOMAIN//\*/${SECEXCH}} \
+  RUNNING=$(get_running_exchanges_per_host)
+  for HOST in $(get_exchange_hosts); do
+    ssh -o StrictHostKeyChecking=no ${EXCHANGE_DOMAIN//\*/${HOST}} \
            "/bin/bash /root/scripts/exchange.sh start 
${1:-${NUM_EXCHANGE_PROCESSES}}" 
   done
   ssh -o StrictHostKeyChecking=no ${PROXY_DOMAIN} \
-         "/bin/bash /root/scripts/proxy.sh start 
${1:-${NUM_EXCHANGE_PROCESSES}}"
-  update_processes "prometheus"
+         "/bin/bash /root/scripts/proxy.sh start ${RUNNING} 
${1:-${NUM_EXCHANGE_PROCESSES}}"
+  ssh -o StrictHostKeyChecking=no ${MONITOR_DOMAIN} \
+         "/bin/bash /root/scripts/monitor.sh start ${RUNNING} 
${1:-${NUM_EXCHANGE_PROCESSES}}"
 }
 
 function stop_exchanges() {
@@ -61,10 +48,8 @@ function stop_exchanges() {
   ssh -A -o StrictHostKeyChecking=no ${PROXY_DOMAIN} \
          "/bin/bash /root/scripts/proxy.sh stop ${RUNNING} 
${1:-${NUM_EXCHANGE_PROCESSES}}"
   sleep 5
-  ssh -o StrictHostKeyChecking=no ${EXCHANGE_DOMAIN} \
-         "/bin/bash /root/scripts/exchange.sh stop 
${1:-${NUM_EXCHANGE_PROCESSES}}" 
-  for SECEXCH in $(get_secondary_exchange_hosts); do
-    ssh -o StrictHostKeyChecking=no ${SECONDARY_EXCH_DOMAIN//\*/${SECEXCH}} \
+  for HOST in $(get_exchange_hosts); do
+    ssh -o StrictHostKeyChecking=no ${EXCHANGE_DOMAIN//\*/${HOST}} \
            "/bin/bash /root/scripts/exchange.sh stop 
${1:-${NUM_EXCHANGE_PROCESSES}}" 
   done
 }
diff --git a/experiment/taler.many.rspec b/experiment/taler.many.rspec
index 1c45d9e..9f2671f 100644
--- a/experiment/taler.many.rspec
+++ b/experiment/taler.many.rspec
@@ -76,7 +76,7 @@
     <hardware_type name="dahu-grenoble"/>
     <location xmlns="http://jfed.iminds.be/rspec/ext/jfed/1"; x="913.5" 
y="137.5"/>
   </node>
-  <node client_id="SecExch" exclusive="true" 
component_manager_id="urn:publicid:IDN+am.grid5000.fr+authority+am">
+  <node client_id="Exchange-1" exclusive="true" 
component_manager_id="urn:publicid:IDN+am.grid5000.fr+authority+am">
     <sliver_type name="raw-pc">
       <disk_image 
name="http://public.lille.grid5000.fr/~bfhch01/taler-debian11.dsc"/>
     </sliver_type>
@@ -443,4 +443,4 @@
     </sliver_type>
     <location xmlns="http://jfed.iminds.be/rspec/ext/jfed/1"; 
x="904.9999999999999" y="564.0"/>
   </node>
-</rspec>
\ No newline at end of file
+</rspec>
diff --git a/experiment/taler.rspec b/experiment/taler.rspec
index 14cc3c8..050b227 100644
--- a/experiment/taler.rspec
+++ b/experiment/taler.rspec
@@ -196,11 +196,11 @@
     <hardware_type name="dahu-grenoble"/>
     <location xmlns="http://jfed.iminds.be/rspec/ext/jfed/1"; x="671.5" 
y="221.5"/>
   </node>
-  <node client_id="SecExch" exclusive="true" 
component_manager_id="urn:publicid:IDN+am.grid5000.fr+authority+am">
+  <node client_id="Exchange-1" exclusive="true" 
component_manager_id="urn:publicid:IDN+am.grid5000.fr+authority+am">
     <sliver_type name="raw-pc">
       <disk_image 
name="http://public.lille.grid5000.fr/~bfhch01/taler-debian11.dsc"/>
     </sliver_type>
     <hardware_type name="dahu-grenoble"/>
     <location xmlns="http://jfed.iminds.be/rspec/ext/jfed/1"; x="360.0" 
y="162.5"/>
   </node>
-</rspec>
\ No newline at end of file
+</rspec>

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