summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2022-09-29 23:16:27 +0200
committerMS <ms@taler.net>2022-09-29 23:16:27 +0200
commit38db50e6ef6de74b36e77b6f725bc82b00e47f68 (patch)
treee49a26b8457d0cef3c3a13eaa9464702281788ca
parent2fd32f23c77af0a811b00476832e830963ff95d7 (diff)
downloaddeployment-master.tar.gz
deployment-master.tar.bz2
deployment-master.zip
docker: launch libeufinHEADmaster
-rw-r--r--docker/hybrid/docker-compose.yml8
-rw-r--r--docker/hybrid/images/base/Dockerfile8
-rw-r--r--docker/hybrid/images/exchange/startup.sh16
-rw-r--r--docker/hybrid/images/exchange/taler.conf33
-rw-r--r--docker/hybrid/images/libeufin/Dockerfile5
-rw-r--r--docker/hybrid/images/libeufin/startup.sh54
6 files changed, 101 insertions, 23 deletions
diff --git a/docker/hybrid/docker-compose.yml b/docker/hybrid/docker-compose.yml
index ede1dc5..7d07879 100644
--- a/docker/hybrid/docker-compose.yml
+++ b/docker/hybrid/docker-compose.yml
@@ -6,15 +6,23 @@ services:
build: ./images/postgres
ports:
- 8888:5432
+
exchange:
build: ./images/exchange
depends_on:
- talerdb
ports:
- 5555:80
+
merchant:
build: ./images/merchant
depends_on:
- talerdb
ports:
- 5556:80
+
+ bank:
+ build: ./images/libeufin
+ ports:
+ - 5557:5000
+ - 5558:5001
diff --git a/docker/hybrid/images/base/Dockerfile b/docker/hybrid/images/base/Dockerfile
index 9e4d487..0733100 100644
--- a/docker/hybrid/images/base/Dockerfile
+++ b/docker/hybrid/images/base/Dockerfile
@@ -8,10 +8,13 @@ RUN apt-get install -y autoconf autopoint libtool texinfo \
libqrencode-dev zip jq nodejs npm openjdk-17-jre nginx procps \
curl python3-jinja2 wget curl
+RUN pip3 install requests click
+
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
WORKDIR /libmicrohttpd
RUN ./bootstrap
@@ -34,3 +37,8 @@ RUN ./configure CFLAGS="-ggdb -O0" \
--enable-logging=verbose \
--disable-doc
RUN make install
+
+WORKDIR /libeufin
+RUN ./bootstrap
+RUN ./configure
+RUN make install
diff --git a/docker/hybrid/images/exchange/startup.sh b/docker/hybrid/images/exchange/startup.sh
index 9fe4052..535bc91 100644
--- a/docker/hybrid/images/exchange/startup.sh
+++ b/docker/hybrid/images/exchange/startup.sh
@@ -3,8 +3,18 @@
set -eu
export LD_LIBRARY_PATH=/usr/local/lib
-sed -i 's/\${EXCHANGE_URL}/http:\/\/exchange:80\//' /config/taler.conf
-sed -i 's/\${CURRENCY}/EUR/' /config/taler.conf
+# to be 'sed' in the config:
+EXCHANGE_NEXUS_USERNAME=exchange
+EXCHANGE_NEXUS_PASSWORD=x
+EXCHANGE_IBAN=DE159593
+TALER_FACADE_NAME=exchange-facade
+
+sed -i 's/__EXCHANGE_URL__/http:\/\/exchange:80\//' /config/taler.conf
+sed -i 's/__CURRENCY__/EUR/' /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
+sed -i "s/__TALER_FACADE_NAME__/${TALER_FACADE_NAME}/" /config/taler.conf
while ! pg_isready -h talerdb -d taler; do
echo DB not ready yet.
@@ -22,7 +32,7 @@ taler-exchange-secmod-rsa -c /config/taler.conf &
taler-exchange-secmod-cs -c /config/taler.conf &
echo "Crypto helpers started.."
EXCHANGE_MASTER_PUB=$(taler-exchange-offline -c /config/taler.conf setup)
-sed -i "s/\${EXCHANGE_MASTER_PUB}/$EXCHANGE_MASTER_PUB/" /config/taler.conf
+sed -i "s/__EXCHANGE_MASTER_PUB__/$EXCHANGE_MASTER_PUB/" /config/taler.conf
taler-exchange-httpd -c /config/taler.conf &
for n in `seq 1 80`
do
diff --git a/docker/hybrid/images/exchange/taler.conf b/docker/hybrid/images/exchange/taler.conf
index dd93b3d..5ca50c4 100644
--- a/docker/hybrid/images/exchange/taler.conf
+++ b/docker/hybrid/images/exchange/taler.conf
@@ -1,12 +1,5 @@
-# TO REPLACE (wrapped with ${}):
-
-# NEXUS_URL
-# EXCHANGE_URL
-# CURRENCY
-# EXCHANGE_MASTER_PUB
-
[taler]
-currency = ${CURRENCY}
+currency = __CURRENCY__
[paths]
taler_data_home = /data
@@ -23,21 +16,21 @@ sm_priv_key = /data/taler-exchange-secmod-cs/secmod-private-key
unixpath = /sockets/exchange-secmod-cs.sock
[exchange-accountcredentials-1]
-username = exchange-nexus-user
+username = __EXCHANGE_NEXUS_USERNAME__
wire_gateway_auth_method = basic
-wire_gateway_url = ${NEXUS_URL}/facades/exchange-taler-facade/taler-wire-gateway/
-password = exchange-nexus-password
+wire_gateway_url = ${NEXUS_URL}/facades/__TALER_FACADE_NAME__/taler-wire-gateway/
+password = __EXCHANGE_NEXUS_PASSWORD__
[exchange-account-1]
enable_credit = yes
enable_debit = yes
-payto_uri = payto://iban/SANDBOXX/DE159593?receiver-name=Name+unknown
+payto_uri = payto://iban/SANDBOXX/__EXCHANGE_IBAN__?receiver-name=Name+unknown
[exchange]
-master_public_key = ${EXCHANGE_MASTER_PUB}
+master_public_key = __EXCHANGE_MASTER_PUB__
privacy_dir = /usr/local/share/taler/exchange/pp
terms_dir = /usr/local/share/taler/exchange/tos
-base_url = ${EXCHANGE_URL}
+base_url = __EXCHANGE_URL__
unixpath = /sockets/exchange.sock
serve = tcp
port = 80
@@ -46,14 +39,14 @@ port = 80
[exchangedb-postgres]
config = postgres://talerdb/taler
-[coin_${CURRENCY}_1]
+[coin___CURRENCY___1]
rsa_keysize = 2048
-fee_deposit = ${CURRENCY}:0.01
-fee_refund = ${CURRENCY}:0.01
-fee_refresh = ${CURRENCY}:0.01
-fee_withdraw = ${CURRENCY}:0.01
+fee_deposit = __CURRENCY__:0.01
+fee_refund = __CURRENCY__:0.01
+fee_refresh = __CURRENCY__:0.01
+fee_withdraw = __CURRENCY__:0.01
duration_legal = 10 years
duration_spend = 5 years
duration_withdraw = 3 years
-value = ${CURRENCY}:1
+value = __CURRENCY__:1
cipher = RSA
diff --git a/docker/hybrid/images/libeufin/Dockerfile b/docker/hybrid/images/libeufin/Dockerfile
new file mode 100644
index 0000000..992c9a1
--- /dev/null
+++ b/docker/hybrid/images/libeufin/Dockerfile
@@ -0,0 +1,5 @@
+FROM taler_local/taler_base
+
+COPY startup.sh /
+RUN chmod +x /startup.sh
+ENTRYPOINT /startup.sh
diff --git a/docker/hybrid/images/libeufin/startup.sh b/docker/hybrid/images/libeufin/startup.sh
new file mode 100644
index 0000000..a8d3bf3
--- /dev/null
+++ b/docker/hybrid/images/libeufin/startup.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+set -eu
+
+## SANDBOX SETUP
+
+# invoke: username password iban name
+register_sandbox_account() {
+ export LIBEUFIN_SANDBOX_USERNAME=$1
+ export LIBEUFIN_SANDBOX_PASSWORD=$2
+ libeufin-cli sandbox demobank register --name "$4" --iban $3
+ unset LIBEUFIN_SANDBOX_USERNAME
+ unset LIBEUFIN_SANDBOX_PASSWORD
+}
+
+# takes port and service name
+is_serving() {
+ for n in `seq 1 80`
+ do
+ echo "."
+ sleep 0.1
+ OK=1
+ wget http://localhost:$1 -o /dev/null -O /dev/null >/dev/null && break
+ OK=0
+ done
+ if [ 1 != $OK ]
+ then
+ echo "$2 unreachable."
+ exit 1
+ fi
+ echo $2 reachable.
+}
+
+export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:/libeufin.sqlite3"
+export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=secret
+export LIBEUFIN_SANDBOX_URL="http://localhost:5000/demobanks/default"
+libeufin-sandbox config --currency EUR default
+libeufin-sandbox serve --no-localhost-only &
+is_serving 5000 Sandbox
+
+EXCHANGE_IBAN=DE159593
+EXCHANGE_USERNAME=taler-exchange
+EXCHANGE_PASSWORD=x
+
+register_sandbox_account $EXCHANGE_USERNAME $EXCHANGE_PASSWORD $EXCHANGE_IBAN "Exchange Company"
+
+## NEXUS SETUP
+export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:/libeufin.sqlite3"
+libeufin-nexus superuser exchange --password x
+libeufin-nexus serve --no-localhost-only &
+
+is_serving 5001 Nexus
+
+wait