gnunet-svn
[Top][All Lists]
Advanced

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

[taler-grid5k] 14/141: add dyndns to setup script


From: gnunet
Subject: [taler-grid5k] 14/141: add dyndns to setup script
Date: Thu, 18 Nov 2021 14:49:15 +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 e2fe77bda573d554729f770af9adc752fae83fa0
Author: Boss Marco <bossm8@bfh.ch>
AuthorDate: Sun Oct 3 21:40:12 2021 +0200

    add dyndns to setup script
---
 etc/.empty                      |  0
 etc/bind/named.conf.local       |  2 +-
 etc/bind/{zones => }/perf.taler |  0
 jfed/setup.sh                   | 63 +++++++++++++++++++++++++++++++++++------
 4 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/etc/.empty b/etc/.empty
deleted file mode 100644
index e69de29..0000000
diff --git a/etc/bind/named.conf.local b/etc/bind/named.conf.local
index eef37eb..71f0655 100755
--- a/etc/bind/named.conf.local
+++ b/etc/bind/named.conf.local
@@ -5,7 +5,7 @@ key "ddns-key.perf.taler" {
 
 zone "perf.taler" {
   type master;
-  file "/etc/bind/zones/perf.taler";
+  file "/etc/bind/perf.taler";
   update-policy {
     grant ddns-key.perf.taler subdomain perf.taler. ANY;
   };
diff --git a/etc/bind/zones/perf.taler b/etc/bind/perf.taler
similarity index 100%
rename from etc/bind/zones/perf.taler
rename to etc/bind/perf.taler
diff --git a/jfed/setup.sh b/jfed/setup.sh
index 046d2ce..cbbc7e4 100755
--- a/jfed/setup.sh
+++ b/jfed/setup.sh
@@ -4,6 +4,26 @@ set -eua
 
 G5K_HOME=/root/grid5k
 
+DNS_ZONE=perf.taler
+EXCHANGE_DOMAIN=exch.${DNS_ZONE}
+DATABASE_DOMAIN=db.${DNS_ZONE}
+BANK_DOMAIN=bank.${DNS_ZONE}
+
+HOST=$(hostname)
+
+NS_IP=$(host ${DNS_HOST} | sed -n 1p | awk '{print $4}')
+
+# Set a dynamic domain name in our own dns - excepts the domain to be passed
+function set_ddn() {
+  nsupdate -k /root/ddns.key -v << EOF
+server ${NS_IP}
+zone ${DNS_ZONE}
+update add ${1} 60 A $(hostname -I)
+send
+EOF
+}
+
+# Load the environment configuration
 source .env
 cat .env | tee -a /etc/environment
 
@@ -13,21 +33,48 @@ cd ${G5K_HOME} && git checkout node-setup && git pull && cd
 # Override default /etc/ with the one from this Git.
 cp -r ${G5K_HOME}/etc/* /etc
 
-cat << EOF > /root/ddns.key 
+
+if [[ "${HOST}" != "${DNS_HOST}" ]]; then;
+
+  # Add the dyndns key which will be used by the dns update
+  cat << EOF > /root/ddns.key 
 key "ddns-key.perf.taler" {
   algorithm hmac-sha256;
   secret "${DNS_HMAC_SHA256}";
 };
 EOF
+  
+  sed -i "3i\\
+  nameserver ${NS_IP}" /etc/resolv.conf
 
-HOST=$(hostname)
+  # wait for the dns to be initialized before continuing
+  sleep 10
+fi
 
-case "$HOST" in 
-       ${DATABASE_HOSTS}) exec ${G5K_HOME}/scripts/database.sh || echo 
"DATABASE";;
-       ${EXCHANGE_HOSTS}) exec ${G5K_HOME}/scripts/exchange.sh || echo 
"EXCHANGE";;
-       ${BANK_HOSTS}) exec ${G5K_HOME}/scripts/bank.sh || echo "BANK";;
-       ${DNS_HOST}) exec ${G5K_HOME}/scripts/dns.sh || echo "DNS";;
-       ${WALLET_HOSTS}) exec ${G5K_HOME}/scripts/wallet.sh || echo "WALLET";;
+case "${HOST}" in 
+  ${DNS_HOST}) 
+    echo "DNS"
+    exec ${G5K_HOME}/scripts/dns.sh
+    ;;
+  ${BANK_HOSTS}) 
+    echo "BANK"
+    set_ddn ${BANK_DOMAIN}
+    exec ${G5K_HOME}/scripts/bank.sh
+    ;;
+  ${WALLET_HOSTS}) 
+    echo "WALLET"
+    exec ${G5K_HOME}/scripts/wallet.sh 
+    ;;
+  ${DATABASE_HOSTS}) 
+    echo "DATABASE"
+    set_ddn ${DATABASE_DOMAIN}
+    exec ${G5K_HOME}/scripts/database.sh 
+    ;;
+  ${EXCHANGE_HOSTS}) 
+    echo "EXCHANGE"
+    set_ddn ${EXCHANGE_DOMAIN}
+    exec ${G5K_HOME}/scripts/exchange.sh 
+    ;;
 esac
 
 exit 0

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