diff options
author | MS <ms@taler.net> | 2022-11-08 15:27:38 +0100 |
---|---|---|
committer | MS <ms@taler.net> | 2022-11-08 15:27:38 +0100 |
commit | 6db359f4cf48899be194d9771176293f2d27e919 (patch) | |
tree | 9aa507f110fd9ddff83fc92e4f0ed55ec6933a7f /docker/hybrid/images/merchant/startup.sh | |
parent | ee304e9dab845ec004b7d18d45283443ddc642cc (diff) | |
download | deployment-6db359f4cf48899be194d9771176293f2d27e919.tar.gz deployment-6db359f4cf48899be194d9771176293f2d27e919.tar.bz2 deployment-6db359f4cf48899be194d9771176293f2d27e919.zip |
rename docker compose directory
Diffstat (limited to 'docker/hybrid/images/merchant/startup.sh')
-rw-r--r-- | docker/hybrid/images/merchant/startup.sh | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/docker/hybrid/images/merchant/startup.sh b/docker/hybrid/images/merchant/startup.sh deleted file mode 100644 index 7b55a94..0000000 --- a/docker/hybrid/images/merchant/startup.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash - -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` -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` - -BLOG_IBAN=DE940993 -GNUNET_IBAN=DE463312 -DEFAULT_IBAN=DE474361 -TOR_IBAN=DE358263 -TALER_IBAN=DE102893 -SURVEY_IBAN=DE731371 - -while ! pg_isready -h talerdb -d taler; do - echo DB not ready yet. - sleep 2 -done -echo Now DB is ready. - -# 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 & - -# FIXME: browsers can only get redirected to merchant backends -# as they appear outside of the container (port 5556). OTOH, -# merchant frontends can only talk to backends as they appear -# _inside_ the container (port 80). Config, ultimately, must -# specify backends as they appear outside, otherwise frontends -# would redirect browsers with in-container addresses, that -# would make the backend not reached. The following redirection -# allows to bridge the external merchant port to the internal, -# to make frontends reach the backend. -socat TCP-LISTEN:5556,fork,reuseaddr TCP:localhost:80 & - -# $2 might have Authorization header. -is_serving () { -set +u # tolerate missing $2 -echo Checking $1 -for n in `seq 1 50` - do - echo "." - sleep 0.5 - OK=1 - # auth case. - if test -n "$2"; then - wget --header "$2" $1 -o /dev/null -O /dev/null >/dev/null && break - else - wget $1 -o /dev/null -O /dev/null >/dev/null && break - fi - OK=0 - done - if [ 1 != $OK ] - then - echo "ERROR: $1 unreachable." - exit 1 - fi - set -e -} - -is_serving ${EXCHANGE_URL} - -EXCHANGE_MASTER_PUB=$(curl -s ${EXCHANGE_URL}keys | jq -r .master_public_key) -echo Found Exchange Pub: $EXCHANGE_MASTER_PUB -sed -i "s;__EXCHANGE_URL__;${EXCHANGE_URL};" /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 -sed -i "s;__BACKEND_URL__;${BACKEND_URL};" /config/taler.conf -sed -i "s;__DB_PASSWORD__;${DB_PASSWORD};" /config/taler.conf - -echo "Init database... " -taler-merchant-dbinit -L DEBUG -c /config/taler.conf -echo DONE -echo -n "Launch merchant backend..." -taler-merchant-httpd -c /config/taler.conf 2>&1 | \ - rotatelogs -e /logs/taler-merchant-httpd-%Y-%m-%d 86400 & -echo DONE -sleep 1 - -source /create_instances.sh - -export TALER_ENV_URL_MERCHANT_BLOG=`taler-config -c /config/deployment.conf -s taler-deployment -o blog-url` -export TALER_ENV_URL_MERCHANT_DONATIONS=`taler-config -c /config/deployment.conf -s taler-deployment -o donations-url` -export TALER_ENV_URL_MERCHANT_SURVEY=`taler-config -c /config/deployment.conf -s taler-deployment -o survey-url` -export TALER_ENV_URL_INTRO=`taler-config -c /config/deployment.conf -s taler-deployment -o landing-url` -export TALER_ENV_URL_BANK=`taler-config -c /config/deployment.conf -s taler-deployment -o bank-url` - -echo -n "Launch blog..." -${HOME}/.local/bin/taler-merchant-demos -c /config/taler.conf --http-port 8080 blog 2>&1 | rotatelogs -e /logs/blog-%Y-%m-%d 86400 & -echo DONE -echo -n "Launch donations..." -${HOME}/.local/bin/taler-merchant-demos -c /config/taler.conf --http-port 8081 donations 2>&1 | rotatelogs -e /logs/donations-%Y-%m-%d 86400 & -echo DONE -echo -n "Launch Survey..." -${HOME}/.local/bin/taler-merchant-demos -c /config/taler.conf --http-port 8082 survey 2>&1 | rotatelogs -e /logs/survey-%Y-%m-%d 86400 & -echo DONE -echo -n "Launch Landing..." -${HOME}/.local/bin/taler-merchant-demos -c /config/taler.conf --http-port 8083 landing 2>&1 | rotatelogs -e /logs/landing-%Y-%m-%d 86400 & -echo DONE - -echo -n Creating a reserve for tips... - -PAYTO_RESERVE=$( - taler-merchant-setup-reserve \ - --amount ${CURRENCY}:20 \ - --exchange-url ${EXCHANGE_URL} \ - --merchant-url http://localhost/instances/survey/ \ - --apikey "Bearer {BACKEND_APIKEY}" \ - --wire-method iban -) - -SANDBOX_URL="http://bank:15000/demobanks/default" -is_serving "${SANDBOX_URL}/integration-api/config" -SURVEY_USERNAME=`taler-config -c /config/deployment.conf -s taler-deployment -o survey-sandbox-username` -SURVEY_PASSWORD=`taler-config -c /config/deployment.conf -s taler-deployment -o survey-sandbox-password` -# Check/wait that the Survey site got its bank account. -curl "${SANDBOX_URL}/access-api/public-accounts" -is_serving "${SANDBOX_URL}/access-api/accounts/${SURVEY_USERNAME}" \ - "Authorization: Basic $(echo -n $SURVEY_USERNAME:$SURVEY_PASSWORD | base64)" -export LIBEUFIN_SANDBOX_USERNAME=${SURVEY_USERNAME} -export LIBEUFIN_SANDBOX_PASSWORD=${SURVEY_PASSWORD} -libeufin-cli sandbox \ - --sandbox-url ${SANDBOX_URL} \ - demobank new-transaction --bank-account ${LIBEUFIN_SANDBOX_USERNAME} \ - --payto-with-subject ${PAYTO_RESERVE} --amount 20 -unset LIBEUFIN_SANDBOX_USERNAME -unset LIBEUFIN_SANDBOX_PASSWORD - -echo DONE - -wait |