diff --git a/compose.yml b/compose.yml index 40856ac..b2fd8b2 100644 --- a/compose.yml +++ b/compose.yml @@ -202,6 +202,23 @@ services: - GRAMPSWEB_CELERY_CONFIG__result_backend=redis://redis:6379/0 - GRAMPSWEB_RATELIMIT_STORAGE_URI=redis://redis:6379/1 - GRAMPSWEB_NEW_DB_BACKEND=sqlite + - GRAMPSWEB_SUBPATH=${GRAMPSWEB_SUBPATH:-/ahnenforschung} + command: + - sh + - -c + - | + 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" + fi + 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: - gramps_data:/app/data depends_on: diff --git a/deploy-production/docker-compose.prod.yml b/deploy-production/docker-compose.prod.yml index 2244991..173a234 100644 --- a/deploy-production/docker-compose.prod.yml +++ b/deploy-production/docker-compose.prod.yml @@ -128,6 +128,22 @@ services: - GRAMPSWEB_CELERY_CONFIG__result_backend=redis://redis:6379/0 - GRAMPSWEB_RATELIMIT_STORAGE_URI=redis://redis:6379/1 - 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 + sed -i "s|||g" \ + /app/src/gramps_webapi/static/index.html \ + /app/static/index.html 2>/dev/null || true + echo "Patched to $$SUBPATH" + fi + 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: - gramps_data:/app/data depends_on: