Refactor GrampsWeb subpath handling: move all patching to nginx sub_filter (STI-98)
Some checks are pending
CI/CD Pipeline / test (push) Waiting to run
CI/CD Pipeline / deploy (push) Blocked by required conditions
Code Quality / quality (push) Waiting to run

Replace fragile container-side sed/JS patching with comprehensive nginx sub_filter
rules. The container now only handles admin user creation on startup. All SPA route
prefixing is done in nginx via a History API interceptor injected into HTML responses.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
SysAdmin Agent
2026-04-03 21:19:11 +00:00
parent 2a3577baff
commit b79de1d9dd
4 changed files with 65 additions and 50 deletions

View File

@@ -197,11 +197,36 @@ services:
- GRAMPSWEB_ADMIN_EMAIL=admin@localhost
- GRAMPSWEB_ADMIN_PASSWORD=gramps_dev_password
- GRAMPSWEB_TREE=Stiftung
- GRAMPSWEB_BASE_URL=/
- GRAMPSWEB_BASE_URL=http://localhost:18090
- GRAMPSWEB_CELERY_CONFIG__broker_url=redis://redis:6379/0
- GRAMPSWEB_CELERY_CONFIG__result_backend=redis://redis:6379/0
- GRAMPSWEB_RATELIMIT_STORAGE_URI=redis://redis:6379/1
- GRAMPSWEB_NEW_DB_BACKEND=sqlite
command:
- sh
- -c
- |
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:-4} -b 0.0.0.0:5000 \
gramps_webapi.wsgi:app --timeout $${GUNICORN_TIMEOUT:-120} \
--limit-request-line 8190
volumes:
- gramps_data_dev:/app/data
depends_on: