gnunet-svn
[Top][All Lists]
Advanced

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

[taler-deployment] branch master updated: NLnet task 5


From: gnunet
Subject: [taler-deployment] branch master updated: NLnet task 5
Date: Tue, 25 Jul 2023 21:06:49 +0200

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

ms pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new 8771795  NLnet task 5
8771795 is described below

commit 8771795796200155036eb6f96b7ef2d08af3618d
Author: MS <ms@taler.net>
AuthorDate: Tue Jul 25 21:06:16 2023 +0200

    NLnet task 5
    
    Demonstrating the long-polling.
---
 nlnet/task5/long-poll/Dockerfile |   4 +-
 nlnet/task5/long-poll/start.sh   | 154 +++++++++++++++++++++++++++++++--------
 2 files changed, 124 insertions(+), 34 deletions(-)

diff --git a/nlnet/task5/long-poll/Dockerfile b/nlnet/task5/long-poll/Dockerfile
index 46eebdb..713e47e 100644
--- a/nlnet/task5/long-poll/Dockerfile
+++ b/nlnet/task5/long-poll/Dockerfile
@@ -1,12 +1,12 @@
 FROM debian:stable
 
 RUN apt-get update
-RUN apt-get install -y openjdk-17-jre git python3-pip curl jq sqlite3 
postgresql python3-requests python3-click sudo
+RUN apt-get install -y openjdk-17-jre git python3-pip curl jq sqlite3 
postgresql python3-requests python3-click sudo libgnunet0.19
 
 # Installation
 RUN git clone git://git.taler.net/libeufin
 WORKDIR /libeufin
-RUN git fetch && git checkout 4bc5f38f571a45d427f73813ec3846bf59413afa
+RUN git fetch && git checkout 934a73b09b9e9abba348e15ddc058df5bb9cd6a3
 RUN ./bootstrap
 RUN ./configure --prefix=/usr/local
 RUN make install
diff --git a/nlnet/task5/long-poll/start.sh b/nlnet/task5/long-poll/start.sh
old mode 100644
new mode 100755
index 35edd9c..46a0af2
--- a/nlnet/task5/long-poll/start.sh
+++ b/nlnet/task5/long-poll/start.sh
@@ -1,44 +1,134 @@
 #!/bin/bash
 
+set -eu
+
+service postgresql start
+sudo -u postgres createuser -s root
+createdb libeufincheck
+
 wire_transfer () {
-  /libeufin/cli/tests/wire-transfer.sh
+  RESERVE_PUB=$(gnunet-ecc -g1 /tmp/www &> /dev/null && gnunet-ecc -p /tmp/www)
+  DB_CONN="postgresql:///libeufincheck"
+  libeufin-sandbox \
+    make-transaction \
+      --credit-account=sandbox-user \
+      --debit-account=admin MANA:2 \
+      $RESERVE_PUB
 }
 
