landing: compact GOA alt display and all-account bank fallback
Wire goa-amount.js into bank/exchange/merchant intros, deploy it with the landings, and deepen the in-container bank stats fallback to scan all accounts (skip only exchange) when the host timer is down.
This commit is contained in:
parent
746d7a41af
commit
48f77139c5
8 changed files with 363 additions and 39 deletions
|
|
@ -16,13 +16,16 @@ BANK_USER="${BANK_USER:-explorer}"
|
|||
ADMIN_USER="${ADMIN_USER:-admin}"
|
||||
# Per-account transaction window (libeufin delta). Was -100 → systematically
|
||||
# undercounted credits/withdraws on active accounts (broken public stats).
|
||||
TX_DELTA="${TX_DELTA:--50000}"
|
||||
# Prefer the host collector (hernani systemd taler-landing-stats) for full
|
||||
# pagination; these defaults keep the in-container fallback deep enough.
|
||||
TX_DELTA="${TX_DELTA:--200000}"
|
||||
# Max accounts to list + scan (was 80 → missed later accounts; bank has 100+).
|
||||
MAX_SCAN_ACCOUNTS="${MAX_SCAN_ACCOUNTS:-500}"
|
||||
# 0 or empty → no head limit (scan every listed account).
|
||||
MAX_SCAN_ACCOUNTS="${MAX_SCAN_ACCOUNTS:-0}"
|
||||
# Account-list page size for GET /accounts?delta=… (must cover all users)
|
||||
ACCOUNTS_DELTA="${ACCOUNTS_DELTA:--500}"
|
||||
ACCOUNTS_DELTA="${ACCOUNTS_DELTA:--10000}"
|
||||
# curl timeout per account (deeper history needs more headroom)
|
||||
TX_CURL_TIMEOUT="${TX_CURL_TIMEOUT:-25}"
|
||||
TX_CURL_TIMEOUT="${TX_CURL_TIMEOUT:-45}"
|
||||
export TZ="${TZ:-Europe/Zurich}"
|
||||
|
||||
PASS="${BANK_PASS:-}"
|
||||
|
|
@ -218,15 +221,23 @@ fi
|
|||
SCAN_OK=0
|
||||
SCAN_EMPTY=0
|
||||
SCAN_FAIL=0
|
||||
# Scan customer accounts only (not exchange/admin — exchange credits would double-count)
|
||||
# Scan ALL accounts except exchange (withdraw debits live on customers + admin
|
||||
# top-ups; exchange credits would double-count the same GOA).
|
||||
# Prefer host collect_bank_stats.py (hernani timer) for full pagination.
|
||||
{
|
||||
echo "$BANK_USER"
|
||||
grep -Eve "^(admin|exchange|${BANK_USER})$" "$WORKDIR/usernames.txt" 2>/dev/null || true
|
||||
} | awk 'NF && !seen[$0]++' | head -n "$MAX_SCAN_ACCOUNTS" >"$WORKDIR/scan-users.txt"
|
||||
# include admin + every auto-account; drop only exchange
|
||||
grep -Eve "^(exchange|${BANK_USER})$" "$WORKDIR/usernames.txt" 2>/dev/null || true
|
||||
} | awk 'NF && !seen[$0]++' >"$WORKDIR/scan-users.all"
|
||||
if [ -n "${MAX_SCAN_ACCOUNTS}" ] && [ "${MAX_SCAN_ACCOUNTS}" -gt 0 ] 2>/dev/null; then
|
||||
head -n "$MAX_SCAN_ACCOUNTS" "$WORKDIR/scan-users.all" >"$WORKDIR/scan-users.txt"
|
||||
else
|
||||
cp "$WORKDIR/scan-users.all" "$WORKDIR/scan-users.txt"
|
||||
fi
|
||||
|
||||
while IFS= read -r uname; do
|
||||
[ -n "$uname" ] || continue
|
||||
case "$uname" in admin|exchange) continue ;; esac
|
||||
case "$uname" in exchange) continue ;; esac
|
||||
# Safe filename (usernames are mostly [A-Za-z0-9_-])
|
||||
safe=$(printf '%s' "$uname" | tr -c 'A-Za-z0-9._-' '_')
|
||||
code=$(curl -sS -m "${TX_CURL_TIMEOUT}" -o "$WORKDIR/tx-${safe}.json" -w '%{http_code}' \
|
||||
|
|
@ -568,7 +579,7 @@ cat >"$TMP" <<EOF
|
|||
"total_in_value": ${TOTAL_IN_N:-0},
|
||||
"total_out": $(json_str "$TOTAL_OUT_AMT"),
|
||||
"total_out_value": ${TOTAL_OUT_N:-0},
|
||||
"note": "incoming=credits; withdraw=Taler withdrawal debits; excl. admin+exchange accounts"
|
||||
"note": "incoming=credits; withdraw=Taler withdrawal debits; excl. exchange only (admin+explorer+all users scanned)"
|
||||
},
|
||||
"withdraws": {
|
||||
"count": ${N_WD:-0},
|
||||
|
|
|
|||
23
scripts/taler-landing/deploy-landings.sh
Normal file → Executable file
23
scripts/taler-landing/deploy-landings.sh
Normal file → Executable file
|
|
@ -14,10 +14,31 @@ ROOT=$(cd "$(dirname "$0")/../.." && pwd)
|
|||
# allow override when files already on host /tmp
|
||||
SRC_EX="${SRC_EX:-$ROOT/configs/exchange-landing}"
|
||||
SRC_MER="${SRC_MER:-$ROOT/configs/merchant-landing}"
|
||||
SRC_BANK="${SRC_BANK:-$ROOT/configs/bank-landing}"
|
||||
SRC_QR="${SRC_QR:-$ROOT/configs/bank-landing/qrcode.min.js}"
|
||||
SRC_GOA_AMT="${SRC_GOA_AMT:-$ROOT/configs/shared/goa-amount.js}"
|
||||
|
||||
C_EX=taler-hacktivism-exchange-ansible
|
||||
C_MER=taler-hacktivism
|
||||
C_BANK="${C_BANK:-taler-hacktivism-bank}"
|
||||
|
||||
copy_goa_amount() {
|
||||
local ctr="$1" dest="$2"
|
||||
if [ -f "$SRC_GOA_AMT" ]; then
|
||||
podman cp "$SRC_GOA_AMT" "${ctr}:${dest}/goa-amount.js"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "=== bank landing → $C_BANK :9013 (html + goa-amount) ==="
|
||||
if podman inspect -f '{{.State.Running}}' "$C_BANK" 2>/dev/null | grep -qx true; then
|
||||
podman exec "$C_BANK" mkdir -p /var/www/bank-landing
|
||||
if [ -f "$SRC_BANK/index.html" ]; then
|
||||
podman cp "$SRC_BANK/index.html" "$C_BANK:/var/www/bank-landing/index.html"
|
||||
fi
|
||||
copy_goa_amount "$C_BANK" /var/www/bank-landing
|
||||
else
|
||||
echo "WARN: $C_BANK not running — skip bank landing files"
|
||||
fi
|
||||
|
||||
echo "=== exchange landing → $C_EX :9014 ==="
|
||||
# nginx may be missing on exchange image
|
||||
|
|
@ -30,6 +51,7 @@ podman cp "$SRC_EX/index.html" "$C_EX:/var/www/exchange-landing/index.html"
|
|||
if [ -f "$SRC_QR" ]; then
|
||||
podman cp "$SRC_QR" "$C_EX:/var/www/exchange-landing/qrcode.min.js"
|
||||
fi
|
||||
copy_goa_amount "$C_EX" /var/www/exchange-landing
|
||||
podman cp "$SRC_EX/nginx-landing.conf" "$C_EX:/etc/nginx/sites-available/exchange-landing"
|
||||
podman exec "$C_EX" bash -c '
|
||||
ln -sfn /etc/nginx/sites-available/exchange-landing /etc/nginx/sites-enabled/exchange-landing
|
||||
|
|
@ -50,6 +72,7 @@ podman exec "$C_EX" bash -c '
|
|||
echo "=== merchant landing → $C_MER :9015 ==="
|
||||
podman exec "$C_MER" mkdir -p /var/www/merchant-landing
|
||||
podman cp "$SRC_MER/index.html" "$C_MER:/var/www/merchant-landing/index.html"
|
||||
copy_goa_amount "$C_MER" /var/www/merchant-landing
|
||||
podman cp "$SRC_MER/nginx-landing.conf" "$C_MER:/etc/nginx/sites-available/merchant-landing"
|
||||
podman exec "$C_MER" bash -c '
|
||||
ln -sfn /etc/nginx/sites-available/merchant-landing /etc/nginx/sites-enabled/merchant-landing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue