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"
|
||||
|
|
|
|||
|
|
@ -9,11 +9,14 @@
|
|||
# ./scripts/taler-landing/stamp-landing-stack.sh
|
||||
# ./scripts/taler-landing/stamp-landing-stack.sh --ctr goa-regio-ng --ssh hernani@192.168.100.95
|
||||
# ./scripts/taler-landing/stamp-landing-stack.sh bank exchange
|
||||
# ./scripts/taler-landing/stamp-landing-stack.sh --deploy
|
||||
# stamp then publish via deploy-landings.sh --ssh (same host/ctr)
|
||||
#
|
||||
# After this, bump footer dates with:
|
||||
# ./scripts/taler-landing/stamp-landing-version.sh --bump --all
|
||||
# Then deploy (unified vanilla CTR):
|
||||
# LANDING_CTR=goa-regio-ng ./scripts/taler-landing/deploy-landings.sh
|
||||
# One-shot stamp+live (preferred — avoids stamped-but-not-deployed lag):
|
||||
# ./scripts/taler-landing/stamp-landing-stack.sh --deploy
|
||||
# ./scripts/taler-landing/stamp-landing-version.sh --bump --all --deploy
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
|
|
@ -23,6 +26,7 @@ VERS_OUT="$ROOT/configs/shared/landing-stack-versions.json"
|
|||
CTR="${LANDING_CTR:-goa-regio-ng}"
|
||||
SSH_HOST="${LANDING_SSH:-hernani@192.168.100.95}"
|
||||
USE_SSH=1
|
||||
DO_DEPLOY=0
|
||||
sites=()
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
|
|
@ -30,9 +34,10 @@ while [ $# -gt 0 ]; do
|
|||
--ctr) CTR="${2:-}"; shift 2 ;;
|
||||
--ssh) SSH_HOST="${2:-}"; USE_SSH=1; shift 2 ;;
|
||||
--local) USE_SSH=0; shift ;;
|
||||
--deploy) DO_DEPLOY=1; shift ;;
|
||||
bank|exchange|merchant) sites+=("$1"); shift ;;
|
||||
-h|--help)
|
||||
sed -n '2,20p' "$0"
|
||||
sed -n '2,24p' "$0"
|
||||
exit 0
|
||||
;;
|
||||
*) echo "unknown arg: $1" >&2; exit 2 ;;
|
||||
|
|
@ -177,3 +182,15 @@ print(f"OK stack stamped: {' '.join(sites)} @ {human}")
|
|||
PY
|
||||
|
||||
echo "OK stamp-landing-stack: ${sites[*]} ← ${CTR}"
|
||||
|
||||
if [ "$DO_DEPLOY" = 1 ]; then
|
||||
deploy="$ROOT/scripts/taler-landing/deploy-landings.sh"
|
||||
[ -x "$deploy" ] || { echo "missing $deploy" >&2; exit 1; }
|
||||
if [ "$USE_SSH" = 1 ]; then
|
||||
echo "=== --deploy → deploy-landings.sh --ssh ${SSH_HOST} --ctr ${CTR} ==="
|
||||
LANDING_CTR="$CTR" "$deploy" --ssh "$SSH_HOST" --ctr "$CTR"
|
||||
else
|
||||
echo "=== --deploy → deploy-landings.sh --local --ctr ${CTR} ==="
|
||||
LANDING_CTR="$CTR" "$deploy" --local --ctr "$CTR"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -21,11 +21,17 @@
|
|||
# 3) git add configs/ && git commit -m "landing(bank): …"
|
||||
# 4) ./scripts/taler-landing/stamp-landing-version.sh bank
|
||||
# git add configs/ && git commit --amend --no-edit # optional pin
|
||||
# 5) ./scripts/taler-landing/deploy-landings.sh --ssh
|
||||
# or combine: stamp-landing-version.sh --bump bank --deploy
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
VER_FILE="$ROOT/configs/shared/landing-version.json"
|
||||
REPO_WEB="${LANDING_REPO_WEB:-https://git.hacktivism.ch/hernani/koopa-admin-log}"
|
||||
SSH_HOST="${LANDING_SSH:-hernani@192.168.100.95}"
|
||||
CTR="${LANDING_CTR:-goa-regio-ng}"
|
||||
DO_DEPLOY=0
|
||||
USE_SSH=1
|
||||
|
||||
declare -A SITE_HTML=(
|
||||
[bank]="$ROOT/configs/bank-landing/index.html"
|
||||
|
|
@ -55,9 +61,13 @@ while [ $# -gt 0 ]; do
|
|||
--bump) bump=1; shift ;;
|
||||
--set) set_ver="${2:-}"; shift 2 ;;
|
||||
--all) do_all=1; shift ;;
|
||||
--deploy) DO_DEPLOY=1; shift ;;
|
||||
--ssh) SSH_HOST="${2:-}"; USE_SSH=1; shift 2 ;;
|
||||
--local) USE_SSH=0; shift ;;
|
||||
--ctr) CTR="${2:-}"; shift 2 ;;
|
||||
bank|exchange|merchant) sites+=("$1"); shift ;;
|
||||
-h|--help)
|
||||
sed -n '2,28p' "$0"
|
||||
sed -n '2,32p' "$0"
|
||||
exit 0
|
||||
;;
|
||||
*) echo "unknown arg: $1 (sites: bank exchange merchant)" >&2; exit 2 ;;
|
||||
|
|
@ -191,3 +201,15 @@ PY
|
|||
done
|
||||
|
||||
echo "OK stamped: ${sites[*]}"
|
||||
|
||||
if [ "$DO_DEPLOY" = 1 ]; then
|
||||
deploy="$ROOT/scripts/taler-landing/deploy-landings.sh"
|
||||
[ -x "$deploy" ] || { echo "missing $deploy" >&2; exit 1; }
|
||||
if [ "$USE_SSH" = 1 ]; then
|
||||
echo "=== --deploy → deploy-landings.sh --ssh ${SSH_HOST} --ctr ${CTR} ==="
|
||||
LANDING_CTR="$CTR" "$deploy" --ssh "$SSH_HOST" --ctr "$CTR"
|
||||
else
|
||||
echo "=== --deploy → deploy-landings.sh --local --ctr ${CTR} ==="
|
||||
LANDING_CTR="$CTR" "$deploy" --local --ctr "$CTR"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue