Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(update): default to pre-built release updates (Node-free server)

Juan Denis309851dabf66
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e3758661..59d52ed7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -187,6 +187,16 @@ awaiting a stable release:
### Changed
+- **`update.sh` now defaults to pre-built releases (Node-free updates).** The
+ frontend is compiled once in CI and shipped, so a normal `update.sh` no longer
+ rebuilds the SPA on the server — it fetches the pre-built release tarball,
+ meaning the server needs no Node/npm at all. This keeps updates working
+ uniformly on old distros, ARM/Raspberry Pi and tiny boxes. Opt into an on-box
+ source rebuild with `--source`, `--branch <name>`, or `BUILD_FROM_SOURCE=1`
+ (that path now requires Node 20.19+/22.12+ for the vite 8 toolchain; the
+ installer provisions Node 22 LTS and both scripts fail with a clear "upgrade
+ Node" message instead of a cryptic bundler error).
+
- **UI consistency round (Jobs, Queue Bus, Email, Marketplace)** — brought four
drifted pages back onto the shared host idiom. The **Jobs** page was rebuilt
to the /servers–/domains table-with-search pattern (SegControl status filter,
diff --git a/scripts/test/test_update.sh b/scripts/test/test_update.sh
index 9556556c..991cf944 100644
--- a/scripts/test/test_update.sh
+++ b/scripts/test/test_update.sh
@@ -1051,6 +1051,23 @@ else
bad "refresh_config left a literal @BIND_HOST@ (gunicorn would fail to bind after update)"
fi
+# --------------------------------------------------------------------------
+# T35 — updates default to release-mode (pre-built, Node-free) so the server
+# never needs Node/npm; --source, --branch and BUILD_FROM_SOURCE=1 opt into an
+# on-box source rebuild. Re-source update.sh with args and read the resolved
+# (USE_RELEASE|TARGET_BRANCH) the deploy dispatch keys off (plan 47 / vite 8).
+# --------------------------------------------------------------------------
+_mode() { ( SERVERKIT_NO_SELF_UPDATE=1 source "$UPDATE_SH" "$@" >/dev/null 2>&1
+ printf '%s|%s' "$USE_RELEASE" "$TARGET_BRANCH" ); }
+d="$(_mode)"; s="$(_mode --source)"; b="$(_mode --branch dev)"; r="$(_mode --release)"
+bfs="$(BUILD_FROM_SOURCE=1 _mode)"
+if [ "$d" = "1|" ] && [ "$s" = "0|" ] && [ "$b" = "0|dev" ] \
+ && [ "$r" = "1|" ] && [ "$bfs" = "0|" ]; then
+ ok "update defaults to release (Node-free); --source/--branch/BUILD_FROM_SOURCE opt into on-box rebuild"
+else
+ bad "update mode mapping wrong: default=$d source=$s branch=$b release=$r build_from_source=$bfs"
+fi
+
# --------------------------------------------------------------------------
printf '\n%d passed, %d failed, %d skipped\n\n' "$PASS" "$FAIL" "$SKIP"
[ "$FAIL" -eq 0 ]
diff --git a/scripts/update.sh b/scripts/update.sh
index 666a5abf..4cfe5828 100644
--- a/scripts/update.sh
+++ b/scripts/update.sh
@@ -2,10 +2,17 @@
#
# ServerKit updater — atomic blue/green, pre-flight checked, offline-capable.
#
+# Updates default to a PRE-BUILT release tarball — the frontend is built once in
+# CI and shipped, so the server needs no Node/npm and no on-box SPA build (that's
+# what makes updates work uniformly on old distros, ARM/Pi, and tiny boxes). Opt
+# into an on-box source rebuild with --source / --branch / BUILD_FROM_SOURCE=1
+# (that path needs a compatible Node — see install.sh's node floor).
+#
# Usage:
-# bash /opt/serverkit/scripts/update.sh
+# bash /opt/serverkit/scripts/update.sh # pre-built release (default, Node-free)
# bash /opt/serverkit/scripts/update.sh --dry-run
-# bash /opt/serverkit/scripts/update.sh --branch dev
+# bash /opt/serverkit/scripts/update.sh --source # rebuild from main on this box (needs Node)
+# bash /opt/serverkit/scripts/update.sh --branch dev # rebuild from a branch on this box (needs Node)
# bash /opt/serverkit/scripts/update.sh --release [v1.7.0]
# SERVERKIT_OFFLINE_TARBALL=/tmp/serverkit-v1.7.0-linux-amd64.tar.gz bash /opt/serverkit/scripts/update.sh
#
@@ -19,7 +26,10 @@ set -Eeuo pipefail
DRY_RUN=0
FORCE_UPDATE=0
TARGET_BRANCH=""
-USE_RELEASE="${INSTALL_FROM_RELEASE:-0}"
+# Default to a pre-built release update (Node-free). --source / --branch /
+# BUILD_FROM_SOURCE=1 opt into an on-box source rebuild instead.
+USE_RELEASE="${INSTALL_FROM_RELEASE:-1}"
+[ "${BUILD_FROM_SOURCE:-0}" = "1" ] && USE_RELEASE=0
RELEASE_VERSION="${SERVERKIT_VERSION:-}"
# Captured before parsing so the self-update re-exec can forward them verbatim.
@@ -35,8 +45,16 @@ while [[ $# -gt 0 ]]; do
FORCE_UPDATE=1
shift
;;
+ --source|--main)
+ # Rebuild from the main branch on this box (needs a compatible Node).
+ USE_RELEASE=0
+ TARGET_BRANCH=""
+ shift
+ ;;
--branch|-b)
+ # A branch update is an on-box source rebuild — override the release default.
TARGET_BRANCH="$2"
+ USE_RELEASE=0
shift 2
;;
--release|-r)
@@ -55,8 +73,9 @@ Usage: update.sh [OPTIONS]
Options:
--dry-run, -n Show what would happen without making changes
--force, -f Skip version comparison and update anyway
- --branch <name>, -b Update from a git branch instead of main
- --release [version], -r Update from a release tarball
+ --release [version], -r Update from a pre-built release tarball (DEFAULT; Node-free)
+ --source, --main Rebuild from the main branch on this box (needs Node)
+ --branch <name>, -b Rebuild from a git branch on this box (needs Node)
--help, -h Show this help message
Environment: