Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit f4b64ae3494e9faff147bcfc3047a3974ade25af
parent fdb3b7cec967f0dfc65d0b9b29a5197d3d3f5200
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 16 Oct 2026 18:29:09 -0400

docker: the umtool image runs ImageMagick's open policy — Debian's forbids pango:@file (every text card) and caps memory at 256 MiB; the build draws a card from a markup file to prove it. ARCHILYZER_OLLAMA_TAG (the docker set is ARCHILYZER_*); service reads the login name from the OS, not $USER

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
M.env.example | 4++--
MDockerfile | 14+++++++++++++-
MENVIRONMENT.md | 2+-
Mcommon/bin/service.test.ts | 3++-
Mcommon/bin/service.ts | 5++++-
Mcommon/lib/envVars.ts | 2+-
Mdocker-compose.yml | 2+-
Mplans/FACTS.md | 2+-
8 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/.env.example b/.env.example @@ -170,9 +170,9 @@ # Local models, the Claude API, browser cookies # --------------------------------------------------------------------------- # The digest lanes and generation routed to "local" ask an ollama. Default: the -# `ollama` service (`--profile ollama`), pinned by OLLAMA_TAG. A host's own: +# `ollama` service (`--profile ollama`), pinned by ARCHILYZER_OLLAMA_TAG. A host's own: #OLLAMA_URL=http://host.docker.internal:11434 -#OLLAMA_TAG=0.40.5 +#ARCHILYZER_OLLAMA_TAG=0.40.5 # # The Claude API key file the anthropic overlay mounts (docker-compose.anthropic.yml; # `archilyzer service install` adds it when the file exists). Never put the key diff --git a/Dockerfile b/Dockerfile @@ -517,10 +517,22 @@ RUN apt-get update \ imagemagick libmagickcore-7.q16-10-extra librsvg2-bin qrencode zbar-tools \ chromium fontconfig fonts-dejavu-core fonts-noto-color-emoji \ && rm -rf /var/lib/apt/lists/* -# Fail the build, not the first render, when the Pango coder is missing. +# Debian's ImageMagick security policy forbids reading a file through `@` +# (`pango:@card.pango`, which is how every text card is drawn — measured: "not +# allowed by the security policy") and caps memory at 256 MiB. The renderer +# feeds ImageMagick only files it wrote itself, so the image runs ImageMagick's +# own open policy: no rules. +RUN for f in /etc/ImageMagick-7/policy.xml /etc/ImageMagick-6/policy.xml; do \ + [ -f "$f" ] && printf '<policymap>\n <!-- the umtool image: renders its own files only; see the Dockerfile -->\n</policymap>\n' > "$f"; \ + done; true +# Fail the build, not the first render, when the Pango coder is missing or a +# card cannot be drawn from its markup file. RUN set -eux; \ magick -version | head -n 1; \ magick -list format | grep -qi 'pango' || { echo "FATAL: ImageMagick has no Pango coder" >&2; exit 1; }; \ + printf '<span font="DejaVu Sans 40">ok</span>' > /tmp/card.pango; \ + magick -background none -size 400x pango:@/tmp/card.pango /tmp/card.png; \ + rm -f /tmp/card.pango /tmp/card.png; \ rsvg-convert --version; qrencode --version 2>&1 | head -n 1; zbarimg --version; \ chromium --version # The hyperframes CLI, PINNED to the version deck.mjs names diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md @@ -188,7 +188,7 @@ The container's own set, read by `docker/*.sh`, the compose files and Caddy — | `ARCHILYZER_TAG` | `local` | The image tag the compose files build and run. | docker-compose*.yml | | `ARCHILYZER_ANTHROPIC_ENV_FILE` | `~/.config/archilyzer/anthropic.env` | The host's Claude API key file (one line `ANTHROPIC_API_KEY=…`, mode 600), bind-mounted read-only into the editor and umtool by the anthropic overlay; `archilyzer service install` adds that overlay when the file exists (it never opens it). | docker-compose.anthropic.yml, common/bin/service.ts | | `ARCHILYZER_FIREFOX_PROFILES` | `~/.mozilla/firefox` | The host's Firefox profiles directory, mounted read-only at `/data/browser/firefox` by the browser overlay, for `cookiesFromBrowser = firefox:/data/browser/firefox`. | docker-compose.browser.yml | -| `OLLAMA_TAG` | `0.40.5` | The `ollama/ollama` image tag the `ollama` profile runs. | docker-compose.yml | +| `ARCHILYZER_OLLAMA_TAG` | `0.40.5` | The `ollama/ollama` image tag the `ollama` profile runs. | docker-compose.yml | ## Tests only diff --git a/common/bin/service.test.ts b/common/bin/service.test.ts @@ -49,7 +49,7 @@ function rig(opts: { docker?: boolean; platform?: NodeJS.Platform } = {}): Rig { const settingsFile = path.join(root, "settings.json"); fs.writeFileSync(settingsFile, JSON.stringify({ autoQueue: { transcription: { held: true, enabled: true } } })); const deps: ServiceDeps = { - env: { PATH: `${bin}:${sys}`, HOME: path.join(root, "home"), XDG_CONFIG_HOME: path.join(root, "config"), USER: "someone", FAKE_LOG: logFile }, + env: { PATH: `${bin}:${sys}`, HOME: path.join(root, "home"), XDG_CONFIG_HOME: path.join(root, "config"), FAKE_LOG: logFile }, out: { log: (s) => lines.push(s), error: (s) => errors.push(s) }, platform: opts.platform ?? "linux", repoRoot: repo, @@ -57,6 +57,7 @@ function rig(opts: { docker?: boolean; platform?: NodeJS.Platform } = {}): Rig { exportBuildsDir: path.join(repo, "export", ".export-builds"), memTotalBytes: 16283088 * 1024, nodeBin: "/usr/bin/node", + user: "someone", probe: async () => "200", }; return { diff --git a/common/bin/service.ts b/common/bin/service.ts @@ -72,6 +72,8 @@ export type ServiceDeps = { exportBuildsDir: string; memTotalBytes: number; nodeBin: string; + // The login name linger is about. + user: string; // A probe of http://127.0.0.1:<port>/ — the status code, or a word. probe: (url: string) => Promise<string>; }; @@ -88,6 +90,7 @@ export async function defaultDeps(): Promise<ServiceDeps> { exportBuildsDir: p.exportBuildsDir, memTotalBytes: os.totalmem(), nodeBin: process.execPath, + user: os.userInfo().username, probe: async (url) => { try { const res = await fetch(url, { redirect: "manual", signal: AbortSignal.timeout(3000) }); @@ -315,7 +318,7 @@ export async function install(opts: ServiceOptions, deps: ServiceDeps): Promise< const cmds: string[][] = []; if (toWrite.length) cmds.push([systemctl, "--user", "daemon-reload"]); cmds.push([systemctl, "--user", "enable", ...(opts.noStart ? [] : ["--now"]), ...names]); - const user = env.USER || os.userInfo().username; + const user = deps.user; if (opts.linger) cmds.push(["loginctl", "enable-linger", user]); if (opts.dryRun) { diff --git a/common/lib/envVars.ts b/common/lib/envVars.ts @@ -190,7 +190,7 @@ const DECLARED: EnvVarDecl[] = [ { name: "ARCHILYZER_TAG", audience: "docker", default: "`local`", readBy: "docker-compose*.yml", doc: "The image tag the compose files build and run." }, { name: "ARCHILYZER_ANTHROPIC_ENV_FILE", audience: "docker", default: "`~/.config/archilyzer/anthropic.env`", readBy: "docker-compose.anthropic.yml, common/bin/service.ts", doc: "The host's Claude API key file (one line `ANTHROPIC_API_KEY=…`, mode 600), bind-mounted read-only into the editor and umtool by the anthropic overlay; `archilyzer service install` adds that overlay when the file exists (it never opens it)." }, { name: "ARCHILYZER_FIREFOX_PROFILES", audience: "docker", default: "`~/.mozilla/firefox`", readBy: "docker-compose.browser.yml", doc: "The host's Firefox profiles directory, mounted read-only at `/data/browser/firefox` by the browser overlay, for `cookiesFromBrowser = firefox:/data/browser/firefox`." }, - { name: "OLLAMA_TAG", audience: "docker", default: "`0.40.5`", readBy: "docker-compose.yml", doc: "The `ollama/ollama` image tag the `ollama` profile runs." }, + { name: "ARCHILYZER_OLLAMA_TAG", audience: "docker", default: "`0.40.5`", readBy: "docker-compose.yml", doc: "The `ollama/ollama` image tag the `ollama` profile runs." }, // ── test: harnesses, fakes and test-mode branches ────────────────────── { name: "E2E_TEST_ROUTES", audience: "test", default: "off", readBy: "editor/app/api/test/_guard.ts, editor/instrumentation.ts", doc: "`1` opens the editor's `/api/test/*` routes and marks a test server at boot. Set by `editor/playwright.config.ts` on its test server, and by nothing else." }, diff --git a/docker-compose.yml b/docker-compose.yml @@ -233,7 +233,7 @@ services: # GPU: the vulkan and gpu overlays give it the same device as the editor. # ------------------------------------------------------------------------- ollama: - image: ollama/ollama:${OLLAMA_TAG:-0.40.5} + image: ollama/ollama:${ARCHILYZER_OLLAMA_TAG:-0.40.5} profiles: [ollama] restart: unless-stopped networks: [archilyzer] diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -9979,7 +9979,7 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri `REPORTS_DIR=/data/reports`, and three state links into volumes: `~/.local/share/archilyzer/tts` → `/data/models/tts`, `/repo/.tts` → `/data/builds/tts`, `/repo/.generation` → `/data/config/generation` (the daily caps' ledger survives a recreate). `buildImage.test.ts` holds the gallery-dl and hyperframes pins. -- **Compose:** volumes `reports`, `ollama`; `ollama` service (profile `ollama`, `ollama/ollama:${OLLAMA_TAG:-0.40.5}`, +- **Compose:** volumes `reports`, `ollama`; `ollama` service (profile `ollama`, `ollama/ollama:${ARCHILYZER_OLLAMA_TAG:-0.40.5}`, internal); `OLLAMA_URL` defaults to `http://ollama:11434`; `ARCHILYZER_EDITOR_URL=http://editor:3001`; `host.docker.internal:host-gateway` on editor and umtool. Overlays: `docker-compose.anthropic.yml` (the key file bind-mounted read-only at `/root/.config/archilyzer/anthropic.env`, `create_host_path: false` — never env, so