taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

commit 5d33d84929b56d344c80b6ae96802d45835b26c9
parent 597d646bad94a54e00b3e4b4e6a85cfb7bb5aa7a
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  4 Mar 2023 13:53:18 +0100

improve libeufin script to use Debian package better

Diffstat:
Mnetzbon/config_launch_libeufin.sh | 74++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
Mnetzbon/install_debian_packages.sh | 2+-
2 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/netzbon/config_launch_libeufin.sh b/netzbon/config_launch_libeufin.sh @@ -8,7 +8,6 @@ # 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 @@ -28,20 +27,6 @@ set -eu -# FIXME: does this belong here? Or should we -# do this globally in 'main'? -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 - say "Setting up libeufin" # EBICS parameters that must match but are only used internally. @@ -51,32 +36,62 @@ EBICS_USER_ID="exchangeebics" EBICS_CONNECTION_NAME="exchangeconn" # FIXME: "exchange-at-nexus" also should be one of these -export LIBEUFIN_SANDBOX_DB_CONNECTION="${DATABASE_CONNECTION}" +# Load configuration with +# LIBEUFIN_NEXUS_DB_CONNECTION and +# LIBEUFIN_NEXUS_PORT +. /etc/libeufin/nexus.env + +if test -z ${LIBEUFIN_NEXUS_DB_CONNECTION:-} +then + say "Error: /etc/libeufin/nexus.env does not specify LIBEUFIN_NEXUS_DB_CONNECTION" + exit 1 +fi + +# Load configuration with +# LIBEUFIN_SANDBOX_DB_CONNECTION and +# LIBEUFIN_SANDBOX_PORT +. /etc/libeufin/sandbox.env + +if test -z ${LIBEUFIN_SANDBOX_DB_CONNECTION:-} +then + say "Error: /etc/libeufin/sandbox.env does not specify LIBEUFIN_SANDBOX_DB_CONNECTION" + exit 1 +fi + +# - DATABASE_CONNECTION="jdbc:postgresql://localhost:5432/$DB_NAME?user=$ROLE_NAME" + + echo -n "Configure the default demobank with ${CURRENCY}..." -libeufin-sandbox config --with-signup-bonus --currency ${CURRENCY} default +# FIXME: no sign up bonus, no debt should be the default here! +sudo -u libeufin-sandbox libeufin-sandbox config --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=$! + +systemctl enable --now libeufin-sandbox + 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 \ +sudo -u libeufin-nexus libeufin-nexus superuser \ exchange-at-nexus \ --password $NEXUS_EXCHANGE_PASSWORD echo "DONE" echo -n "Launching Nexus..." -libeufin-nexus serve &> nexus.log & -NEXUS_PID=$! + +systemctl enable --now libeufin-nexus + 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 @@ -84,6 +99,8 @@ 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..." @@ -91,6 +108,8 @@ libeufin-cli sandbox \ --sandbox-url http://localhost:5000 \ ebicshost create --host-id ${EBICS_HOST_ID} echo "OK" + + echo -n "Create exchange EBICS subscriber at Sandbox..." libeufin-cli sandbox \ --sandbox-url http://localhost:5000 \ @@ -98,6 +117,8 @@ libeufin-cli sandbox \ --user-id ${EBICS_USER_ID} --partner-id ${EBICS_PARTNER_ID} \ --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" @@ -109,24 +130,25 @@ libeufin-cli connections new-ebics-connection \ --ebics-user-id ${EBICS_USER_ID} \ ${EBICS_CONNECTION_NAME} echo "DONE" + echo -n "Setup EBICS keying..." libeufin-cli connections connect ${EBICS_CONNECTION_NAME} > /dev/null echo "OK" + echo -n "Download bank account name from Sandbox..." libeufin-cli connections download-bank-accounts ${EBICS_CONNECTION_NAME} 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 \ ${EBICS_CONNECTION_NAME} echo "OK" + echo -n "Create the Taler facade at Nexus..." libeufin-cli facades \ new-taler-wire-gateway-facade \ --currency $CURRENCY --facade-name netzbon-facade \ ${EBICS_CONNECTION_NAME} exchange-at-nexus echo "OK" - -systemctl enable --now libeufin-sandbox -systemctl enable --now libeufin-nexus diff --git a/netzbon/install_debian_packages.sh b/netzbon/install_debian_packages.sh @@ -38,4 +38,4 @@ wget -P /etc/apt/keyrings https://taler.net/taler-systems.gpg apt update apt install taler-exchange -y apt install taler-merchant -y -apt install libeufin -y +apt install libeufin-sandbox libeufin-nexus -y