more fixes for taler-benchmark-setup

This commit is contained in:
Christian Grothoff 2023-06-05 15:13:41 +02:00
parent 8cc1edfe0a
commit 27f22ef1d2
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 46 additions and 26 deletions

View File

@ -26,9 +26,24 @@ LOOKAHEAD_SIGN="1 d"
DURATION="2 d" DURATION="2 d"
LOOKAHEAD_SIGN="1 d" LOOKAHEAD_SIGN="1 d"
# Trust local exchange for "EUR" currency
[merchant-exchange-benchmark]
EXCHANGE_BASE_URL = http://localhost:8081/
MASTER_KEY=98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
# If currency does not match [TALER] section, the exchange
# will be ignored!
CURRENCY = EUR
[exchangedb-postgres] [exchangedb-postgres]
CONFIG="postgres:///talercheck" CONFIG="postgres:///talercheck"
[merchantdb-postgres]
CONFIG="postgres:///talercheck"
[auditordb-postgres]
CONFIG="postgres:///talercheck"
[exchange-offline] [exchange-offline]
MASTER_PRIV_FILE=${TALER_DATA_HOME}/exchange/offline-keys/master.priv MASTER_PRIV_FILE=${TALER_DATA_HOME}/exchange/offline-keys/master.priv

View File

