275aff1430
Los scripts del mirror (00-90) vivian solo en el disco. Van al repo; los datos que generan no (16 GB entre crawl, snapshot del origen y Joomla restaurado) -> .gitignore. Nuevo 91-repone-assets404.sh: repone los ficheros que el crawl no capturo porque se referencian SOLO desde CSS y el crawler seguia enlaces HTML (system.css, los fondos de fe_adulta_1, ratingstars.gif de K2). Salian como 404 en los logs de nginx del Hetzner. Descarga por HTTP desde el Joomla local aislado, nunca del filesystem -- mismo principio que el crawl, para no arrastrar los .php comprometidos del #183 -- y escanea PHP embebido antes de copiar a site/. Resultado sobre las 286 rutas unicas con 404 del log: 196 repuestas y verificadas en produccion (196/196 en 200 tras el rsync), 82 que dan 301->404 tambien en el origen (ya estaban rotas en la web original) y 8 rutas basura /%22/... de HTML mal formado. Refs #180 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
50 lines
1.8 KiB
Bash
50 lines
1.8 KiB
Bash
#!/bin/bash
|
|
# Preparacion del crawl: hosts, liberacion de RAM, estructura de la corrida
|
|
set -uo pipefail
|
|
BASE=/home/rafa/joomla-migration/mirror-antiguo
|
|
INV=$BASE/inventory
|
|
WORKERS=${WORKERS:-4}
|
|
|
|
IP=$(docker inspect joomla-mirror-web -f '{{range $k,$v := .NetworkSettings.Networks}}{{$v.IPAddress}}{{end}}')
|
|
if ! grep -q 'antiguo.feadulta.com' /etc/hosts; then
|
|
echo "$IP antiguo.feadulta.com" | sudo -n tee -a /etc/hosts >/dev/null 2>&1 \
|
|
|| echo "AVISO: no pude escribir /etc/hosts (hazlo como root)"
|
|
fi
|
|
grep 'antiguo.feadulta.com' /etc/hosts || true
|
|
|
|
# --- parar contenedores no implicados (autorizado por Rafa) ---
|
|
KEEP='joomla-mirror-web|joomla-mysql|gitea|hub-proxy|beszel-agent'
|
|
STOPPED=$BASE/stopped-containers.txt
|
|
if [ ! -s "$STOPPED" ]; then
|
|
docker ps --format '{{.Names}}' | grep -vE "^($KEEP)$" > "$STOPPED"
|
|
echo "--- parando ---"; cat "$STOPPED"
|
|
xargs -r -a "$STOPPED" docker stop >/dev/null
|
|
fi
|
|
echo "--- en marcha ahora ---"
|
|
docker ps --format '{{.Names}}' | tr '\n' ' '; echo
|
|
|
|
# --- estructura de la corrida ---
|
|
RUN=$(date -u +%Y%m%dT%H%M%SZ)
|
|
DIR=$BASE/runs/$RUN
|
|
mkdir -p "$DIR/raw" "$DIR/chunks" "$DIR/logs"
|
|
echo "$RUN" > "$BASE/CURRENT_RUN"
|
|
|
|
split -n l/$WORKERS -d --additional-suffix=.txt "$INV/urls-input.txt" "$DIR/chunks/urls-"
|
|
wc -l "$DIR/chunks"/*.txt
|
|
|
|
cat > "$DIR/meta.json" <<EOF
|
|
{
|
|
"run": "$RUN",
|
|
"origen": "Joomla legacy restaurado en local (contenedor joomla-mirror-web, BD joomla_mirror)",
|
|
"origen_ip": "$IP",
|
|
"host_virtual": "antiguo.feadulta.com",
|
|
"inventario": "inventory/urls-input.txt",
|
|
"urls_inventario": $(wc -l < "$INV/urls-input.txt"),
|
|
"workers": $WORKERS,
|
|
"wget": "$(wget --version | head -1)",
|
|
"nota": "Crawl acotado por inventario de BD. Sin recursion. Ver issue rafa/feadulta#180 comment-499."
|
|
}
|
|
EOF
|
|
cat "$DIR/meta.json"
|
|
free -g | head -2
|