gnunet-svn
[Top][All Lists]
Advanced

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

[taler-deployment] branch master updated (cd58403 -> 95d0db0)


From: gnunet
Subject: [taler-deployment] branch master updated (cd58403 -> 95d0db0)
Date: Thu, 06 Oct 2022 12:02:50 +0200

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

ms pushed a change to branch master
in repository deployment.

    from cd58403  docker: launch wirewatch
     new dd82355  docker MVP
     new 95d0db0  README

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docker/hybrid/README                     | 53 ++++++++++++++++++++++++++++++++
 docker/hybrid/docker-compose.yml         |  5 +--
 docker/hybrid/images/base/Dockerfile     | 13 ++++++--
 docker/hybrid/images/exchange/startup.sh | 11 +++++--
 docker/hybrid/images/libeufin/startup.sh |  8 ++++-
 docker/hybrid/images/merchant/startup.sh | 34 ++++++++++++++++----
 docker/hybrid/images/merchant/taler.conf | 16 ++++++----
 docker/hybrid/test-docker-mvp.sh         |  9 ++++++
 8 files changed, 130 insertions(+), 19 deletions(-)
 create mode 100644 docker/hybrid/README
 create mode 100755 docker/hybrid/test-docker-mvp.sh

diff --git a/docker/hybrid/README b/docker/hybrid/README
new file mode 100644
index 0000000..1ae6141
--- /dev/null
+++ b/docker/hybrid/README
@@ -0,0 +1,53 @@
+Description
+===========
+
+This setup orchestrates the following containers:
+
+1.  Banking (libEufin)
+2.  Shop(s)
+3.  Payment service provider (Taler exchange and helpers)
+
+Note: one stratagem was however needed to make it work.
+The merchant container needs to redirect requests to
+"localhost:$EXCHANGE_PORT_AT_HOST" to the Docker network,
+in order to actually reach the exchange.  That fixes the
+"/pay" handling, since wallets suggest the exchange base URL
+but have a different network view, because they run outside
+of Docker.
+
+How to compile
+==============
+
+Base image
+----------
+
+This image contains a minimal Debian distribution
+with ALL the Taler software and its dependencies.
+
+Navigate to the "images/base" folder, and run the
+following command:
+
+  $ docker build --no-cache -t taler_local/taler_base .
+
+Compose
+-------
+
+From this folder, run:
+  $ docker-compose down # deletes state from previous runs.
+  $ docker-compose build
+
+How to run
+==========
+
+From this folder, run:
+  $ docker-compose up
+
+How to test
+===========
+
+From this folder, run:
+  
+  $ ./test-docker-mvp.sh
+
+The above test registers a new bank account to libEufin,
+withdraw coins and spend them directly at the merchant backend.
diff --git a/docker/hybrid/docker-compose.yml b/docker/hybrid/docker-compose.yml
index 22e9da3..4217eec 100644
--- a/docker/hybrid/docker-compose.yml
+++ b/docker/hybrid/docker-compose.yml
@@ -20,9 +20,10 @@ services:
       - talerdb
     ports:
       - 5556:80
+      - 5559:8080 # Blog
 
   bank:
     build: ./images/libeufin
     ports:
-      - 5557:5000 # Sandbox
-      - 5558:5001 # Nexus
+      - 5000:5000 # Sandbox
+      - 5001:5001 # Nexus
diff --git a/docker/hybrid/images/base/Dockerfile 
b/docker/hybrid/images/base/Dockerfile
index cd2cf4c..380b949 100644
--- a/docker/hybrid/images/base/Dockerfile
+++ b/docker/hybrid/images/base/Dockerfile
@@ -6,15 +6,17 @@ RUN apt-get install -y autoconf autopoint libtool texinfo \
   libjansson-dev python3-pip git recutils libsqlite3-dev \
   libpq-dev postgresql libcurl4-openssl-dev libsodium-dev git \
   libqrencode-dev zip jq nodejs npm openjdk-17-jre nginx procps \
-  curl python3-jinja2 wget curl python3-sphinx python3-sphinx-rtd-theme
+  curl python3-jinja2 wget curl python3-sphinx \
+  socat python3-sphinx-rtd-theme
 
-RUN pip3 install requests click
+RUN pip3 install requests click poetry uwsgi
 
 RUN git clone git://git.gnunet.org/libmicrohttpd
 RUN git clone git://git.gnunet.org/gnunet
 RUN git clone git://git.taler.net/exchange /exchange
 RUN git clone git://git.taler.net/merchant /merchant
 RUN git clone git://git.taler.net/libeufin /libeufin
