scripts: YunoHost post_app_upgrade hook für n8n-Proxy-Config

Stellt my_webapp.conf nach yunohost app upgrade automatisch wieder her.
Deploy: /etc/yunohost/hooks.d/post_app_upgrade/99-n8n-proxy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-05-06 01:15:42 +02:00
commit 3ea23beb74

View file

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# YunoHost post_app_upgrade hook
# Deploy to: /etc/yunohost/hooks.d/post_app_upgrade/99-n8n-proxy
# Permissions: chmod 700
#
# Restores the n8n reverse-proxy location block in my_webapp.conf
# after a "yunohost app upgrade my_webapp" overwrites it.
set -euo pipefail
CONF=/etc/nginx/conf.d/n8n.linix.de.d/my_webapp.conf
[[ -f "$CONF" ]] || exit 0
grep -q 'proxy_pass' "$CONF" && exit 0
cat > "$CONF" << 'NGINX'
#sub_path_only rewrite ^/$ / permanent;
location / {
proxy_pass http://192.168.179.124:8088;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
client_max_body_size 50m;
}
NGINX
nginx -t && systemctl reload nginx
echo "[n8n-proxy hook] nginx proxy config restored after my_webapp upgrade."