From 201af49a13e0ca538cbddb820d4825a364fd0ddd Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Tue, 17 Nov 2026 09:49:17 +0100 Subject: [PATCH] Portabase: support file and folder backups (restic / rclone) (#18766) * Portabase: support file and folder backups Install rclone and restic as the Docker image does and route /storage/restic/ and /storage/sync/ to rclone's restic and WebDAV servers. Updates add both to existing containers and restart Portabase, which looks for rclone only at start. * Portabase: check rclone and restic releases the usual way check_for_gh_release already reports a tool without a version file as new, so the extra existence checks only hid its release line. --- ct/portabase.sh | 40 ++++++++++++++++++++++++++++++++++++ install/portabase-install.sh | 20 ++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/ct/portabase.sh b/ct/portabase.sh index 2589b7847..a59947ed8 100644 --- a/ct/portabase.sh +++ b/ct/portabase.sh @@ -31,6 +31,46 @@ function update_script() { exit fi + TOOLS_CHANGED=false + if check_for_gh_release "rclone" "rclone/rclone"; then + TOOLS_CHANGED=true + fetch_and_deploy_gh_release "rclone" "rclone/rclone" "binary" "latest" "" "rclone-v*-linux-$(arch_resolve).deb" + fi + if check_for_gh_release "restic" "restic/restic"; then + TOOLS_CHANGED=true + fetch_and_deploy_gh_release "restic" "restic/restic" "singlefile" "latest" "/usr/local/bin" "restic_*_linux_$(arch_resolve).bz2" + fi + if ! grep -q "/storage/restic/" /etc/nginx/sites-available/portabase; then + msg_info "Adding file backup routes to Nginx" + cat <<'EOF' >/tmp/portabase-storage.conf + location /storage/restic/ { + proxy_pass http://127.0.0.1:1081; + proxy_request_buffering off; + proxy_buffering off; + proxy_http_version 1.1; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /storage/sync/ { + proxy_pass http://127.0.0.1:1082; + proxy_request_buffering off; + proxy_buffering off; + proxy_http_version 1.1; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +EOF + sed -i '/ignore_invalid_headers off;/r /tmp/portabase-storage.conf' /etc/nginx/sites-available/portabase + rm -f /tmp/portabase-storage.conf + $STD nginx -t + systemctl reload nginx + msg_ok "Added file backup routes to Nginx" + fi + if [[ "$TOOLS_CHANGED" == "true" ]]; then + systemctl restart portabase + fi + if check_for_gh_release "portabase" "Portabase/portabase"; then msg_info "Stopping Services" systemctl stop portabase portabase-tusd diff --git a/install/portabase-install.sh b/install/portabase-install.sh index 594bd1f0f..533ccc2b9 100644 --- a/install/portabase-install.sh +++ b/install/portabase-install.sh @@ -26,6 +26,8 @@ PG_DB_NAME="portabase" PG_DB_USER="portabase" setup_postgresql_db fetch_and_deploy_gh_release "portabase" "Portabase/portabase" "tarball" fetch_and_deploy_gh_release "tusd" "tus/tusd" "prebuild" "latest" "/opt/tusd" "tusd_linux_$(arch_resolve).tar.gz" +fetch_and_deploy_gh_release "rclone" "rclone/rclone" "binary" "latest" "" "rclone-v*-linux-$(arch_resolve).deb" +fetch_and_deploy_gh_release "restic" "restic/restic" "singlefile" "latest" "/usr/local/bin" "restic_*_linux_$(arch_resolve).bz2" msg_info "Configuring Portabase" mkdir -p /opt/portabase-data/uploads/tmp @@ -141,6 +143,24 @@ server { proxy_set_header Connection "upgrade"; } + location /storage/restic/ { + proxy_pass http://127.0.0.1:1081; + proxy_request_buffering off; + proxy_buffering off; + proxy_http_version 1.1; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /storage/sync/ { + proxy_pass http://127.0.0.1:1082; + proxy_request_buffering off; + proxy_buffering off; + proxy_http_version 1.1; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + location = /api/tus/hooks { deny all; return 404;