diff options
author | MS <ms@taler.net> | 2022-10-12 12:14:52 +0200 |
---|---|---|
committer | MS <ms@taler.net> | 2022-10-12 12:14:52 +0200 |
commit | 24b61e7d91a635cd9068a9c13ed48aedc372fd79 (patch) | |
tree | 87fdcc54f2a71676c73a198545b7c2c8af6a6484 /docker | |
parent | fd8d901d00b9138191426a8ad327fd5a35f94985 (diff) | |
download | deployment-24b61e7d91a635cd9068a9c13ed48aedc372fd79.tar.gz deployment-24b61e7d91a635cd9068a9c13ed48aedc372fd79.tar.bz2 deployment-24b61e7d91a635cd9068a9c13ed48aedc372fd79.zip |
Docker configuration.
Extract some config values to be shared between containers.
Diffstat (limited to 'docker')
-rw-r--r-- | docker/hybrid/README | 6 | ||||
-rw-r--r-- | docker/hybrid/docker-compose.yml | 6 | ||||
-rw-r--r-- | docker/hybrid/images/exchange/startup.sh | 8 | ||||
-rw-r--r-- | docker/hybrid/images/merchant/startup.sh | 28 | ||||
-rw-r--r-- | docker/hybrid/images/merchant/taler.conf | 3 |
5 files changed, 33 insertions, 18 deletions
diff --git a/docker/hybrid/README b/docker/hybrid/README index 1ae6141..01ad037 100644 --- a/docker/hybrid/README +++ b/docker/hybrid/README @@ -39,8 +39,12 @@ From this folder, run: How to run ========== +Export the env variable TALER_DEPLOYMENT_CONFIG to an +absolute path of a host-specific configuration file. See +config/deployment.conf for an example. + From this folder, run: - $ docker-compose up + $ docker-compose up --remove-orphans How to test =========== diff --git a/docker/hybrid/docker-compose.yml b/docker/hybrid/docker-compose.yml index 4217eec..da297d0 100644 --- a/docker/hybrid/docker-compose.yml +++ b/docker/hybrid/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' # '0' is not allowed +version: '3' # it's a constant services: @@ -13,6 +13,8 @@ services: - talerdb ports: - 5555:80 + volumes: + - ${TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf merchant: build: ./images/merchant @@ -21,6 +23,8 @@ services: ports: - 5556:80 - 5559:8080 # Blog + volumes: + - ${TALER_DEPLOYMENT_CONFIG}:/config/deployment.conf bank: build: ./images/libeufin diff --git a/docker/hybrid/images/exchange/startup.sh b/docker/hybrid/images/exchange/startup.sh index c566d76..b5d9516 100644 --- a/docker/hybrid/images/exchange/startup.sh +++ b/docker/hybrid/images/exchange/startup.sh @@ -3,14 +3,16 @@ set -eu export LD_LIBRARY_PATH=/usr/local/lib -# to be 'sed' in the config: +# 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 exchange_base_url` + 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;__EXCHANGE_URL__;${EXCHANGE_URL};" /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 diff --git a/docker/hybrid/images/merchant/startup.sh b/docker/hybrid/images/merchant/startup.sh index d1b7994..507f2ea 100644 --- a/docker/hybrid/images/merchant/startup.sh +++ b/docker/hybrid/images/merchant/startup.sh @@ -3,18 +3,31 @@ set -eu export LD_LIBRARY_PATH=/usr/local/lib +# Values from config file mounted at run time: +EXCHANGE_URL=`taler-config -c /config/deployment.conf -s taler-deployment -o exchange_base_url` +CURRENCY=`taler-config -c /config/deployment.conf -s taler-deployment -o currency` + 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 & + +echo Checking exchange at: ${EXCHANGE_URL} for n in `seq 1 30` do echo "." sleep 0.4 OK=1 - wget http://exchange/ -o /dev/null -O /dev/null >/dev/null && break + wget ${EXCHANGE_URL} -o /dev/null -O /dev/null >/dev/null && break OK=0 done if [ 1 != $OK ] @@ -24,19 +37,10 @@ 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) +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__/http:\/\/exchange\//' /config/taler.conf +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 diff --git a/docker/hybrid/images/merchant/taler.conf b/docker/hybrid/images/merchant/taler.conf index 81aa5cc..21957ed 100644 --- a/docker/hybrid/images/merchant/taler.conf +++ b/docker/hybrid/images/merchant/taler.conf @@ -6,7 +6,7 @@ TALER_DATA_HOME = /data [merchant-exchange-__CURRENCY__] currency = __CURRENCY__ -exchange_base_url = http://exchange/ +exchange_base_url = __EXCHANGE_URL__ master_key = __EXCHANGE_PUB__ [merchantdb-postgres] @@ -23,6 +23,7 @@ serve = tcp wire_file_mode = 770 wire_response = ${TALER_DATA_HOME}/merchant/wire/merchant.json +# Unused yet. [frontends] backend = http://localhost/ backend_apikey = __BACKEND_APIKEY__ |