Compare commits

...

15 Commits

Author SHA1 Message Date
SysAdmin Agent
2a3577baff Fix GrampsWeb: patch service worker to respect subpath (STI-90)
Some checks failed
Code Quality / quality (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
The GrampsWeb service worker was serving index.html for ALL navigation
requests (including Django app routes), hijacking the entire domain.
Patched sw.js at startup to:
- Use subpath-prefixed index.html in createHandlerBoundToURL
- Update denylist regex to match subpath API routes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 12:33:18 +00:00
SysAdmin Agent
d5eb072a46 Fix GrampsWeb: recursive CSS find + auto-create admin on startup (STI-90)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
- Use `find` instead of `*.css` glob to catch fonts/fonts.css in subdirs
- Add Python script to auto-create Admin user if no users exist yet

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 11:18:18 +00:00
SysAdmin Agent
700a6472b7 Fix GrampsWeb subpath: patch CSS font paths from ../fonts/ to fonts/ (STI-90)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
CSS url() resolves relative to the stylesheet, not <base href>. With
the stylesheet at /ahnenforschung/style.css, url('../fonts/...') resolves
to /fonts/ (root) instead of /ahnenforschung/fonts/. Changed to relative
url('fonts/...') which correctly resolves under the subpath.

Also fixes Material Icons font not loading (menu icons broken).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 10:27:47 +00:00
SysAdmin Agent
905e5a7d6c Fix GrampsWeb subpath: patch location.href redirects to root (STI-90)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
GrampsWeb JS has 6 instances of location.href="/" that redirect users
to the root domain (Django app) instead of /ahnenforschung/. These
are now patched at container startup alongside the API path rewrites.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 10:08:35 +00:00
SysAdmin Agent
3cdf49419e Fix GrampsWeb subpath: patch API/lang/font paths in JS at startup (STI-90)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
GrampsWeb's frontend JS hardcodes absolute paths like "/api/...",
"/lang/...", "/fonts/..." which bypass <base href>. These now get
rewritten to "/ahnenforschung/api/..." etc. at container startup,
matching both double-quoted and template-literal (backtick) patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 09:57:29 +00:00
SysAdmin Agent
5d27f9235e Fix compose.dev.yml: remove duplicate gramps_data_dev volume (STI-90)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 09:17:32 +00:00
SysAdmin Agent
c305417bb9 Add dev defaults for GrampsWeb admin credentials in compose.yml (STI-90)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
Without these defaults, GrampsWeb starts without an admin user when
no .env file is present (common for local dev).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 08:57:54 +00:00
SysAdmin Agent
2a579c83c0 Improve GrampsWeb base href patching: find all index.html copies (STI-90)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
The previous sed only patched two known paths. Now uses find to discover
and patch all index.html files containing <base href="/"> across the
entire container, with logging to show which files were patched.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 08:44:21 +00:00
SysAdmin Agent
55da366014 Fix GrampsWeb subpath: patch <base href> at container startup (STI-93)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
The GrampsWeb SPA has <base href="/"> hardcoded at build time, causing
assets to load from / instead of /ahnenforschung/ when behind a reverse
proxy. Instead of relying on nginx sub_filter (which may not be available),
patch the HTML at container startup via GRAMPSWEB_SUBPATH env var.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 02:37:53 +00:00
SysAdmin Agent
66ccdc793c Fix compose.dev.yml: declare missing gramps_data_dev volume (STI-93)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 01:30:58 +00:00
SysAdmin Agent
cee51ccec2 Fix deploy.sh: auto-update nginx config on deploy (STI-93)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
deploy.sh was only updating Docker containers but never copying the
nginx config to the host. This meant changes like the sub_filter fix
for GrampsWeb's <base href> rewrite were never applied.

Now diffs deploy-production/nginx.conf against /etc/nginx/sites-enabled/stiftung
and reloads nginx when changed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 00:25:55 +00:00
SysAdmin Agent
951c434ef2 Fix GrampsWeb subpath: use nginx sub_filter for <base href> rewrite (STI-93)
Some checks failed
CI/CD Pipeline / deploy (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
GrampsWeb's SPA has <base href="/"> hardcoded at build time. The
GRAMPSWEB_BASE_URL env var is a full URL for API/OIDC, not a path prefix.
This means assets always load from root, hitting Django instead of GrampsWeb.

Fix: nginx sub_filter rewrites <base href="/"> to <base href="/ahnenforschung/">
so the browser resolves all SPA assets under the correct subpath.

Also revert BASE_URL default to a proper URL (not a path).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 23:23:28 +00:00
SysAdmin Agent
b257fc090f Fix GrampsWeb: set BASE_URL default to /ahnenforschung for subpath (STI-93)
Some checks failed
CI/CD Pipeline / deploy (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
The SPA needs GRAMPSWEB_BASE_URL=/ahnenforschung to generate correct
asset URLs when served behind nginx at /ahnenforschung/. Without this,
JS/CSS assets load from / instead of /ahnenforschung/, causing a blank page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 22:11:58 +00:00
SysAdmin Agent
5afa6e0ce1 Fix env-template: GRAMPSWEB_BASE_URL korrekt auf /ahnenforschung setzen (STI-91)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 21:10:58 +00:00
SysAdmin Agent
7c7dd6ed1c Fix GrampsWeb dev config: remove broken STATIC_PATH/STATIC_URL (STI-93)
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy (push) Has been cancelled
Code Quality / quality (push) Has been cancelled
Mirror the production fix from fd626a9 in compose.dev.yml. The
GRAMPSWEB_STATIC_PATH was set to a URL path instead of a filesystem path,
causing 404 on all routes. BASE_URL simplified to / (nginx handles subpath).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 21:07:41 +00:00
6 changed files with 166 additions and 10 deletions

View File

@@ -197,9 +197,7 @@ services:
- GRAMPSWEB_ADMIN_EMAIL=admin@localhost - GRAMPSWEB_ADMIN_EMAIL=admin@localhost
- GRAMPSWEB_ADMIN_PASSWORD=gramps_dev_password - GRAMPSWEB_ADMIN_PASSWORD=gramps_dev_password
- GRAMPSWEB_TREE=Stiftung - GRAMPSWEB_TREE=Stiftung
- GRAMPSWEB_BASE_URL=/ahnenforschung - GRAMPSWEB_BASE_URL=/
- GRAMPSWEB_STATIC_PATH=/ahnenforschung/static
- GRAMPSWEB_STATIC_URL=/ahnenforschung/static/
- 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
@@ -211,9 +209,9 @@ services:
volumes: volumes:
dbdata_dev: dbdata_dev:
gramps_data_dev:
paperless_data_dev: paperless_data_dev:
paperless_media_dev: paperless_media_dev:
paperless_export_dev: paperless_export_dev:
paperless_consume_dev: paperless_consume_dev:
gramps_data_dev:
ollama_data_dev: ollama_data_dev:

View File

@@ -193,15 +193,81 @@ services:
ports: ports:
- "8090:5000" - "8090:5000"
environment: environment:
- GRAMPSWEB_SECRET_KEY=${GRAMPSWEB_SECRET_KEY} - GRAMPSWEB_SECRET_KEY=${GRAMPSWEB_SECRET_KEY:-dev-grampsweb-secret-key-not-for-production}
- GRAMPSWEB_ADMIN_EMAIL=${GRAMPSWEB_ADMIN_EMAIL} - GRAMPSWEB_ADMIN_EMAIL=${GRAMPSWEB_ADMIN_EMAIL:-admin@localhost}
- GRAMPSWEB_ADMIN_PASSWORD=${GRAMPSWEB_ADMIN_PASSWORD} - GRAMPSWEB_ADMIN_PASSWORD=${GRAMPSWEB_ADMIN_PASSWORD:-gramps_dev_password}
- GRAMPSWEB_TREE=${GRAMPSWEB_TREE:-Stiftung} - GRAMPSWEB_TREE=${GRAMPSWEB_TREE:-Stiftung}
- GRAMPSWEB_BASE_URL=${GRAMPSWEB_BASE_URL:-/} - GRAMPSWEB_BASE_URL=${GRAMPSWEB_BASE_URL:-http://localhost:8090}
- 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:
- sh
- -c
- |
if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then
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 ..."
python3 << 'PYEOF' 2>&1 | grep -v Gtk
from gramps_webapi.app import create_app
from gramps_webapi.auth import add_user, get_number_users, ROLE_OWNER
import os
email = os.environ.get('GRAMPSWEB_ADMIN_EMAIL', '')
pw = os.environ.get('GRAMPSWEB_ADMIN_PASSWORD', '')
if email and pw:
app = create_app()
with app.app_context():
if get_number_users() == 0:
add_user(name='Admin', email=email, password=pw, role=ROLE_OWNER)
print('[grampsweb] Admin user created')
else:
print('[grampsweb] Users already exist, skipping')
else:
print('[grampsweb] No admin credentials configured, skipping')
PYEOF
exec gunicorn -w $${GUNICORN_NUM_WORKERS:-8} -b 0.0.0.0:5000 \
gramps_webapi.wsgi:app --timeout $${GUNICORN_TIMEOUT:-120} \
--limit-request-line 8190
volumes: volumes:
- gramps_data:/app/data - gramps_data:/app/data
depends_on: depends_on:

View File

@@ -128,6 +128,72 @@ services:
- 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:
- sh
- -c
- |
if [ -n "$$GRAMPSWEB_SUBPATH" ] && [ "$$GRAMPSWEB_SUBPATH" != "/" ]; then
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 ..."
python3 << 'PYEOF' 2>&1 | grep -v Gtk
from gramps_webapi.app import create_app
from gramps_webapi.auth import add_user, get_number_users, ROLE_OWNER
import os
email = os.environ.get('GRAMPSWEB_ADMIN_EMAIL', '')
pw = os.environ.get('GRAMPSWEB_ADMIN_PASSWORD', '')
if email and pw:
app = create_app()
with app.app_context():
if get_number_users() == 0:
add_user(name='Admin', email=email, password=pw, role=ROLE_OWNER)
print('[grampsweb] Admin user created')
else:
print('[grampsweb] Users already exist, skipping')
else:
print('[grampsweb] No admin credentials configured, skipping')
PYEOF
exec gunicorn -w $${GUNICORN_NUM_WORKERS:-8} -b 0.0.0.0:5000 \
gramps_webapi.wsgi:app --timeout $${GUNICORN_TIMEOUT:-120} \
--limit-request-line 8190
volumes: volumes:
- gramps_data:/app/data - gramps_data:/app/data
depends_on: depends_on:

View File

@@ -83,6 +83,8 @@ server {
} }
# GrampsWeb Ahnenforschung # GrampsWeb Ahnenforschung
# GrampsWeb SPA has <base href="/"> hardcoded — sub_filter rewrites it
# so asset URLs resolve under /ahnenforschung/ instead of /
location /ahnenforschung/ { location /ahnenforschung/ {
proxy_pass http://127.0.0.1:8090/; proxy_pass http://127.0.0.1:8090/;
proxy_set_header Host $host; proxy_set_header Host $host;
@@ -91,7 +93,14 @@ server {
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Script-Name /ahnenforschung; proxy_set_header X-Script-Name /ahnenforschung;
# WebSocket support (GrampsWeb uses SSE/WS for real-time updates) # Rewrite <base href="/"> to <base href="/ahnenforschung/">
# so the SPA loads JS/CSS from the correct subpath
proxy_set_header Accept-Encoding "";
sub_filter '<base href="/">' '<base href="/ahnenforschung/">';
sub_filter_once on;
sub_filter_types text/html;
# WebSocket support
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";

View File

@@ -135,6 +135,23 @@ echo ""
echo "--- Collecting static files ---" echo "--- Collecting static files ---"
docker compose -f "$COMPOSE_FILE" exec -T web python manage.py collectstatic --noinput docker compose -f "$COMPOSE_FILE" exec -T web python manage.py collectstatic --noinput
echo ""
echo "--- Updating nginx config ---"
NGINX_CONF="$PROD_DIR/deploy-production/nginx.conf"
NGINX_DEST="/etc/nginx/sites-enabled/stiftung"
if [[ -f "$NGINX_CONF" ]]; then
if ! diff -q "$NGINX_CONF" "$NGINX_DEST" &>/dev/null; then
echo "Nginx config changed — updating and reloading"
sudo cp "$NGINX_CONF" "$NGINX_DEST"
sudo nginx -t && sudo systemctl reload nginx
echo "Nginx reloaded"
else
echo "Nginx config unchanged — skipping"
fi
else
echo "WARNUNG: $NGINX_CONF nicht gefunden — nginx nicht aktualisiert"
fi
echo "" echo ""
echo "--- Service status ---" echo "--- Service status ---"
docker compose -f "$COMPOSE_FILE" ps docker compose -f "$COMPOSE_FILE" ps

View File

@@ -64,6 +64,6 @@ GRAMPSWEB_SECRET_KEY=your-grampsweb-secret-key-here
GRAMPSWEB_ADMIN_EMAIL=admin@vhtv-stiftung.de GRAMPSWEB_ADMIN_EMAIL=admin@vhtv-stiftung.de
GRAMPSWEB_ADMIN_PASSWORD=your-grampsweb-admin-password-here GRAMPSWEB_ADMIN_PASSWORD=your-grampsweb-admin-password-here
GRAMPSWEB_TREE=Stiftung GRAMPSWEB_TREE=Stiftung
GRAMPSWEB_BASE_URL=/ GRAMPSWEB_BASE_URL=/ahnenforschung