Compare commits
12 Commits
b257fc090f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a3577baff | ||
|
|
d5eb072a46 | ||
|
|
700a6472b7 | ||
|
|
905e5a7d6c | ||
|
|
3cdf49419e | ||
|
|
5d27f9235e | ||
|
|
c305417bb9 | ||
|
|
2a579c83c0 | ||
|
|
55da366014 | ||
|
|
66ccdc793c | ||
|
|
cee51ccec2 | ||
|
|
951c434ef2 |
@@ -209,9 +209,9 @@ services:
|
||||
|
||||
volumes:
|
||||
dbdata_dev:
|
||||
gramps_data_dev:
|
||||
paperless_data_dev:
|
||||
paperless_media_dev:
|
||||
paperless_export_dev:
|
||||
paperless_consume_dev:
|
||||
gramps_data_dev:
|
||||
ollama_data_dev:
|
||||
|
||||
74
compose.yml
74
compose.yml
@@ -193,15 +193,81 @@ services:
|
||||
ports:
|
||||
- "8090:5000"
|
||||
environment:
|
||||
- GRAMPSWEB_SECRET_KEY=${GRAMPSWEB_SECRET_KEY}
|
||||
- GRAMPSWEB_ADMIN_EMAIL=${GRAMPSWEB_ADMIN_EMAIL}
|
||||
- GRAMPSWEB_ADMIN_PASSWORD=${GRAMPSWEB_ADMIN_PASSWORD}
|
||||
- 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:-/ahnenforschung}
|
||||
- GRAMPSWEB_BASE_URL=${GRAMPSWEB_BASE_URL:-http://localhost:8090}
|
||||
- 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
|
||||
- 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:
|
||||
- gramps_data:/app/data
|
||||
depends_on:
|
||||
|
||||
@@ -128,6 +128,72 @@ 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
|
||||
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:
|
||||
- gramps_data:/app/data
|
||||
depends_on:
|
||||
|
||||
@@ -83,6 +83,8 @@ server {
|
||||
}
|
||||
|
||||
# GrampsWeb Ahnenforschung
|
||||
# GrampsWeb SPA has <base href="/"> hardcoded — sub_filter rewrites it
|
||||
# so asset URLs resolve under /ahnenforschung/ instead of /
|
||||
location /ahnenforschung/ {
|
||||
proxy_pass http://127.0.0.1:8090/;
|
||||
proxy_set_header Host $host;
|
||||
@@ -91,7 +93,14 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
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_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
17
deploy.sh
17
deploy.sh
@@ -135,6 +135,23 @@ echo ""
|
||||
echo "--- Collecting static files ---"
|
||||
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 "--- Service status ---"
|
||||
docker compose -f "$COMPOSE_FILE" ps
|
||||
|
||||
Reference in New Issue
Block a user