From 9476b086689b6c7f1a16168a6dc6d3a8efe87891 Mon Sep 17 00:00:00 2001 From: gitadmin Date: Sun, 27 Sep 2026 03:07:28 +0000 Subject: [PATCH] Add the per-site refresh script --- bin/refresh-site.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 bin/refresh-site.sh diff --git a/bin/refresh-site.sh b/bin/refresh-site.sh new file mode 100644 index 0000000..c29b041 --- /dev/null +++ b/bin/refresh-site.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Restore one corpus site from its snapshot and point its URLs at the public name. +set -e +site=$1 +[ -n "$site" ] || { echo "usage: refresh-site.sh |--all"; exit 2; } + +if [ "$site" = "--all" ]; then + tail -n +2 sites.csv | cut -d, -f1 | while read -r s; do sh "$0" "$s"; done + exit 0 +fi + +echo "restoring $site" +docker compose -p corpus stop "$site" +gunzip -c "snapshots/$site.sql.gz" | docker compose -p corpus exec -T "${site}_db" sh -c 'mysql' +docker compose -p corpus start "$site" +echo "$site is back up"