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"