Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Workers: install and update only from a verified release tag

Adarshb43a9ed51dbf
diff --git a/docs/admin-api.md b/docs/admin-api.md
index 29aa2dd3..f34c6760 100644
--- a/docs/admin-api.md
+++ b/docs/admin-api.md
@@ -43,7 +43,7 @@ Keep the token out of URLs, logs and shared files. Send it only in the `Authoriz
| `outputs:hide` | `POST /api/admin/outputs/hide` |
| `outputs:moderate` | `POST /api/admin/outputs/hide`, `/unhide` and `/remove` |
| `reports:read` | `GET /api/admin/reports` (reporters' emails included) |
-| `workers:read` | `GET /api/admin/workers`, `GET /api/admin/workers/download` |
+| `workers:read` | `GET /api/admin/workers` |
| `workers:write` | `PATCH /api/admin/workers/{id}`: pause, resume, drain, hours, lanes, revoke |
| `workers:tokens` | `POST /api/admin/workers`, and `PATCH /api/admin/workers/{id}` with `rotate`: both answer with a worker token. A worker receives accounts' queued jobs with their input files and sends back the results, so give this scope only to a tool you'd trust with those |
| `queue:read` | `GET /api/admin/queue` |
@@ -109,7 +109,6 @@ Times are epoch milliseconds and sizes are bytes. Every answer is `Cache-Control
| `GET /api/admin/workers` | | `{ workers, lanes }` |
| `POST /api/admin/workers` | `{ name, pool? }` | 201 `{ id, token }`: the worker's token, once |
| `PATCH /api/admin/workers/{id}` | any of `paused`, `pauseNow`, `drain`, `autoResume`, `hours`, `allow`, `claimAfterMs`, `switchAfterMs`, `rotate` (needs `workers:tokens`), `revoke` | `{ worker, token? }`: a new worker token after `rotate`, once |
-| `GET /api/admin/workers/download` | | the worker program, `fuobe-worker.zip` |
| `GET /api/admin/audit` | `before` (the last page's `next`), `limit` (1 to 200, default 50), `actor` (`owner` or `token`), `token` (a token id), `action`, `changes=1` (changes only: no reads, file views or refusals) | `{ items, next }` |
| `GET /api/admin/tokens/self` | | `{ id, name, prefix, scopes, expiresAt, createdAt }` |
diff --git a/docs/gpu-workers.md b/docs/gpu-workers.md
index f7cbedd6..7c8098a3 100644
--- a/docs/gpu-workers.md
+++ b/docs/gpu-workers.md
@@ -44,8 +44,9 @@ or press Disconnect in ComfyUI (`POST /api/gpu/computer/unpair`). A disconnected
1. In **Settings → Workers**, press **Add a worker** and give it a name. The page shows the worker's token only once.
The worker starts paused, with no hours and no lanes.
-2. On the GPU's PC, you need Node 22 or later and a Fuobe checkout (or a copy of `bin/`, `package.json` and
- `workflows/comfyui/requirements.json`). Run `node scripts/build-worker.mjs`, then run `node bin/fuobe.mjs worker setup`.
+2. On the GPU's PC, you need Node 22 or later and git. Install the worker from a git checkout of Fuobe at a release tag
+ that you have verified (see "Install and update"). Run `node scripts/build-worker.mjs`, then run
+ `node bin/fuobe.mjs worker setup`.
Setup asks for the studio's address, the token (as hidden input), ComfyUI's folder, the model folders, a worker
folder and a port for the worker's own ComfyUI (default 8190). It refuses these:
- a folder that a cloud drive syncs;
@@ -62,6 +63,21 @@ or press Disconnect in ComfyUI (`POST /api/gpu/computer/unpair`). A disconnected
On a machine with no keyboard, set `FUOBE_WORKER_TOKEN` and `FUOBE_WORKER_SITE` so that the token stays out of files.
+### Install and update
+
+The worker runs other people's jobs on your PC, so install it only from code that you can check. The studio does not
+offer the worker as a download. Use a git checkout at a signed release tag:
+
+1. Clone the repository once: `git clone https://github.com/workingprototype/Fuobe.git`.
+2. Fetch the tags: `git fetch --tags`.
+3. Verify the tag that you want: `git verify-tag <tag>`. Go on only when git says that the signature is good and the
+ key is one that you trust.
+4. Check it out: `git checkout <tag>`.
+5. Build the worker's parts: `node scripts/build-worker.mjs`.
+
+To update, stop the worker, do steps 2 to 5 with the new tag, and start the worker again. Do not install the worker
+from a zip file, from a copy that someone sends you, or from a branch.
+
### The worker's own ComfyUI
The worker always starts and stops its own ComfyUI process. It never uses a ComfyUI that it did not start. Its ComfyUI:
diff --git a/src/app/api/admin/workers/download/route.ts b/src/app/api/admin/workers/download/route.ts
deleted file mode 100644
index 09d3efd8..00000000
--- a/src/app/api/admin/workers/download/route.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { connection } from "next/server";
-import { adminAccess } from "@/server/admin-tokens";
-import fs from "node:fs";
-import path from "node:path";
-
-/**
- * Download the worker program as a zip, so its version always matches the server's (docs/gpu-workers.md).
- * The zip contains bin/ with the fuobe.mjs entry point, bin/lib/commands.mjs, bin/lib/worker/ and the
- * package.json that names the dependencies (`better-sqlite3` is not needed on the worker; the runner
- * is bundled). Owner only, or an admin token with workers:read.
- */
-export async function GET(request: Request) {
- await connection();
- const access = adminAccess(request, "workers:read", "Only the studio's owner manages workers");
- if (access instanceof Response) return access;
-
- // Dynamic import so the zip helper is loaded only for this route.
- const { zipFiles } = await import("../../../../../../bin/lib/zip.mjs");
-
- const root = process.cwd();
- const files: { name: string; data: Buffer }[] = [];
-
- const add = (rel: string) => {
- const abs = path.join(root, rel);
- if (fs.existsSync(abs)) files.push({ name: rel, data: fs.readFileSync(abs) });
- };
-
- // The worker's entry point and its commands dispatcher.
- add("bin/fuobe.mjs");
- add("bin/lib/commands.mjs");
-
- // bin/lib/worker/ — the worker shell and the transpiled runner.
- const workerDir = path.join(root, "bin/lib/worker");
- if (fs.existsSync(workerDir)) {
- const walk = (dir: string, prefix: string) => {
- for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
- if (entry.isSymbolicLink()) continue;
- const rel = `${prefix}/${entry.name}`;
- if (entry.isDirectory()) walk(path.join(dir, entry.name), rel);
- else files.push({ name: rel, data: fs.readFileSync(path.join(dir, entry.name)) });
- }
- };
- walk(workerDir, "bin/lib/worker");
- }
-
- // A minimal package.json for the worker (no dev deps, no Next.js).
- files.push({
- name: "package.json",
- data: Buffer.from(JSON.stringify({ name: "fuobe-worker", private: true, type: "module" }, null, 2)),
- });
-
- const buf = zipFiles(files);
- return new Response(buf, {
- headers: {
- "Content-Type": "application/zip",
- "Content-Disposition": 'attachment; filename="fuobe-worker.zip"',
- "Content-Length": String(buf.length),
- "Cache-Control": "no-store",
- },
- });
-}
diff --git a/tests/admin-tokens.test.ts b/tests/admin-tokens.test.ts
index a491a57e..95744690 100644
--- a/tests/admin-tokens.test.ts
+++ b/tests/admin-tokens.test.ts
@@ -31,7 +31,6 @@ const routes = {
queue: await import("@/app/api/admin/queue/route"),
workers: await import("@/app/api/admin/workers/route"),
worker: await import("@/app/api/admin/workers/[id]/route"),
- download: await import("@/app/api/admin/workers/download/route"),
reports: await import("@/app/api/admin/reports/route"),
audit: await import("@/app/api/admin/audit/route"),
files: await import("@/app/api/admin/files/[...path]/route"),
@@ -247,7 +246,6 @@ describe("admin tokens: every admin route asks for its scope", () => {
{ name: "GET files", scope: "outputs:view", run: (o) => routes.files.GET(req("/api/admin/files/outputs/nope.png", o), ctx({ path: ["outputs", "nope.png"] })) },
{ name: "GET queue", scope: "queue:read", run: (o) => routes.queue.GET(req("/api/admin/queue", o)) },
{ name: "GET workers", scope: "workers:read", run: (o) => routes.workers.GET(req("/api/admin/workers", o)) },
- { name: "GET download", scope: "workers:read", run: (o) => routes.download.GET(req("/api/admin/workers/download", o)) },
{ name: "POST workers", scope: "workers:tokens", run: (o) => routes.workers.POST(req("/api/admin/workers", { ...o, method: "POST", body: { name: `w${++n}` } })) },
{ name: "PATCH worker", scope: "workers:write", run: (o) => routes.worker.PATCH(req("/api/admin/workers/nope", { ...o, method: "PATCH", body: { paused: true } }), ctx({ id: "nope" })) },
{ name: "PATCH worker rotate", scope: "workers:tokens", run: (o) => routes.worker.PATCH(req("/api/admin/workers/nope", { ...o, method: "PATCH", body: { rotate: true } }), ctx({ id: "nope" })) },
@@ -525,7 +523,7 @@ describe("admin tokens: runs, the log's changes and every admin route", () => {
}
};
walk(root);
- expect(found.length).toBeGreaterThanOrEqual(14);
+ expect(found.length).toBeGreaterThanOrEqual(13);
for (const f of found) {
const src = fs.readFileSync(f, "utf8");
const handlers = src.match(/export async function (GET|POST|PUT|PATCH|DELETE)\b/g) ?? [];