ops: taler-landing scripts add laptop --ssh deploy path and --deploy chain
This commit is contained in:
parent
83b1616ed6
commit
60f917fc31
3 changed files with 122 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
# Install exchange + merchant landing pages inside containers and ensure nginx
|
||||
# listens on 9014 (exchange) / 9015 (merchant).
|
||||
#!/usr/bin/env bash
|
||||
# Install bank + exchange + merchant landing pages inside containers and ensure
|
||||
# nginx listens on 9013 (bank) / 9014 (exchange) / 9015 (merchant).
|
||||
#
|
||||
# Port map (wire these in Caddy / podman -p):
|
||||
# 9013 bank landing
|
||||
|
|
@ -9,10 +9,18 @@
|
|||
# Unified vanilla CTR: set LANDING_CTR=goa-regio-ng (default) so all three
|
||||
# landings land in the same container publishing 9010-9015.
|
||||
#
|
||||
# Run on koopa (host) with podman access.
|
||||
# Usage:
|
||||
# # on koopa (podman local):
|
||||
# LANDING_CTR=goa-regio-ng ./scripts/taler-landing/deploy-landings.sh
|
||||
# # from laptop (rsync SoT → remote tree, then deploy there):
|
||||
# ./scripts/taler-landing/deploy-landings.sh --ssh hernani@192.168.100.95
|
||||
# ./scripts/taler-landing/deploy-landings.sh --ssh # uses LANDING_SSH
|
||||
#
|
||||
# After stamp-landing-stack / stamp-landing-version, prefer --deploy on those
|
||||
# scripts so publish cannot be skipped.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
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}"
|
||||
|
|
@ -25,6 +33,33 @@ C_EX="${C_EX:-$LANDING_CTR}"
|
|||
C_MER="${C_MER:-$LANDING_CTR}"
|
||||
C_BANK="${C_BANK:-$LANDING_CTR}"
|
||||
|
||||
SSH_HOST="${LANDING_SSH:-hernani@192.168.100.95}"
|
||||
# Remote sync tree on koopa (not a git checkout — laptop SoT is Freigabe-pushed).
|
||||
REMOTE_ROOT="${LANDING_REMOTE_ROOT:-src/koopa/koopa-admin-log}"
|
||||
USE_SSH=0
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--ctr) LANDING_CTR="${2:-}"; C_EX="$LANDING_CTR"; C_MER="$LANDING_CTR"; C_BANK="$LANDING_CTR"; shift 2 ;;
|
||||
--ssh)
|
||||
if [ $# -ge 2 ] && [[ "${2:-}" != -* ]]; then
|
||||
SSH_HOST="$2"
|
||||
shift 2
|
||||
else
|
||||
shift
|
||||
fi
|
||||
USE_SSH=1
|
||||
;;
|
||||
--local) USE_SSH=0; shift ;;
|
||||
--remote-root) REMOTE_ROOT="${2:-}"; shift 2 ;;
|
||||
-h|--help)
|
||||
sed -n '2,22p' "$0"
|
||||
exit 0
|
||||
;;
|
||||
*) echo "unknown arg: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Prefer per-landing copy, then shared (keeps bank/exchange/merchant in sync)
|
||||
resolve_goa_amount() {
|
||||
local local_copy="$1"
|
||||
|
|
@ -48,6 +83,44 @@ copy_goa_amount() {
|
|||
fi
|
||||
}
|
||||
|
||||
deploy_via_ssh() {
|
||||
local host="$1"
|
||||
local remote_root="$2"
|
||||
echo "=== sync landings → ${host}:${remote_root} ==="
|
||||
ssh -o BatchMode=yes -o ConnectTimeout=12 "$host" "mkdir -p $(printf '%q' "$remote_root")/configs/shared $(printf '%q' "$remote_root")/scripts/taler-landing $(printf '%q' "$remote_root")/configs/bank-landing $(printf '%q' "$remote_root")/configs/exchange-landing $(printf '%q' "$remote_root")/configs/merchant-landing"
|
||||
|
||||
# SoT HTML / nginx / shared JS + this script (so remote deploy matches laptop).
|
||||
rsync -az --relative \
|
||||
"$ROOT/./configs/bank-landing/index.html" \
|
||||
"$ROOT/./configs/exchange-landing/index.html" \
|
||||
"$ROOT/./configs/exchange-landing/nginx-landing.conf" \
|
||||
"$ROOT/./configs/merchant-landing/index.html" \
|
||||
"$ROOT/./configs/merchant-landing/nginx-landing.conf" \
|
||||
"$ROOT/./configs/shared/goa-amount.js" \
|
||||
"$ROOT/./scripts/taler-landing/deploy-landings.sh" \
|
||||
"${host}:${remote_root}/"
|
||||
|
||||
if [ -f "$SRC_QR" ]; then
|
||||
rsync -az "$SRC_QR" "${host}:${remote_root}/configs/bank-landing/qrcode.min.js"
|
||||
fi
|
||||
for site in bank exchange merchant; do
|
||||
if [ -f "$ROOT/configs/${site}-landing/goa-amount.js" ]; then
|
||||
rsync -az "$ROOT/configs/${site}-landing/goa-amount.js" \
|
||||
"${host}:${remote_root}/configs/${site}-landing/goa-amount.js"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "=== remote deploy ctr=${LANDING_CTR} ==="
|
||||
# shellcheck disable=SC2029
|
||||
ssh -o BatchMode=yes -o ConnectTimeout=12 "$host" \
|
||||
"cd $(printf '%q' "$remote_root") && LANDING_CTR=$(printf '%q' "$LANDING_CTR") ./scripts/taler-landing/deploy-landings.sh --local"
|
||||
}
|
||||
|
||||
if [ "$USE_SSH" = 1 ]; then
|
||||
deploy_via_ssh "$SSH_HOST" "$REMOTE_ROOT"
|
||||
exit 0
|
||||
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
|
||||
|
|
@ -112,3 +185,4 @@ echo " 9014 exchange landing ($C_EX)"
|
|||
echo " 9015 merchant landing ($C_MER)"
|
||||
echo
|
||||
echo "If host curl to :9014/:9015 fails, republish pasta ports (commit+replace) — see README."
|
||||
echo "OK deploy-landings: ctr=${LANDING_CTR} mode=local"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue