server/meta/bin/scrape
Chuck Adams c93ab24b05
add meta/bin/scrape
Signed-off-by: Chuck Adams <chaz@chaz.works>
2025-12-10 11:23:44 -07:00

26 lines
615 B
Bash
Executable file

#!/bin/bash
here=$(dirname "$0")
source "$here"/prelude.bash
[[ ${DANGEROUSLY_ALLOW_SCRAPE:-} = fair-site ]] || die "DANGEROUSLY_ALLOW_SCRAPE not set or not equal to 'fair-site' -- aborted"
SLEEP=${SLEEP:-10}
function dcexec() { docker compose exec fairpm-wordpress "$@"; }
function main() {
database=${1:-}
[[ -n $database ]] || die "Usage: $0 path/to/database.sql"
docker compose down --remove-orphans --volumes
docker compose up --build -d
echo "Sleeping for $SLEEP seconds..."
sleep "$SLEEP"
dcexec wp db import "$database"
dcexec meta/bin/fixup-db-snapshot
}
main "$@"