From ebf7ec2d9eb88713d458023f93a1a1e388db1578 Mon Sep 17 00:00:00 2001 From: SysAdmin Agent Date: Sun, 5 Apr 2026 19:58:08 +0000 Subject: [PATCH] Align GrampsWeb setup with official docker-compose (STI-91) Replace custom GrampsWeb config with the official setup: - Use YAML anchor (&grampsweb / <<: *grampsweb) for DRY config - Add all 8 official volumes: users, indexdir, thumbnail_cache, cache, secret, grampsdb, media, tmp - Remove custom admin creation command (use GrampsWeb's built-in flow) - Remove GRAMPSWEB_SECRET_KEY (managed by gramps_secret volume) - Celery worker inherits full config via YAML merge - Shared /tmp volume between web and celery for file transfers Previous setup only had 2 volumes (data, cache), causing data loss on container restart and GEDCOM import failures. Co-Authored-By: Paperclip --- compose.yml | 76 +++++++++++++++--------------------------------- env-template.txt | 5 +--- 2 files changed, 25 insertions(+), 56 deletions(-) diff --git a/compose.yml b/compose.yml index 47afa62..1bfc37d 100644 --- a/compose.yml +++ b/compose.yml @@ -188,73 +188,45 @@ services: wait $$OLLAMA_PID " - grampsweb: + grampsweb: &grampsweb image: ghcr.io/gramps-project/grampsweb:latest restart: unless-stopped ports: - "8090:5000" environment: - - GRAMPSWEB_SECRET_KEY=${GRAMPSWEB_SECRET_KEY:-dev-grampsweb-secret-key-not-for-production} - - GRAMPSWEB_ADMIN_EMAIL=${GRAMPSWEB_ADMIN_EMAIL:-admin@localhost} - - GRAMPSWEB_ADMIN_PASSWORD=${GRAMPSWEB_ADMIN_PASSWORD:-gramps_dev_password} - - GRAMPSWEB_TREE=${GRAMPSWEB_TREE:-Stiftung} - - GRAMPSWEB_BASE_URL=${GRAMPSWEB_BASE_URL:-https://ahnenforschung.vhtv-stiftung.de} - - 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 - - | - # GrampsWeb runs on its own subdomain — no subpath rewriting needed. - 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 + GRAMPSWEB_TREE: ${GRAMPSWEB_TREE:-Stiftung} + 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_BASE_URL: ${GRAMPSWEB_BASE_URL:-https://ahnenforschung.vhtv-stiftung.de} volumes: - - gramps_data:/app/data + - gramps_users:/app/users + - gramps_index:/app/indexdir + - gramps_thumb_cache:/app/thumbnail_cache - gramps_cache:/app/cache + - gramps_secret:/app/secret + - gramps_db:/root/.gramps/grampsdb + - gramps_media:/app/media + - gramps_tmp:/tmp depends_on: - - db - redis grampsweb_celery: - image: ghcr.io/gramps-project/grampsweb:latest - restart: unless-stopped - environment: - - GRAMPSWEB_SECRET_KEY=${GRAMPSWEB_SECRET_KEY:-dev-grampsweb-secret-key-not-for-production} - - GRAMPSWEB_TREE=${GRAMPSWEB_TREE:-Stiftung} - - GRAMPSWEB_BASE_URL=${GRAMPSWEB_BASE_URL:-https://ahnenforschung.vhtv-stiftung.de} - - GRAMPSWEB_CELERY_CONFIG__broker_url=redis://redis:6379/0 - - GRAMPSWEB_CELERY_CONFIG__result_backend=redis://redis:6379/0 - - GRAMPSWEB_NEW_DB_BACKEND=sqlite - command: celery -A gramps_webapi.celery worker --loglevel=info - volumes: - - gramps_data:/app/data - - gramps_cache:/app/cache + <<: *grampsweb + ports: [] depends_on: + - grampsweb - redis + command: celery -A gramps_webapi.celery worker --loglevel=INFO --concurrency=2 volumes: dbdata: - gramps_data: + gramps_users: + gramps_index: + gramps_thumb_cache: gramps_cache: + gramps_secret: + gramps_db: + gramps_media: + gramps_tmp: ollama_data: diff --git a/env-template.txt b/env-template.txt index 0a62fe6..0ff5f16 100644 --- a/env-template.txt +++ b/env-template.txt @@ -59,10 +59,7 @@ GRAMPS_USERNAME=Stiftung GRAMPS_PASSWORD=your-gramps-password-here GRAMPS_API_TOKEN= -# GrampsWeb Container Konfiguration -GRAMPSWEB_SECRET_KEY=your-grampsweb-secret-key-here -GRAMPSWEB_ADMIN_EMAIL=admin@vhtv-stiftung.de -GRAMPSWEB_ADMIN_PASSWORD=your-grampsweb-admin-password-here +# GrampsWeb Container Konfiguration (aligned with official docker-compose) GRAMPSWEB_TREE=Stiftung # Full external URL (used by GrampsWeb for email links, OIDC, etc.) GRAMPSWEB_BASE_URL=https://ahnenforschung.vhtv-stiftung.de