sandcastle-ng

Scripts for the deployment of Sandcastle (GNU Taler)
Log | Files | Refs | README

commit 9eb8c08a7e2e61a6b2e547fb6faaba952c996738
parent 055ed18cdb0aa2886a8fcea45d5adbe71e43d6c5
Author: Florian Dold <florian@dold.me>
Date:   Wed, 29 Oct 2025 15:53:35 +0100

import instruction for single dump

Diffstat:
Msandcastle-export | 1-
Mscripts/demo/setup-sandcastle.sh | 22+++++++++++++++++++---
2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/sandcastle-export b/sandcastle-export @@ -20,4 +20,3 @@ podman exec taler-sandcastle sudo -u postgres pg_dump taler-merchant > $target/t podman exec taler-sandcastle sudo -u postgres pg_dump libeufin > $target/libeufin/libeufin.sql - diff --git a/scripts/demo/setup-sandcastle.sh b/scripts/demo/setup-sandcastle.sh @@ -180,11 +180,16 @@ function get_credential_pw() { cat "$p" } +import_instr=none +if [[ -d /exported && -e /exported/import-request ]]; then + import_instr=$(cat /exported/import-request) +fi + # If necessary, import the offline key. # Done before everything else, as we need the key # to generate the config. -if [[ -d /exported && -e /exported/import-request ]]; then +if [[ $import_instr = all ]]; then echo "Importing exchange offline key" rm -rf /var/lib/taler-exchange/offline/* cp -r /exported/taler-exchange/offline/* /var/lib/taler-exchange/offline/ @@ -474,7 +479,7 @@ taler-merchant-dbconfig # Import backup if necessary. # -if [[ -d /exported && -e /exported/import-request ]]; then +if [[ $import_instr = all ]]; then echo "Importing databases" # FIXME: Consider backing up old DB before importing new one @@ -503,12 +508,23 @@ if [[ -d /exported && -e /exported/import-request ]]; then rm -rf /var/lib/taler-exchange/secmod-cs/* cp -r /exported/taler-exchange/secmod-cs/* /var/lib/taler-exchange/secmod-cs/ +fi +backup_file=/exported/postgres-backup.sql +if [[ $import_instr = singledump ]]; then + echo "Importing database dump" + if [[ ! -e "$backup_file" ]]; then + echo "Requested import, but backup file does not exist" >&2 + exit 1 + fi + sudo -u postgres psql postgres -f "$backup_file" +fi + +if [[ $import_instr != none ]]; then echo "Marking import as done" rm /exported/import-request fi - # We need to adjust file ownership, as the container might have different user and group # IDs than the volume. That can happen when the packages in the container are installed # in a different order.