+RUN git clone git://git.taler.net/taler-merchant-demos /taler-merchant-demos
 
 WORKDIR /libmicrohttpd
 RUN ./bootstrap
@@ -42,3 +44,10 @@ WORKDIR /libeufin
 RUN ./bootstrap
 RUN ./configure
 RUN make install
+
+WORKDIR /taler-merchant-demos
+RUN ./bootstrap
+RUN ./configure
+RUN make install
+
+WORKDIR /
diff --git a/docker/hybrid/images/exchange/startup.sh 
b/docker/hybrid/images/exchange/startup.sh
index f770985..c566d76 100644
--- a/docker/hybrid/images/exchange/startup.sh
+++ b/docker/hybrid/images/exchange/startup.sh
@@ -8,9 +8,10 @@ EXCHANGE_NEXUS_USERNAME=exchange-at-nexus
 EXCHANGE_NEXUS_PASSWORD=x
 EXCHANGE_IBAN=DE159593
 TALER_FACADE_NAME=taler-facade
+CURRENCY=EUR
 
 sed -i 's/__EXCHANGE_URL__/http:\/\/exchange\//' /config/taler.conf
-sed -i 's/__CURRENCY__/EUR/' /config/taler.conf
+sed -i "s/__CURRENCY__/${CURRENCY}/" /config/taler.conf
 sed -i "s/__EXCHANGE_NEXUS_USERNAME__/${EXCHANGE_NEXUS_USERNAME}/" 
/config/taler.conf
 sed -i "s/__EXCHANGE_NEXUS_PASSWORD__/${EXCHANGE_NEXUS_PASSWORD}/" 
/config/taler.conf
 sed -i "s/__EXCHANGE_IBAN__/${EXCHANGE_IBAN}/" /config/taler.conf
@@ -50,5 +51,11 @@ for n in `seq 1 80`
 echo Echange launched.
 taler-exchange-wirewatch -L DEBUG -c /config/taler.conf &
 
-taler-exchange-offline -c /config/taler.conf download sign upload
+taler-exchange-offline -c /config/taler.conf \
+  download sign \
+  enable-account 
"payto://iban/SANDBOXX/${EXCHANGE_IBAN}?receiver-name=Exchange+Company" \
+  wire-fee now iban ${CURRENCY}:0.01 ${CURRENCY}:0.01 ${CURRENCY}:0.01 \
+  global-fee now ${CURRENCY}:0.01 ${CURRENCY}:0.01 ${CURRENCY}:0.01 
${CURRENCY}:0.01 1h 1h 1year 5 \
+  upload
+
 wait
diff --git a/docker/hybrid/images/libeufin/startup.sh 
b/docker/hybrid/images/libeufin/startup.sh
index 5389c31..4c35cdb 100644
--- a/docker/hybrid/images/libeufin/startup.sh
+++ b/docker/hybrid/images/libeufin/startup.sh
@@ -31,18 +31,24 @@ is_serving() {
   echo $2 reachable.
 }
 
+EXCHANGE_IBAN=DE159593
+
 export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:/libeufin.sqlite3"
 export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=secret
 export LIBEUFIN_SANDBOX_URL="http://localhost:5000/demobanks/default";
 echo -n "Creating EUR default demobank..."
 libeufin-sandbox config --currency EUR default
 echo DONE
+echo -n "Specify default exchange..."
+libeufin-sandbox default-exchange \
+  http://localhost:5555/ \
+  "payto://iban/SANDBOXX/${EXCHANGE_IBAN}?receiver-name=Exchange+Company"
+echo DONE
 echo -n "Launching Sandbox..."
 libeufin-sandbox serve --no-localhost-only &
 echo DONE
 is_serving 5000 Sandbox
 
-EXCHANGE_IBAN=DE159593
 EXCHANGE_SANDBOX_USERNAME=exchange-at-sandbox
 EXCHANGE_SANDBOX_PASSWORD=x
 echo -n "Register the Exchange at Sandbox..."
diff --git a/docker/hybrid/images/merchant/startup.sh 
b/docker/hybrid/images/merchant/startup.sh
index eeb9bde..d1b7994 100644
--- a/docker/hybrid/images/merchant/startup.sh
+++ b/docker/hybrid/images/merchant/startup.sh
@@ -24,17 +24,39 @@ for n in `seq 1 30`
   fi
 echo Echange reachable.
 
+#FIXME: wallets external to the containers put localhost'ed
+# exchanges along a /pay request.  That breaks here, since the
+# exchange listens from another container.  The following
+# command routes every request to 5555 (port on the host
+# system that points to a contained exchange AND where the
+# merchant tries to /deposit), to the container where the exchange listens.
+socat TCP-LISTEN:5555,fork,reuseaddr TCP:exchange:80 &
+
+CURRENCY=EUR
+BACKEND_APIKEY=secret
 EXCHANGE_MASTER_PUB=$(curl -s http://exchange/keys | jq -r .master_public_key)
 echo Found Exchange Pub: $EXCHANGE_MASTER_PUB
-sed -i 's/\${EXCHANGE_URL}/http:\/\/exchange\//' /config/taler.conf
-sed -i "s/\${EXCHANGE_PUB}/${EXCHANGE_MASTER_PUB}/" /config/taler.conf
-sed -i 's/\${CURRENCY}/EUR/' /config/taler.conf
-
+sed -i 's/__EXCHANGE_URL__/http:\/\/exchange\//' /config/taler.conf
+sed -i "s/__EXCHANGE_PUB__/${EXCHANGE_MASTER_PUB}/" /config/taler.conf
+sed -i "s/__CURRENCY__/${CURRENCY}/" /config/taler.conf
+sed -i "s/__BACKEND_APIKEY__/${BACKEND_APIKEY}/" /config/taler.conf
+echo -n "Reset database..."
 taler-merchant-dbinit -c /config/taler.conf --reset
+echo DONE
+echo -n "Launch merchant backend..."
 taler-merchant-httpd -c /config/taler.conf &
+echo DONE
 sleep 1
-
+echo -n "Create default instance..."
 curl -s -H "Content-Type: application/json" -X POST -d 
'{"auth":{"method":"external"},"payto_uris":["payto://iban/SANDBOXX/DE474361?receiver-name=Merchant43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"EUR:1",
 
"default_max_deposit_fee":"EUR:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
 : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' 
http://merchant/management/instances
+echo DONE
+
+# FIXME: the command below works around a known bug,
+# where demo sites ingnore the "-c" option.
+# mkdir ${HOME}/.config/ 
+# ln -s /config/taler.conf ${HOME}/.config/ 
+# echo -n "Launch blog..."
+# ${HOME}/.local/bin/taler-merchant-demos --http-port 8080 blog &
+# echo DONE
 
-echo Default instance created.
 wait
diff --git a/docker/hybrid/images/merchant/taler.conf 
b/docker/hybrid/images/merchant/taler.conf
index cd50bba..81aa5cc 100644
--- a/docker/hybrid/images/merchant/taler.conf
+++ b/docker/hybrid/images/merchant/taler.conf
@@ -1,20 +1,20 @@
 [taler]
-currency = ${CURRENCY}
+currency = __CURRENCY__
 
 [paths]
 TALER_DATA_HOME = /data
 
-[merchant-exchange-${CURRENCY}]
-currency = ${CURRENCY}
+[merchant-exchange-__CURRENCY__]
+currency = __CURRENCY__
 exchange_base_url = http://exchange/
-master_key = ${EXCHANGE_PUB}
+master_key = __EXCHANGE_PUB__
 
 [merchantdb-postgres]
 config = postgres://talerdb/taler
 
 [merchant]
-default_max_deposit_fee = ${CURRENCY}:0.05
-default_max_wire_fee = ${CURRENCY}:0.01
+default_max_deposit_fee = __CURRENCY__:0.05
+default_max_wire_fee = __CURRENCY__:0.01
 wire_transfer_delay = 0 s
 port = 80
 serve = tcp
@@ -22,3 +22,7 @@ serve = tcp
 [merchant-account-merchant]
 wire_file_mode = 770
 wire_response = ${TALER_DATA_HOME}/merchant/wire/merchant.json
+
+[frontends]
+backend = http://localhost/
+backend_apikey = __BACKEND_APIKEY__
diff --git a/docker/hybrid/test-docker-mvp.sh b/docker/hybrid/test-docker-mvp.sh
new file mode 100755
index 0000000..74df183
--- /dev/null
+++ b/docker/hybrid/test-docker-mvp.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+taler-wallet-cli --no-throttle api --expect-success 'runIntegrationTest' \
+  '{"amountToSpend":"EUR:1",
+    "amountToWithdraw":"EUR:3",
+    "bankBaseUrl":"http://localhost:5000/demobanks/default/access-api/";,
+    "exchangeBaseUrl":"http://localhost:5555/";,
+    "merchantBaseUrl":"http://localhost:5556/";
+  }'

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