Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(vps): a missing Docker CLI names the line that installs it

AndersHsuehbabff9fcc336
diff --git a/apps/docs/content/docs/computers/cloud-and-vps.mdx b/apps/docs/content/docs/computers/cloud-and-vps.mdx
index 9e8cf5344f..f07f06ba7e 100644
--- a/apps/docs/content/docs/computers/cloud-and-vps.mdx
+++ b/apps/docs/content/docs/computers/cloud-and-vps.mdx
@@ -60,6 +60,16 @@ ssh my-vps true
docker -H ssh://my-vps info
```
+Install the Docker client on your own computer; the daemon stays on the VPS:
+
+```bash
+brew install docker # macOS
+winget install -e --id Docker.DockerCLI # Windows 10 or 11
+sudo apt install docker-ce-cli # Debian or Ubuntu, Docker's apt repository
+```
+
+Windows 10 1809 and later include the OpenSSH client this needs. Podman cannot replace the Docker CLI here: the VPS backend runs `docker -H ssh://<alias>` itself.
+
The SSH user needs Docker access, which is root-equivalent on that server. Use a dedicated VPS and firewall inbound traffic to SSH only.
The managed container publishes no ports, has no host mounts, and is checked before every attach. Its filesystem should be treated as disposable; move important results out before deleting or upgrading the container.
diff --git a/docs/byo-vps.md b/docs/byo-vps.md
index 0c1d3e9b08..08f665cf38 100644
--- a/docs/byo-vps.md
+++ b/docs/byo-vps.md
@@ -23,7 +23,8 @@ passphrase, and never runs an agent remotely.
## Prerequisites
- **Locally:** a `docker` CLI, version 18.09 or newer (that is when `docker -H ssh://` shipped). The Docker
- daemon does not need to run locally — only the CLI is used.
+ daemon does not need to run locally — only the CLI is used; install it with the one line for your platform
+ below.
- **On the VPS:** a running Docker daemon (`dockerd`) on x86_64 Linux.
- **The SSH user** must be in the `docker` group on the VPS, so `docker info` works without sudo.
@@ -32,6 +33,20 @@ Anyone who can talk to the daemon can mount the host filesystem into a container
trusting the VPS — and whoever else can reach its Docker daemon — completely. Give bots a dedicated server,
not one that also holds things you would not hand to the agent.
+## Install the Docker client
+
+Only the client belongs on your own computer; the daemon stays on the VPS. One line per platform:
+
+```sh
+brew install docker # macOS
+winget install -e --id Docker.DockerCLI # Windows 10 or 11
+sudo apt install docker-ce-cli # Debian or Ubuntu, Docker's apt repository
+```
+
+Windows also needs its OpenSSH client (`ssh.exe`, included since Windows 10 1809), because Docker's SSH
+transport runs it. Podman cannot replace the Docker CLI here: this backend only ever runs
+`docker -H ssh://<alias>`.
+
## The required SSH config alias
OpenMausBot connects only through a named alias in your `~/.ssh/config` — you type the alias into
diff --git a/server/vps-computer.runner.test.ts b/server/vps-computer.runner.test.ts
index bf84c296df..f7525a35d9 100644
--- a/server/vps-computer.runner.test.ts
+++ b/server/vps-computer.runner.test.ts
@@ -14,7 +14,7 @@ vi.mock("./procs.ts", async () => ({
killCliTree: stopMock,
}));
-import { defaultRunner } from "./vps-computer.ts";
+import { defaultRunner, dockerCliInstallCommand } from "./vps-computer.ts";
import { resolveCliSpawn } from "./env-path.ts";
type FakeChild = EventEmitter & {
@@ -94,6 +94,15 @@ describe("default VPS command runner", () => {
expect(child.stdout.destroyed && child.stderr.destroyed).toBe(true);
});
+ it("names the Docker CLI install line when the CLI is absent", async () => {
+ const child = fakeChild();
+ const result = defaultRunner(["info"]);
+ child.emit("error", Object.assign(new Error("spawn docker ENOENT"), { code: "ENOENT" }));
+ const message = await result.catch((error: Error) => error.message);
+ expect(message).toContain("Docker-over-SSH could not start: spawn docker ENOENT");
+ expect(message).toContain(dockerCliInstallCommand(process.platform)!);
+ });
+
it.skipIf(process.platform === "win32").each(["timeout", "stdin"])("reaps real SSH-like grandchildren after %s without stopping an unrelated master", async (failure) => {
const { spawn: realSpawn } = await vi.importActual<typeof import("node:child_process")>("node:child_process");
const { killCliTree: realStop } = await vi.importActual<typeof import("./procs.ts")>("./procs.ts");
diff --git a/server/vps-computer.test.ts b/server/vps-computer.test.ts
index daaeeec0e9..f6082c20fe 100644
--- a/server/vps-computer.test.ts
+++ b/server/vps-computer.test.ts
@@ -50,6 +50,8 @@ import {
vpsUnavailableHint,
inspectVpsForAuto,
reuseVps,
+ dockerCliInstallCommand,
+ listManagedVpsComputers,
type VpsCommandRunner,
} from "./vps-computer.ts";
@@ -1255,3 +1257,28 @@ describe("remote desktop tunnel ownership", () => {
} finally { closeAllVpsDesktopTunnels(); vi.useRealTimers(); }
});
});
+
+describe("a missing Docker CLI", () => {
+ it("gives every platform it ships one install line", () => {
+ expect(dockerCliInstallCommand("darwin")).toBe("brew install docker");
+ expect(dockerCliInstallCommand("win32")).toBe("winget install -e --id Docker.DockerCLI");
+ expect(dockerCliInstallCommand("linux")).toBe("sudo apt install docker-ce-cli");
+ expect(dockerCliInstallCommand("freebsd")).toBeNull();
+ });
+
+ it("names that install line instead of the spawn error, for the inventory and the status", async () => {
+ const missing = Object.assign(new Error("Docker-over-SSH could not start: spawn docker ENOENT"), { code: "ENOENT" });
+ const runner: VpsCommandRunner = async () => {
+ throw missing;
+ };
+ const command = dockerCliInstallCommand(process.platform)!;
+ const inventory = await listManagedVpsComputers(CONFIG, [], runner);
+ expect(inventory.available).toBe(false);
+ expect(inventory.problem).toContain(command);
+ expect(inventory.problem).not.toMatch(/ENOENT/);
+
+ const status = await vpsComputerStatus(CONFIG, BOT_ID, runner);
+ expect(status.problem).toContain(command);
+ expect(status.problem).not.toMatch(/ENOENT/);
+ });
+});
diff --git a/server/vps-computer.ts b/server/vps-computer.ts
index c3fc60a697..ea1631f393 100644
--- a/server/vps-computer.ts
+++ b/server/vps-computer.ts
@@ -28,6 +28,7 @@ import { killCliTree, spawnCli } from "./procs.ts";
import { prepareVpsSsh } from "./vps-ssh.ts";
import { loadEnvironmentId } from "./environment.ts";
import { SPAWNED_PROXIES } from "./proxy-paths.ts";
+import { dockerCliMissing, dockerCliMissingProblem, dockerCliStartMessage } from "./vps-hints.ts";
export const VPS_IMAGE = CUA_IMAGE;
export const VPS_MANAGED_LABEL = "com.openmausbot.vps";
@@ -35,6 +36,7 @@ export const VPS_CONTAINER_LABEL = "com.openmausbot.container";
export const VPS_ENVIRONMENT_LABEL = "com.openmausbot.environment";
export const VPS_VIEWER_LABEL = "com.openmausbot.vps-viewer";
export const VPS_CONTAINER_PREFIX = "openmausbot-vps";
+export { dockerCliInstallCommand, vpsStartsForTurn, vpsUnavailableHint } from "./vps-hints.ts";
// Lazy: index must finish data migration and take the writer lease before this may create the data directory.
let vpsEnvironmentIdCache: string | null = null;
function vpsEnvironmentId(): string {
@@ -109,18 +111,6 @@ export type VpsCommandRunner = (
export type VpsLifecycleAction = "provision" | "start" | "stop" | "remove";
-export function vpsStartsForTurn(input: { wants: "cloud" | "vm" | "local" | "off" | undefined; autoStartVps?: boolean; automationSource?: string }): boolean {
- if (input.wants === "cloud") return true;
- if (input.wants !== undefined) return false;
- return input.autoStartVps === true || Boolean(input.automationSource);
-}
-
-export function vpsUnavailableHint(input: { automationSource?: string; autoStartVps?: boolean; reachable?: boolean }): string {
- if (input.automationSource) return "This scheduled run tried to start the VPS computer and could not reach it. Check the VPS connection in Settings → API keys.";
- if (input.autoStartVps || input.reachable === false) return "Check the VPS connection in Settings → API keys.";
- return input.reachable ? "Open Computer and enable Start VPS automatically, or choose Cloud computer to start it manually." : "";
-}
-
export interface VpsComputerStatus {
configured: boolean;
sshAlias: string | null;
@@ -363,8 +353,8 @@ export function defaultRunner(args: string[], options: VpsCommandOptions = {}):
child.stdin.on("error", (error) => {
fail(new Error(`Docker-over-SSH stdin failed: ${error.message}`));
});
- child.on("error", (error) => {
- fail(new Error(`Docker-over-SSH could not start: ${error.message}`));
+ child.on("error", (error: Error) => {
+ fail(new Error(dockerCliStartMessage(error)));
});
child.on("close", (code, signal) => {
if (failure) return;
@@ -413,6 +403,7 @@ function isMissingObjectMessage(message: string): boolean {
}
function transportFailure(message: string): string {
+ if (dockerCliMissing(message)) return dockerCliMissingProblem();
if (/timed out/i.test(message)) {
return "Docker over SSH failed while checking the VPS: the connection timed out. Check that the VPS is online, SSH is reachable from this computer, and Docker is running on the VPS, then retry. No computer was reset.";
}
@@ -684,6 +675,7 @@ const VPS_INVENTORY_STATES = new Set<ManagedVpsInventoryInstance["state"]>([
type ManagedVpsAliasScan = Pick<ManagedVpsInventory, "available" | "problem" | "instances"> & { containerIds: Map<string, string> };
function inventoryFailure(alias: string, error: unknown): ManagedVpsAliasScan {
+ if (dockerCliMissing(error)) return { available: false, problem: `${dockerCliMissingProblem()} (VPS host: ${alias})`, instances: [], containerIds: new Map() };
const detail = (error instanceof Error ? error.message : String(error))
.replace(/[\r\n\t]+/g, " ")
.trim()
diff --git a/server/vps-hints.ts b/server/vps-hints.ts
new file mode 100644
index 0000000000..0039011563
--- /dev/null
+++ b/server/vps-hints.ts
@@ -0,0 +1,42 @@
+// The Docker CLI is the only local piece of the VPS backend — every command is `docker -H ssh://<alias>` and
+// the daemon stays on the server — so a missing client is the one VPS problem a person fixes in a terminal.
+// These are the sentences the bot panel and Settings show while that is the case.
+const DOCKER_CLI_INSTALL: Readonly<Partial<Record<NodeJS.Platform, string>>> = {
+ darwin: "brew install docker",
+ win32: "winget install -e --id Docker.DockerCLI",
+ linux: "sudo apt install docker-ce-cli",
+};
+
+export function dockerCliInstallCommand(platform: NodeJS.Platform = process.platform): string | null {
+ return DOCKER_CLI_INSTALL[platform] ?? null;
+}
+
+/** spawn reports ENOENT for an absent `docker`; every other transport failure keeps its own message. */
+export function dockerCliMissing(error: unknown): boolean {
+ const message = error instanceof Error ? error.message : String(error);
+ return /\bENOENT\b/.test(message) && /docker/i.test(message);
+}
+
+export function dockerCliMissingProblem(): string {
+ const command = dockerCliInstallCommand();
+ return command
+ ? `The Docker CLI is not on PATH. Install the client only: ${command}`
+ : "The Docker CLI is not on PATH. Install the Docker client, then retry.";
+}
+
+/** Lifecycle errors surface the spawn failure raw, so it carries the hint too. */
+export function dockerCliStartMessage(error: Error): string {
+ return `Docker-over-SSH could not start: ${error.message}${dockerCliMissing(error) ? `. ${dockerCliMissingProblem()}` : ""}`;
+}
+
+export function vpsStartsForTurn(input: { wants: "cloud" | "vm" | "local" | "off" | undefined; autoStartVps?: boolean; automationSource?: string }): boolean {
+ if (input.wants === "cloud") return true;
+ if (input.wants !== undefined) return false;
+ return input.autoStartVps === true || Boolean(input.automationSource);
+}
+
+export function vpsUnavailableHint(input: { automationSource?: string; autoStartVps?: boolean; reachable?: boolean }): string {
+ if (input.automationSource) return "This scheduled run tried to start the VPS computer and could not reach it. Check the VPS connection in Settings → API keys.";
+ if (input.autoStartVps || input.reachable === false) return "Check the VPS connection in Settings → API keys.";
+ return input.reachable ? "Open Computer and enable Start VPS automatically, or choose Cloud computer to start it manually." : "";
+}