@ -55,7 +55,7 @@ CONF_ORIG="~/.config/taler.conf"
LOGLEVEL="DEBUG" LOGLEVEL="DEBUG"
# Parse command-line options # Parse command-line options
while getopts ':abc:efhl:ms' OPTION; do while getopts ':abc:efhl:mns' OPTION; do
case "$OPTION" in case "$OPTION" in
a) a)
START_AUDITOR="1" START_AUDITOR="1"
@ -248,27 +248,23 @@ then
echo $! > libeufin-nexus.pid echo $! > libeufin-nexus.pid
export LIBEUFIN_NEXUS_URL="http://localhost:$NEXUS_PORT" export LIBEUFIN_NEXUS_URL="http://localhost:$NEXUS_PORT"
echo -n "Waiting for Nexus ..." echo -n "Waiting for Nexus ..."
set +e
OK="0" OK="0"
for n in $(seq 1 100); do for n in $(seq 1 100); do
echo -n "." echo -n "."
sleep 0.2 sleep 0.2
if wget --timeout=1 \ wget --timeout=1 \
--tries=3 \ --tries=3 \
--waitretry=0 \ --waitretry=0 \
-o /dev/null \ -o /dev/null \
-O /dev/null \ -O /dev/null \
"$LIBEUFIN_NEXUS_URL"; "$LIBEUFIN_NEXUS_URL" || continue
then OK="1"
OK="1" break
break
fi
done done
if [ "1" != "$OK" ] if [ "1" != "$OK" ]
then then
exit_skip "Failed to launch services (bank)" exit_skip "Failed to launch services (bank)"
fi fi
set -e
echo " OK" echo " OK"
export LIBEUFIN_NEXUS_USERNAME=exchange export LIBEUFIN_NEXUS_USERNAME=exchange
@ -343,7 +339,7 @@ then
if [ "$MPUB" != "$MASTER_PUB" ] if [ "$MPUB" != "$MASTER_PUB" ]
then then
echo -n " patching master_pub ($MASTER_PUB)..." echo -n " patching master_pub ($MASTER_PUB)..."
taler-config -c $CONF -s exchange -o MASTER_PUBLIC_KEY -V "$MASTER_PUB" taler-config -c "$CONF" -s exchange -o MASTER_PUBLIC_KEY -V "$MASTER_PUB"
fi fi
taler-exchange-dbinit -c "$CONF" taler-exchange-dbinit -c "$CONF"
taler-exchange-secmod-eddsa -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-secmod-eddsa.log & taler-exchange-secmod-eddsa -c "$CONF" -L "$LOGLEVEL" 2> taler-exchange-secmod-eddsa.log &
@ -359,6 +355,13 @@ fi
if [ "1" = "$START_MERCHANT" ] if [ "1" = "$START_MERCHANT" ]
then then
echo -n "Starting merchant ..." echo -n "Starting merchant ..."
MEPUB=$(taler-config -c "$CONF" -s merchant-exchange-benchmark -o MASTER_KEY)
MXPUB=${MASTER_PUB:-$(taler-config -c "$CONF" -s exchange -o MASTER_PUBLIC_KEY)}
if [ "$MEPUB" != "$MXPUB" ]
then
echo -n " patching master_pub ($MXPUB)..."
taler-config -c "$CONF" -s merchant-exchange-benchmark -o MASTER_KEY -V "$MXPUB"
fi
MERCHANT_PORT=$(taler-config -c "$CONF" -s MERCHANT -o PORT) MERCHANT_PORT=$(taler-config -c "$CONF" -s MERCHANT -o PORT)
MERCHANT_URL="http://localhost:${MERCHANT_PORT}/" MERCHANT_URL="http://localhost:${MERCHANT_PORT}/"
taler-merchant-dbinit -c "$CONF" taler-merchant-dbinit -c "$CONF"
@ -376,8 +379,9 @@ then
mkdir -p "$AUDITOR_PRIV_DIR" mkdir -p "$AUDITOR_PRIV_DIR"
gnunet-ecc -g1 "$AUDITOR_PRIV_FILE" > /dev/null 2> /dev/null gnunet-ecc -g1 "$AUDITOR_PRIV_FILE" > /dev/null 2> /dev/null
AUDITOR_PUB=$(gnunet-ecc -p "${AUDITOR_PRIV_FILE}") AUDITOR_PUB=$(gnunet-ecc -p "${AUDITOR_PRIV_FILE}")
MAPUB=${MASTER_PUB:-$(taler-config -c "$CONF" -s exchange -o MASTER_PUBLIC_KEY)}
taler-auditor-dbinit -c "$CONF" taler-auditor-dbinit -c "$CONF"
taler-auditor-exchange -c "$CONF" -m "$MASTER_PUB" -u "$EXCHANGE_URL" taler-auditor-exchange -c "$CONF" -m "$MAPUB" -u "$EXCHANGE_URL"
taler-auditor-httpd -L "$LOGLEVEL" -c "$CONF" 2> taler-auditor-httpd.log & taler-auditor-httpd -L "$LOGLEVEL" -c "$CONF" 2> taler-auditor-httpd.log &
echo " DONE" echo " DONE"
fi fi
@ -415,7 +419,7 @@ echo -n "Waiting for Taler services ..."
for n in $(seq 1 20) for n in $(seq 1 20)
do do
echo -n "." echo -n "."
sleep 0.1 sleep 0.2
OK="0" OK="0"
if [ "1" = "$START_EXCHANGE" ] if [ "1" = "$START_EXCHANGE" ]
then then
@ -455,7 +459,6 @@ echo " OK"
if [ "1" = "$START_EXCHANGE" ] if [ "1" = "$START_EXCHANGE" ]
then then
set +e
echo -n "Wait for exchange /management/keys to be ready " echo -n "Wait for exchange /management/keys to be ready "
OK="0" OK="0"
LAST_RESPONSE=$(mktemp tmp-last-response.XXXXXXXX) LAST_RESPONSE=$(mktemp tmp-last-response.XXXXXXXX)
@ -471,16 +474,13 @@ then
"http://localhost:8081/management/keys"\ "http://localhost:8081/management/keys"\
-o /dev/null \ -o /dev/null \
-O "$LAST_RESPONSE" \ -O "$LAST_RESPONSE" \
>/dev/null >/dev/null || continue
DENOMS_COUNT=$(jq '.future_denoms|length' < $LAST_RESPONSE)
SIGNKEYS_COUNT=$(jq '.future_signkeys|length' < $LAST_RESPONSE)
[[ -z "$SIGNKEYS_COUNT" || "$SIGNKEYS_COUNT" == "0" || -z "$DENOMS_COUNT" || "$DENOMS_COUNT" == "0" ]] && continue
OK="1" OK="1"
break; break;
done done
set -e
if [ "1" != "$OK" ] if [ "1" != "$OK" ]
then then
cat "$LAST_RESPONSE"
exit_skip "Failed to setup exchange keys, check secmod logs" exit_skip "Failed to setup exchange keys, check secmod logs"
fi fi
rm "$LAST_RESPONSE" rm "$LAST_RESPONSE"
@ -504,7 +504,7 @@ then
taler-exchange-offline -c "$CONF" \ taler-exchange-offline -c "$CONF" \
enable-account "$EXCHANGE_PAYTO_URI" \ enable-account "$EXCHANGE_PAYTO_URI" \
upload &> "taler-exchange-offline-account-$ASEC.log" upload &> "taler-exchange-offline-account-$ASEC.log"
echo "OK" echo " OK"
fi fi
done done
if [ "1" = "$START_AUDITOR" ] if [ "1" = "$START_AUDITOR" ]
@ -518,29 +518,34 @@ then
echo -n "Checking /keys " echo -n "Checking /keys "
OK="0" OK="0"
for n in $(seq 1 3) LAST_RESPONSE=$(mktemp tmp-last-response.XXXXXXXX)
for n in $(seq 1 10)
do do
echo -n "." echo -n "."
sleep 0.1
wget \ wget \
--tries=1 \ --tries=1 \
--timeout=1 \ --timeout=1 \
"http://localhost:8081/keys" \ "http://localhost:8081/keys" \
-o /dev/null \ -o /dev/null \
-O /dev/null >/dev/null || continue -O "$LAST_RESPONSE" \
>/dev/null || continue
OK="1" OK="1"
break break
done done
if [ "1" != "$OK" ] if [ "1" != "$OK" ]
then then
cat "$LAST_RESPONSE"
exit_skip " Failed to setup keys" exit_skip " Failed to setup keys"
fi fi
rm "$LAST_RESPONSE"
echo " OK" echo " OK"
fi fi
if [ "1" = "$START_AUDITOR" ] if [ "1" = "$START_AUDITOR" ]
then then
echo -n "Setting up auditor signatures ..." echo -n "Setting up auditor signatures ..."
taler-auditor-offline -c "$CONF" \ timeout 15 taler-auditor-offline -c "$CONF" \
download \ download \
sign \ sign \
upload &> taler-auditor-offline.log upload &> taler-auditor-offline.log