From 2a579c83c0698fcf64bad02d9b3d1ae0d1dc23eb Mon Sep 17 00:00:00 2001 From: SysAdmin Agent Date: Tue, 24 Mar 2026 08:44:21 +0000 Subject: [PATCH] Improve GrampsWeb base href patching: find all index.html copies (STI-90) The previous sed only patched two known paths. Now uses find to discover and patch all index.html files containing across the entire container, with logging to show which files were patched. Co-Authored-By: Claude Opus 4.6 --- compose.yml | 13 ++++++++----- deploy-production/docker-compose.prod.yml | 12 ++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/compose.yml b/compose.yml index b2fd8b2..b629cf1 100644 --- a/compose.yml +++ b/compose.yml @@ -209,12 +209,15 @@ services: - | if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then SUBPATH="$$GRAMPSWEB_SUBPATH" - # Ensure trailing slash for base href case "$$SUBPATH" in */) ;; *) SUBPATH="$${SUBPATH}/" ;; esac - sed -i "s|||g" \ - /app/src/gramps_webapi/static/index.html \ - /app/static/index.html 2>/dev/null || true - echo "Patched to $$SUBPATH" + echo "[grampsweb] Patching to $$SUBPATH ..." + find / -name index.html -path "*/gramps*" -o -name index.html -path "*/static/*" 2>/dev/null | while read f; do + if grep -q '' "$$f" 2>/dev/null; then + sed -i "s|||g" "$$f" + echo "[grampsweb] patched: $$f" + fi + done + echo "[grampsweb] Done." fi exec gunicorn -w $${GUNICORN_NUM_WORKERS:-8} -b 0.0.0.0:5000 \ gramps_webapi.wsgi:app --timeout $${GUNICORN_TIMEOUT:-120} \ diff --git a/deploy-production/docker-compose.prod.yml b/deploy-production/docker-compose.prod.yml index 173a234..fe4b69a 100644 --- a/deploy-production/docker-compose.prod.yml +++ b/deploy-production/docker-compose.prod.yml @@ -136,10 +136,14 @@ services: if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then SUBPATH="$$GRAMPSWEB_SUBPATH" case "$$SUBPATH" in */) ;; *) SUBPATH="$${SUBPATH}/" ;; esac - sed -i "s|||g" \ - /app/src/gramps_webapi/static/index.html \ - /app/static/index.html 2>/dev/null || true - echo "Patched to $$SUBPATH" + echo "[grampsweb] Patching to $$SUBPATH ..." + find / -name index.html -path "*/gramps*" -o -name index.html -path "*/static/*" 2>/dev/null | while read f; do + if grep -q '' "$$f" 2>/dev/null; then + sed -i "s|||g" "$$f" + echo "[grampsweb] patched: $$f" + fi + done + echo "[grampsweb] Done." fi exec gunicorn -w $${GUNICORN_NUM_WORKERS:-8} -b 0.0.0.0:5000 \ gramps_webapi.wsgi:app --timeout $${GUNICORN_TIMEOUT:-120} \