commit 3ae088af4b138878c97aa1295826c322daccf9c9 parent be659691271d4b520407f341d39caac4b6aa3384 Author: Devan Carpenter <devan@taler.net> Date: Thu, 27 Jun 2024 18:19:52 -0400 move exchange master key dir to a separate volume we want to be able to destroy the main data volume while keeping the master key around. this attempts to migrate the key to the new volume if it already exists is the main data volume resolves mantis bug #8293 Diffstat:
| M | sandcastle-run | | | 1 | + |
| M | scripts/demo/setup-sandcastle.sh | | | 21 | +++++++++++++++++++++ |
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/sandcastle-run b/sandcastle-run @@ -58,6 +58,7 @@ exec podman run \ --name taler-sandcastle \ --systemd=always \ -v talerdata:/talerdata:Z \ + -v talerdata_persistent:/talerdata_persistent:Z \ $OVERRIDES \ -v $PWD/scripts:/scripts:Z \ -v $PWD/scripts/$SETUP_NAME:/provision:Z \ diff --git a/scripts/demo/setup-sandcastle.sh b/scripts/demo/setup-sandcastle.sh @@ -94,10 +94,31 @@ function lift_dir() { fi } +function persist_exchange_key() { + src=$1 + target=$2 + if [[ -L "$src" ]]; then + # be idempotent + echo "$src is already a symlink" + elif [[ -d /talerdata_persistent/$target ]]; then + echo "symlinking existing /talerdata_persistent/$target" + rm -rf "$src" + ln -s "/talerdata_persistent/$target" "$src" + # if the directory is empty then we want to attempt to + # move the keys over from the main data dir. + # we check for an empty dir using "ls -A" + elif [[ -z "$(ls -A /talerdata_persistent/$target)" ]]; then + echo "symlinking new /talerdata_persistent/$target" + mv "/talerdata/var-lib-taler/$target" "/talerdata_persistent/" + ln -s "/talerdata_persistent/$target" "$src" + fi +} + lift_dir /var/lib/taler var-lib-taler lift_dir /etc/taler etc-taler lift_dir /etc/libeufin etc-libeufin lift_dir /var/lib/postgresql var-lib-postgresql +persist_exchange_key /var/lib/taler/exchange-offline exchange-offline # Caddy configuration. # We use the caddy reverse proxy with automatic