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.

fix(ui): make the agent install one-liner fail loudly

Juan Denis58223a6b04b9
diff --git a/frontend/src/components/serverdetail/ServerSettingsTab.jsx b/frontend/src/components/serverdetail/ServerSettingsTab.jsx
index 10f31c0f..35aa82eb 100644
--- a/frontend/src/components/serverdetail/ServerSettingsTab.jsx
+++ b/frontend/src/components/serverdetail/ServerSettingsTab.jsx
@@ -400,7 +400,11 @@ export const TokenModal = ({ server, onClose, onGenerated }) => {
toast.success('Copied to clipboard');
}
- const linuxScript = result ? `curl -fsSL ${window.location.origin}/api/v1/servers/install.sh | sudo bash -s -- \\
+ // Download-then-run, not `curl … | sudo bash`: a piped curl failure is
+ // invisible (the pipeline reports bash's exit status, so a 404 still exits
+ // 0 with nothing installed). See issue #101.
+ const linuxScript = result ? `curl -fsSL ${window.location.origin}/api/v1/servers/install.sh -o /tmp/serverkit-agent-install.sh && \\
+ sudo bash /tmp/serverkit-agent-install.sh \\
--server "${window.location.origin}" \\
--token "${result.registration_token}"` : '';
const windowsScript = result ? `irm ${window.location.origin}/api/v1/servers/install.ps1 | iex
diff --git a/frontend/src/pages/Downloads.jsx b/frontend/src/pages/Downloads.jsx
index 3b716ec7..8e366444 100644
--- a/frontend/src/pages/Downloads.jsx
+++ b/frontend/src/pages/Downloads.jsx
@@ -109,7 +109,9 @@ function Downloads() {
icon: LinuxIcon,
os: 'linux',
archKey: 'amd64',
- command: `curl -fsSL ${getBaseUrl()}/api/v1/servers/install.sh | sudo bash -s -- --token "YOUR_TOKEN" --server "${getBaseUrl()}"`,
+ // Download-then-run: `curl … | sudo bash` reports bash's exit status,
+ // so a failed download exits 0 and installs nothing silently (#101).
+ command: `curl -fsSL ${getBaseUrl()}/api/v1/servers/install.sh -o /tmp/serverkit-agent-install.sh && sudo bash /tmp/serverkit-agent-install.sh --token "YOUR_TOKEN" --server "${getBaseUrl()}"`,
},
{
id: 'linux-arm64',
@@ -118,7 +120,7 @@ function Downloads() {
icon: LinuxIcon,
os: 'linux',
archKey: 'arm64',
- command: `curl -fsSL ${getBaseUrl()}/api/v1/servers/install.sh | sudo bash -s -- --token "YOUR_TOKEN" --server "${getBaseUrl()}"`,
+ command: `curl -fsSL ${getBaseUrl()}/api/v1/servers/install.sh -o /tmp/serverkit-agent-install.sh && sudo bash /tmp/serverkit-agent-install.sh --token "YOUR_TOKEN" --server "${getBaseUrl()}"`,
},
{
id: 'windows-amd64',
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index 70e7b68a..f041628a 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -761,7 +761,13 @@ const AddServerModal = ({ groups, onClose, onCreated }) => {
}
const connectionString = registrationData?.connection_string || '';
- const linuxInstallScript = registrationData ? `curl -fsSL ${window.location.origin}/api/v1/servers/install.sh | sudo bash -s -- \\
+ // Download, then run — deliberately not `curl … | sudo bash`. In a pipe the
+ // shell reports bash's status, not curl's, so a failed download exits 0:
+ // the operator sees one line of curl noise, the shell says success, and
+ // nothing was installed. The `&&` makes a failed fetch stop the command and
+ // surface curl's non-zero exit (issue #101).
+ const linuxInstallScript = registrationData ? `curl -fsSL ${window.location.origin}/api/v1/servers/install.sh -o /tmp/serverkit-agent-install.sh && \\
+ sudo bash /tmp/serverkit-agent-install.sh \\
--server "${window.location.origin}" \\
--token "${registrationData.registration_token}"` : '';