Fix GrampsWeb production config: restart policy + sync to nginx sub_filter approach (STI-91)
- compose.yml: add restart: unless-stopped to grampsweb (production resilience) - docker-compose.prod.yml: remove stale container-patching, align to nginx sub_filter approach (STI-98/102); update GRAMPSWEB_BASE_URL default to full URL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -190,6 +190,7 @@ services:
|
|||||||
|
|
||||||
grampsweb:
|
grampsweb:
|
||||||
image: ghcr.io/gramps-project/grampsweb:latest
|
image: ghcr.io/gramps-project/grampsweb:latest
|
||||||
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "8090:5000"
|
- "8090:5000"
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -123,56 +123,16 @@ services:
|
|||||||
- GRAMPSWEB_ADMIN_EMAIL=${GRAMPSWEB_ADMIN_EMAIL}
|
- GRAMPSWEB_ADMIN_EMAIL=${GRAMPSWEB_ADMIN_EMAIL}
|
||||||
- GRAMPSWEB_ADMIN_PASSWORD=${GRAMPSWEB_ADMIN_PASSWORD}
|
- GRAMPSWEB_ADMIN_PASSWORD=${GRAMPSWEB_ADMIN_PASSWORD}
|
||||||
- GRAMPSWEB_TREE=${GRAMPSWEB_TREE:-Stiftung}
|
- GRAMPSWEB_TREE=${GRAMPSWEB_TREE:-Stiftung}
|
||||||
- GRAMPSWEB_BASE_URL=${GRAMPSWEB_BASE_URL:-/}
|
- GRAMPSWEB_BASE_URL=${GRAMPSWEB_BASE_URL:-https://vhtv-stiftung.de/ahnenforschung}
|
||||||
- GRAMPSWEB_CELERY_CONFIG__broker_url=redis://redis:6379/0
|
- GRAMPSWEB_CELERY_CONFIG__broker_url=redis://redis:6379/0
|
||||||
- GRAMPSWEB_CELERY_CONFIG__result_backend=redis://redis:6379/0
|
- GRAMPSWEB_CELERY_CONFIG__result_backend=redis://redis:6379/0
|
||||||
- GRAMPSWEB_RATELIMIT_STORAGE_URI=redis://redis:6379/1
|
- GRAMPSWEB_RATELIMIT_STORAGE_URI=redis://redis:6379/1
|
||||||
- GRAMPSWEB_NEW_DB_BACKEND=sqlite
|
- GRAMPSWEB_NEW_DB_BACKEND=sqlite
|
||||||
- GRAMPSWEB_SUBPATH=${GRAMPSWEB_SUBPATH:-/ahnenforschung}
|
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then
|
# All subpath rewriting is handled by nginx sub_filter — no container patching needed.
|
||||||
SUBPATH="$$GRAMPSWEB_SUBPATH"
|
|
||||||
case "$$SUBPATH" in */) ;; *) SUBPATH="$${SUBPATH}/" ;; esac
|
|
||||||
echo "[grampsweb] Patching static files for subpath $$SUBPATH ..."
|
|
||||||
find / -name index.html -path "*/gramps*" -o -name index.html -path "*/static/*" 2>/dev/null | while read f; do
|
|
||||||
if grep -q '<base href="/">' "$$f" 2>/dev/null; then
|
|
||||||
sed -i "s|<base href=\"/\">|<base href=\"$$SUBPATH\">|g" "$$f"
|
|
||||||
echo "[grampsweb] patched base href: $$f"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
for f in /app/static/*.js; do
|
|
||||||
if [ -f "$$f" ] && grep -q '/api/' "$$f" 2>/dev/null; then
|
|
||||||
sed -i "s|\"/api/|\"$${SUBPATH}api/|g" "$$f"
|
|
||||||
sed -i 's|`/api/|`'"$${SUBPATH}"'api/|g' "$$f"
|
|
||||||
sed -i "s|\"/lang/|\"$${SUBPATH}lang/|g" "$$f"
|
|
||||||
sed -i 's|`/lang/|`'"$${SUBPATH}"'lang/|g' "$$f"
|
|
||||||
sed -i "s|\"/fonts/|\"$${SUBPATH}fonts/|g" "$$f"
|
|
||||||
sed -i 's|`/fonts/|`'"$${SUBPATH}"'fonts/|g' "$$f"
|
|
||||||
sed -i "s|\"/assets/|\"$${SUBPATH}assets/|g" "$$f"
|
|
||||||
sed -i 's|`/assets/|`'"$${SUBPATH}"'assets/|g' "$$f"
|
|
||||||
sed -i "s|location\.href=\"/\"|location.href=\"$$SUBPATH\"|g" "$$f"
|
|
||||||
sed -i "s|document\.location\.href=\"/\"|document.location.href=\"$$SUBPATH\"|g" "$$f"
|
|
||||||
echo "[grampsweb] patched JS paths: $$f"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ -f /app/static/sw.js ]; then
|
|
||||||
sed -i "s|createHandlerBoundToURL(\"/index.html\")|createHandlerBoundToURL(\"$${SUBPATH}index.html\")|g" /app/static/sw.js
|
|
||||||
SUBPATH_BS=$$(echo "$$SUBPATH" | sed "s|/|\\\\\\\\/|g")
|
|
||||||
sed -i "s|\\^\\\\/api|\\^$${SUBPATH_BS}api|g" /app/static/sw.js
|
|
||||||
echo "[grampsweb] patched sw.js navigation routes"
|
|
||||||
fi
|
|
||||||
find /app/static -name '*.css' 2>/dev/null | while read f; do
|
|
||||||
if grep -q '\.\./fonts/' "$$f" 2>/dev/null; then
|
|
||||||
sed -i "s|'../fonts/|'fonts/|g" "$$f"
|
|
||||||
sed -i "s|\"../fonts/|\"fonts/|g" "$$f"
|
|
||||||
echo "[grampsweb] patched CSS font paths: $$f"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "[grampsweb] Done."
|
|
||||||
fi
|
|
||||||
echo "[grampsweb] Ensuring admin user exists ..."
|
echo "[grampsweb] Ensuring admin user exists ..."
|
||||||
python3 << 'PYEOF' 2>&1 | grep -v Gtk
|
python3 << 'PYEOF' 2>&1 | grep -v Gtk
|
||||||
from gramps_webapi.app import create_app
|
from gramps_webapi.app import create_app
|
||||||
|
|||||||
Reference in New Issue
Block a user