commit 62ee3e3c7d8430d41cb9a0135ce65ba20ed41cbd
parent 11c9f6c8e996eb52095f167efb89fa1aff9b9df8
Author: MS <ms@taler.net>
Date: Wed, 1 Mar 2023 15:12:44 +0100
netzbon deployment
drafting the libeufin side and one global installer
that defines env variables by asking questions.
Diffstat:
4 files changed, 153 insertions(+), 0 deletions(-)
diff --git a/netzbon/config_launch_libeufin.sh b/netzbon/config_launch_libeufin.sh
@@ -0,0 +1,112 @@
+#!/bin/bash
+
+# This script configure and launches Sandbox and Nexus.
+# The setup provides the admin account at Sandbox, and
+# another account for the exchange at Nexus and Sandbox.
+# A Taler facade to serve taler-wire-gateway requests
+# is also provided. The currency defaults to "NB".
+
+# The environment must provide the following variables:
+# - DATABASE_CONNECTION="jdbc:postgresql://localhost:5432/$DB_NAME?user=$ROLE_NAME"
+# - SANDBOX_ADMIN_PASSWORD: password of the Netzbon administrator.
+# - NEXUS_EXCHANGE_PASSWORD: password of the Nexus user hosted
+# at Nexus, this password will let the Wire-gateway access
+# its banking records. The related username is:
+# exchange-at-nexus
+# - SANDBOX_EXCHANGE_PASSWORD: password of the exchange
+# bank account hosted at Sandbox. The related
+# username is: exchange-at-sandbox
+
+set -eu
+
+function exit_cleanup()
+{
+ echo "Running exit-cleanup"
+ for n in `jobs -p`
+ do
+ kill $n 2> /dev/null || true
+ done
+ wait || true
+ echo "DONE"
+}
+
+trap "exit_cleanup" EXIT
+curl --version &> /dev/null || (echo "'curl' command not found"; exit 77)
+export LIBEUFIN_SANDBOX_DB_CONNECTION=$DATABASE_CONNECTION
+CURRENCY=NB
+echo -n Configure the default demobank with $CURRENCY...
+libeufin-sandbox config --with-signup-bonus --currency $CURRENCY default
+echo DONE
+echo -n Start the bank...
+export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=$SANDBOX_ADMIN_PASSWORD
+libeufin-sandbox serve &> sandbox.log &
+SANDBOX_PID=$!
+echo DONE
+echo -n Wait for the bank...
+curl --max-time 2 --retry-connrefused --retry-delay 1 --retry 10 http://localhost:5000/ &> /dev/null
+echo DONE
+echo -n Make one superuser at Nexus...
+export LIBEUFIN_NEXUS_DB_CONNECTION=$DATABASE_CONNECTION
+libeufin-nexus superuser \
+ exchange-at-nexus \
+ --password $NEXUS_EXCHANGE_PASSWORD
+echo DONE
+echo -n Launching Nexus...
+libeufin-nexus serve &> nexus.log &
+NEXUS_PID=$!
+echo DONE
+echo -n Waiting for Nexus...
+curl --max-time 2 --retry-connrefused --retry-delay 1 --retry 10 http://localhost:5001/ &> /dev/null
+echo DONE
+
+echo -n "Register the exchange Sandbox account..."
+export LIBEUFIN_SANDBOX_USERNAME=exchange-at-sandbox
+export LIBEUFIN_SANDBOX_PASSWORD=$SANDBOX_EXCHANGE_PASSWORD
+libeufin-cli \
+ sandbox --sandbox-url http://localhost:5000/ \
+ demobank register
+echo DONE
+export LIBEUFIN_SANDBOX_USERNAME=admin
+export LIBEUFIN_SANDBOX_PASSWORD=$SANDBOX_ADMIN_PASSWORD
+echo -n "Create EBICS host at Sandbox..."
+libeufin-cli sandbox \
+ --sandbox-url http://localhost:5000 \
+ ebicshost create --host-id NBHOST
+echo OK
+echo -n "Create exchange EBICS subscriber at Sandbox..."
+libeufin-cli sandbox \
+ --sandbox-url http://localhost:5000 \
+ demobank new-ebicssubscriber --host-id NBHOST \
+ --user-id exchangeebics --partner-id talerop \
+ --bank-account exchange-at-sandbox
+echo OK
+export LIBEUFIN_NEXUS_USERNAME=exchange-at-nexus
+export LIBEUFIN_NEXUS_PASSWORD=$NEXUS_EXCHANGE_PASSWORD
+export LIBEUFIN_NEXUS_URL=http://localhost:5001
+echo -n Creating the EBICS connection at Nexus...
+libeufin-cli connections new-ebics-connection \
+ --ebics-url "http://localhost:5000/ebicsweb" \
+ --host-id NBHOST \
+ --partner-id talerop \
+ --ebics-user-id exchangeebics \
+ netzbonconn
+echo DONE
+echo -n Setup EBICS keying...
+libeufin-cli connections connect netzbonconn > /dev/null
+echo OK
+echo -n Download bank account name from Sandbox...
+libeufin-cli connections download-bank-accounts netzbonconn
+echo OK
+echo -n Importing bank account info into Nexus...
+libeufin-cli connections import-bank-account \
+ --offered-account-id exchange-at-sandbox \
+ --nexus-bank-account-id exchange-at-nexus \
+ netzbonconn
+echo OK
+echo -n Create the Taler facade at Nexus...
+libeufin-cli facades \
+ new-taler-wire-gateway-facade \
+ --currency $CURRENCY --facade-name netzbon-facade \
+ netzbonconn exchange-at-nexus
+echo OK
+read -p "Press Enter to terminate..."
diff --git a/netzbon/global.sh b/netzbon/global.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+echo Welcome in the Netzbon configure script.
+
+read -p "Enter the Sandbox admin password " SANDBOX_ADMIN_PASSWORD
+read -p "Enter the database connection " DATABASE_CONNECTION
+read -p "Enter the password for the exchange's Nexus user (username: exchange-at-nexus) " NEXUS_EXCHANGE_PASSWORD
+read -p "Enter the password for the exchange's Sandbox user (username: exchange-at-sandbox) " SANDBOX_EXCHANGE_PASSWORD
+
+. config_launch_libeufin.sh
diff --git a/netzbon/nexus.log b/netzbon/nexus.log
@@ -0,0 +1,13 @@
+14:51:35.727 [main] INFO tech.libeufin.nexus - Starting Nexus on port 5001
+14:51:35.968 [main] DEBUG tech.libeufin.nexus - Application started: io.ktor.server.application.Application@408e96d9
+14:51:36.250 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.nexus - 200 OK: GET - /
+14:51:37.983 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.nexus - 200 OK: POST - /bank-connections
+14:51:38.962 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.nexus - 200 OK: POST - /bank-connections/netzbonconn/connect
+14:51:39.072 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.util - Created EBICS HTD document for download initialization, nonce: B78EC92392E7BA56BA4EEF9BFC0FDCCD
+14:51:39.268 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.util - Bank acknowledges EBICS download initialization. Transaction ID: AAC80F8148D6F3485C0C52438B7B5901.
+14:51:39.331 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.util - Bank acknowledges EBICS download receipt. Transaction ID: AAC80F8148D6F3485C0C52438B7B5901.
+14:51:39.352 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.nexus - 200 OK: POST - /bank-connections/netzbonconn/fetch-accounts
+14:51:39.462 [eventLoopGroupProxy-4-1] INFO tech.libeufin.nexus - Account 1 gets imported
+14:51:39.474 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.nexus - 200 OK: POST - /bank-connections/netzbonconn/import-account
+14:51:39.597 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.nexus - 200 OK: POST - /facades
+14:51:55.876 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.nexus - 200 OK: GET - /
diff --git a/netzbon/sandbox.log b/netzbon/sandbox.log
@@ -0,0 +1,18 @@
+14:51:33.879 [main] INFO tech.libeufin.sandbox - Starting Sandbox on port 5000
+14:51:34.015 [main] DEBUG tech.libeufin.sandbox - Application started: io.ktor.server.application.Application@65d57e4e
+14:51:34.399 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, GET /
+14:51:36.394 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - Maybe wire transfer: admin -> exchange-at-sandbox, Sign-up bonus, NB:100
+14:51:36.483 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, POST /demobanks/default/access-api/testing/register
+14:51:37.081 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, POST /admin/ebics/hosts
+14:51:37.199 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, POST /demobanks/default/ebics/subscribers
+14:51:38.617 [eventLoopGroupProxy-4-1] INFO tech.libeufin.sandbox - Serving a INI request
+14:51:38.656 [eventLoopGroupProxy-4-1] INFO tech.libeufin.sandbox - Signature key inserted in database _and_ subscriber state changed accordingly
+14:51:38.665 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, POST /ebicsweb
+14:51:38.713 [eventLoopGroupProxy-4-1] INFO tech.libeufin.sandbox - Serving a HIA request
+14:51:38.737 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, POST /ebicsweb
+14:51:38.906 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, POST /ebicsweb
+14:51:39.142 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - Handling download initialization for order type HTD, nonce: B78EC92392E7BA56BA4EEF9BFC0FDCCD, transaction ID: AAC80F8148D6F3485C0C52438B7B5901
+14:51:39.241 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, POST /ebicsweb
+14:51:39.301 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - Handling download receipt for EBICS transaction: AAC80F8148D6F3485C0C52438B7B5901
+14:51:39.314 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, POST /ebicsweb
+14:51:53.067 [eventLoopGroupProxy-4-1] DEBUG tech.libeufin.sandbox - 200 OK, GET /