taler-deployment

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

commit f5c6b148506a8f6daf0bdc174f477931446539c5
parent b78ec4608518c00e3ae9d8e528d83aecab825728
Author: MS <ms@taler.net>
Date:   Thu, 10 Nov 2022 19:00:43 +0100

deploy Sync; expose custom ports.

Diffstat:
Mdocker/demo/README | 2++
Mdocker/demo/config/deployment.conf | 1+
Mdocker/demo/docker-compose.yml | 21+++++++++++----------
Mdocker/demo/images/base/Dockerfile | 12+++++++++++-
Mdocker/demo/images/exchange/startup.sh | 16++++++++++------
Mdocker/demo/images/exchange/taler.conf | 1-
Mdocker/demo/images/libeufin/startup.sh | 1+
Mdocker/demo/images/merchant/startup.sh | 24+++++++++++++++++++++---
Mdocker/demo/images/merchant/taler.conf | 11+++++++++++
9 files changed, 68 insertions(+), 21 deletions(-)

diff --git a/docker/demo/README b/docker/demo/README @@ -133,6 +133,8 @@ From this directory: The above test registers a new bank account to libEufin, withdraw coins and spend them directly at the merchant backend. +NOTE: localhost works only with the default ports exposed. + How to deploy to online sites ============================= diff --git a/docker/demo/config/deployment.conf b/docker/demo/config/deployment.conf @@ -10,6 +10,7 @@ landing-url = http://localhost:5562/ blog-url = http://localhost:5559/ donations-url = http://localhost:5560/ survey-url = http://localhost:5561/ +sync-url = http://localhost:5563/ bank-url = http://localhost:15002/ # Bank accounts diff --git a/docker/demo/docker-compose.yml b/docker/demo/docker-compose.yml @@ -8,7 +8,7 @@ services: talerdb: build: ./images/postgres ports: - - 8888:5432 + - ${TALER_DB_PORT:-8888}:5432 volumes: - talerlogs:/logs - talerdata:/var/lib/postgresql/data/ @@ -32,7 +32,7 @@ services: depends_on: - talerdb ports: - - 5555:80 + - ${TALER_EXCHANGE_PORT:-5555}:80 volumes: - talerlogs:/logs - talerdata:/data @@ -43,11 +43,12 @@ services: depends_on: - talerdb ports: - - 5556:80 # backend - - 5559:8080 # blog - - 5560:8081 # donations - - 5561:8082 # survey - - 5562:8083 # landing + - ${TALER_MERCHANT_PORT:-5556}:80 # backend + - ${TALER_BLOG_PORT:-5559}:8080 # blog + - ${TALER_DONATIONS_PORT:-5560}:8081 # donations + - ${TALER_SURVEY_PORT:-5561}:8082 # survey + - ${TALER_LANDING_PORT:-5562}:8083 # landing + - ${TALER_SYNC_PORT:-5563}:8084 # sync volumes: - talerlogs:/logs - ${TALER_DEPLOYMENT_CONFIG:?Please export TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf @@ -55,9 +56,9 @@ services: bank: build: ./images/libeufin ports: - - 15000:15000 # Sandbox - - 15001:15001 # Nexus - - 15002:80 # Nginx serving the SPA + - ${LIBEUFIN_SANDBOX_PORT:-15000}:15000 # Sandbox + - ${LIBEUFIN_NEXUS_PORT:-15001}:15001 # Nexus + - ${LIBEUFIN_FRONTEND_PORT:-15002}:80 # Nginx serving the SPA volumes: - talerlogs:/logs - talerdata:/data diff --git a/docker/demo/images/base/Dockerfile b/docker/demo/images/base/Dockerfile @@ -18,6 +18,8 @@ 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 RUN git clone git://git.taler.net/wallet-core /wallet-core +RUN git clone git://git.taler.net/sync /sync + WORKDIR /libmicrohttpd RUN ./bootstrap @@ -51,7 +53,6 @@ RUN ./bootstrap RUN ./configure RUN make install - # From: https://github.com/nodesource/distributions/blob/master/README.md#debinstall RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash - && \ apt-get install -y nodejs @@ -62,4 +63,13 @@ WORKDIR ./packages/demobank-ui RUN ./configure RUN make install +WORKDIR /sync +RUN ./bootstrap +RUN ./configure CFLAGS="-ggdb -O0" \ + --enable-logging=verbose \ + --disable-doc +RUN make install + + + WORKDIR / diff --git a/docker/demo/images/exchange/startup.sh b/docker/demo/images/exchange/startup.sh @@ -1,13 +1,16 @@ #!/bin/bash +set -o pipefail set -eu -set -x + export LD_LIBRARY_PATH=/usr/local/lib # Values from config file mounted at run time: CURRENCY=`taler-config -c /config/deployment.conf -s taler-deployment -o currency` EXCHANGE_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o default-exchange` +socat TCP-LISTEN:5555,fork,reuseaddr TCP:localhost:80 & + EXCHANGE_NEXUS_USERNAME=`taler-config -c /config/deployment.conf -s taler-deployment -o exchange-nexus-username` EXCHANGE_NEXUS_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o exchange-nexus-password` EXCHANGE_IBAN=DE159593 @@ -58,7 +61,7 @@ for n in `seq 1 50` echo "." sleep 0.3 OK=1 - wget http://exchange/ -o /dev/null -O /dev/null >/dev/null && break + wget $EXCHANGE_URL -t 1 -o /dev/null -O /dev/null >/dev/null && break OK=0 done if [ 1 != $OK ] @@ -67,10 +70,7 @@ for n in `seq 1 50` exit 1 fi echo DONE -# echo -n "Launching sync..." -# sync-httpd -L DEBUG -c /config/taler.conf 2>&1 | \ -# rotatelogs -e /logs/sync-httpd-%Y-%m-%d 86400 & -# echo DONE + echo -n "Launching wirewatch..." taler-exchange-wirewatch -L DEBUG -c /config/taler.conf 2>&1 | \ rotatelogs -e /logs/taler-exchange-wirewatch-%Y-%m-%d 86400 & @@ -93,4 +93,8 @@ taler-exchange-offline -L DEBUG -c /config/taler.conf \ upload 2>&1 echo DONE +echo -n "Requesting exchange's /keys..." +curl --max-time 4 -s "${EXCHANGE_URL}keys" +echo DONE + wait diff --git a/docker/demo/images/exchange/taler.conf b/docker/demo/images/exchange/taler.conf @@ -37,7 +37,6 @@ base_url = __EXCHANGE_URL__ unixpath = /sockets/exchange.sock serve = tcp port = 80 -# serve = unix [exchangedb-postgres] config = postgres://root:__DB_PASSWORD__@talerdb/taler diff --git a/docker/demo/images/libeufin/startup.sh b/docker/demo/images/libeufin/startup.sh @@ -1,5 +1,6 @@ #!/bin/bash +set -o pipefail set -eu MAYBE_VOLUME_MOUNTPOINT="/data/libeufin" diff --git a/docker/demo/images/merchant/startup.sh b/docker/demo/images/merchant/startup.sh @@ -1,12 +1,15 @@ #!/bin/bash +set -o pipefail set -eu + export LD_LIBRARY_PATH=/usr/local/lib # Values from config file mounted at run time: CURRENCY=`taler-config -c /config/deployment.conf -s taler-deployment -o currency` BACKEND_APIKEY=`taler-config -c /config/deployment.conf -s taler-deployment -o merchant-apikey` BACKEND_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o merchant-url` +SYNC_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o sync-url` EXCHANGE_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o default-exchange` DB_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o db-password` @@ -42,6 +45,9 @@ socat TCP-LISTEN:5555,fork,reuseaddr TCP:exchange:80 & # to make frontends reach the backend. socat TCP-LISTEN:5556,fork,reuseaddr TCP:localhost:80 & +# sync HTTPD redirect: +socat TCP-LISTEN:5563,fork,reuseaddr TCP:localhost:8080 & + # $2 might have Authorization header. is_serving () { set +u # tolerate missing $2 @@ -53,9 +59,9 @@ for n in `seq 1 50` OK=1 # auth case. if test -n "$2"; then - wget --header "$2" $1 -o /dev/null -O /dev/null >/dev/null && break + wget --header "$2" $1 -t 1 -o /dev/null -O /dev/null >/dev/null && break else - wget $1 -o /dev/null -O /dev/null >/dev/null && break + wget $1 -t 1 -o /dev/null -O /dev/null >/dev/null && break fi OK=0 done @@ -64,7 +70,7 @@ for n in `seq 1 50` echo "ERROR: $1 unreachable." exit 1 fi - set -e + set -u } is_serving ${EXCHANGE_URL} @@ -87,6 +93,8 @@ taler-merchant-httpd -c /config/taler.conf 2>&1 | \ echo DONE sleep 1 +is_serving "${BACKEND_URL}config" + source /create_instances.sh export TALER_ENV_URL_MERCHANT_BLOG=`taler-config -c /config/deployment.conf -s taler-deployment -o blog-url` @@ -135,7 +143,17 @@ libeufin-cli sandbox \ --payto-with-subject ${PAYTO_RESERVE} --amount 20 unset LIBEUFIN_SANDBOX_USERNAME unset LIBEUFIN_SANDBOX_PASSWORD +echo DONE +echo -n "Init sync database..." +sync-dbinit -L DEBUG -c /config/taler.conf echo DONE +echo -n "Launching sync..." +sync-httpd -L DEBUG -c /config/taler.conf 2>&1 | \ + rotatelogs -e /logs/sync-httpd-%Y-%m-%d 86400 & +echo DONE + +is_serving $SYNC_URL + wait diff --git a/docker/demo/images/merchant/taler.conf b/docker/demo/images/merchant/taler.conf @@ -26,3 +26,14 @@ wire_response = ${TALER_DATA_HOME}/merchant/wire/merchant.json [frontends] backend = __BACKEND_URL__ backend_apikey = __BACKEND_APIKEY__ + +[sync] +serve = tcp +port = 8084 +apikey = __BACKEND_APIKEY__ +annual_fee = __CURRENCY__:0.01 +fulfillment_url = __SYNC_FULFILLMENT_URL__ +payment_backend_url = __BACKEND_URL__ + +[syncdb-postgres] +config = postgres://root:__DB_PASSWORD__@talerdb/taler