-(/libeufin/cli/tests/launch_services_with_xlibeufinbank.sh &> /dev/null) &
-# Wait Nexus to be online:
-OK="0"
-echo -n "Waiting for Nexus ..."
-for n in $(seq 1 100); do
-  echo -n "."
-  sleep 1
-  wget --timeout=1 \
-       --tries=3 \
-       --waitretry=0 \
-       -o /dev/null \
-       -O /dev/null \
-       http://localhost:5001 || continue
-  OK="1"
-  break
-done
-if [ "1" != "$OK" ]
-then
-  echo "Failed to launch services."
-  exit 1
+WITH_TASKS=1
+echo RUNNING SANDBOX-NEXUS EBICS PAIR
+jq --version &> /dev/null || (echo "'jq' command not found"; exit 77)
+curl --version &> /dev/null || (echo "'curl' command not found"; exit 77)
+
+DB_CONN="postgresql:///libeufincheck"
+export LIBEUFIN_SANDBOX_DB_CONNECTION=$DB_CONN
+export LIBEUFIN_NEXUS_DB_CONNECTION=$DB_CONN
+
+echo -n Delete previous data...
+libeufin-sandbox reset-tables
+libeufin-nexus reset-tables
+echo DONE
+echo -n Configure the default demobank with MANA...
+libeufin-sandbox config --with-signup-bonus --currency MANA default
+echo DONE
+echo -n Setting the default exchange at Sandbox...
+libeufin-sandbox \
+  default-exchange \
+  "https://exchange.example.com/"; \
+  "payto://iban/NOTUSED"
+echo DONE
+echo -n Start the bank...
+export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=foo
+libeufin-sandbox serve > sandbox.log 2>&1 &
+SANDBOX_PID=$!
+echo DONE
+echo -n Wait for the bank...
+curl --max-time 4 --retry-all-errors --retry-connrefused --retry-delay 1 
--retry 10 http://localhost:5000/ &> /dev/null
+echo DONE
+echo -n Make one superuser at Nexus...
+libeufin-nexus superuser test-user --password x
+echo DONE
+echo -n Launching Nexus...
+libeufin-nexus serve &> nexus.log &
+NEXUS_PID=$!
+echo DONE
+echo -n Waiting for Nexus...
+curl --max-time 4 --retry-all-errors --retry-connrefused --retry-delay 1 
--retry 10 http://localhost:5001/ &> /dev/null
+echo DONE
+
+echo -n "Register the Sandbox account..."
+export LIBEUFIN_SANDBOX_USERNAME=sandbox-user
+export LIBEUFIN_SANDBOX_PASSWORD=foo
+libeufin-cli \
+  sandbox --sandbox-url http://localhost:5000/ \
+  demobank \
+  register
+echo DONE
+echo -n Creating the x-libeufin-bank connection at Nexus...
+export LIBEUFIN_NEXUS_USERNAME=test-user
+export LIBEUFIN_NEXUS_PASSWORD=x
+export LIBEUFIN_NEXUS_URL=http://localhost:5001
+# echoing the password to STDIN, as that is a "prompt" option.
+libeufin-cli connections new-xlibeufinbank-connection \
+  --bank-url "http://localhost:5000/demobanks/default/access-api"; \
+  --username sandbox-user \
+  --password foo \
+  wwwconn
+echo DONE
+echo -n Connecting the x-libeufin-bank connection...
+libeufin-cli connections connect wwwconn
+echo DONE
+# Importing the bank account under a local name at Nexus.
+echo -n Importing the x-libeufin-bank account locally..
+libeufin-cli connections import-bank-account \
+  --offered-account-id sandbox-user \
+  --nexus-bank-account-id foo-at-nexus wwwconn
+echo DONE
+echo -n Create the Taler facade at Nexus...
+libeufin-cli facades \
+  new-taler-wire-gateway-facade \
+  --currency TESTKUDOS --facade-name test-facade \
+  wwwconn foo-at-nexus
+echo DONE
+if test 1 = $WITH_TASKS; then
+  echo -n Creating submit transactions task..
+  libeufin-cli accounts task-schedule \
+    --task-type submit \
+    --task-name www-payments \
+    --task-cronspec "* * *" \
+    foo-at-nexus || true
+  # Tries every second.  Ask C52
+  echo DONE
+  echo -n Creating fetch transactions task..
+  # Not idempotent, FIXME #7739
+  libeufin-cli accounts task-schedule \
+    --task-type fetch \
+    --task-name www-history \
+    --task-cronspec "* * *" \
+    --task-param-level statement \
+    --task-param-range-type since-last \
+    foo-at-nexus || true
+  echo DONE
+else
+  echo NOT creating background tasks!
 fi
-echo "OK"
 
 echo
-echo Services are online!  The following shell offers a 'wire-transfer.sh'
+echo Services are online!  The following shell offers a 'wire_transfer'
 echo command that wires money to Nexus 'test-user'.  Give it after having
-echo connected an HTTP client that long-polls to Nexus.
+echo connected an HTTP client that long-polls to Nexus.  As an example, a
+echo 100 seconds long-poller to Nexus is the following command:
+echo curl -v -u test-user:x 
"'http://localhost:5001/facades/test-facade/taler-wire-gateway/history/incoming?delta=5&long_poll_ms=100000'"
+echo
+echo Hint: after having issued the previous command and having observed
+echo that it actually long-polls, press CTRL-Z to send it in the background,
+echo "then wire the funds to the long-poller with 'wire_transfer',"
+echo "and finally give 'fg 1' to bring the long-poller in the foreground."
+echo If the client now shows a response, then the long-polling mechanism
+echo worked.
 echo
 
-cd /usr/bin/
-ln -s /libeufin/cli/tests/wire-transfer.sh
+cd /
+export -f wire_transfer
 bash
-
-# This command has 100 seconds long-polling.  It can be
-# used before the user create any wire transfer to 'test-user'
-# to show how those then actually make Neuxs respond to
-# the long-poller.
-# curl -v -u test-user:x 
"http://localhost:5001/facades/test-facade/taler-wire-gateway/history/incoming?delta=5&long_poll_ms=100000";

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