[nu-demo] Office PDF/Doc viewing blocked — ONLYOFFICE_JWT_SECRET unset + OnlyOffice Document Server not deployed #174
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
After seeding PDFs into hero_foundry webdav root (so
hero_office_server::list_documentslists them — partial fix of home#160), clicking a PDF in the Office archipelago's PDF island returns:Same for .docx, .xlsx, .pptx.
Root cause
hero_office_server/src/lib.rsuses OnlyOffice Document Server as the rendering engine:Two independent gaps:
1. The JWT secret env var is unset
hero_office_serverreadsONLYOFFICE_JWT_SECRETfrom env. Not set byservice_install_allnor pre-populated in the hero_proc action env. Dummy value would unblock the error but doesn't solve (2).2. OnlyOffice Document Server is not running
hero_office generates an
editor_urlpointing at an OnlyOffice instance that is supposed to render the doc in an iframe. On herodemo there is no such instance:onlyoffice/documentserverDocker containerThe entire Office viewing flow depends on an external Document Server that the nu-shell stack doesn't ship.
Options
A. Ship OnlyOffice Document Server on the VM
The canonical path. OnlyOffice is distributed as a Docker container (~3 GB image, needs ~6 GB RAM at runtime, plus PostgreSQL + Redis). Would need:
docker+docker-composeon the VM (or podman)onlyoffice/documentserverONLYOFFICE_JWT_SECRETon both sides (hero_office + OnlyOffice container)/onlyoffice/...)Not trivial. Adds another moving part. Right answer for prod.
B. Swap in a simpler PDF viewer for the demo
hero_books already has a PDF viewer (
/book/<name>/pdf/viewer) that uses HTML5 PDF.js — no OnlyOffice needed. Demo could:This is what hero.gent04.grid.tf shows — PDFs render in-browser via PDF.js, not OnlyOffice. Check how the hero_zero Docker build wired it.
C. Allow downloading only, no in-browser viewer
Simplest. Click PDF → browser downloads it → user opens locally. Document the limitation. Defers (A) until Docker support is worth adding.
Demo workaround (herodemo 2026-04-24)
None — PDFs listed but not viewable. Filing this + leaving demo in 'PDFs visible but not clickable to view' state. User can see them in the Files island (via webdav directly), where the browser-native PDF viewer handles them.
Related
Signed-off-by: mik-tf
Demo hotfix applied 2026-04-24
hero_office_ui::editor_pagepatched with a browser-native PDF short-circuit:.pdfreturns an HTML page with<embed type="application/pdf">pointing at/files/{ctx}/{name}?inline=1. proxy_file gained aninline=1query that switchesContent-Dispositionfromattachmenttoinline. Browser native viewer renders..docx/.xlsx/.pptx: list_documents is queried for a sibling.pdfwith the same stem. If found, the iframe renders that PDF with a small badge "PDF preview of ". Otherwise falls through to OnlyOffice (still broken).google-chrome-stable --headless --print-to-pdf). Distributed to geomind, incubaid, threefold, default, root contexts.Verified: Presentations / Spreadsheets / Documents / PDF islands now show files; clicking renders inline.
Prod-level fix needed
The companion-PDF trick works for read-only demo viewing but not for editing.
/onlyoffice/.... Adds 3 GB image + ~6 GB runtime RAM. The proper path for full Office editing.libreoffice --headless --convert-to pdf(orpandocfor simple md-derived docs) to produce a synced.pdffor browser-native preview. Cache invalidated on file modification.HERO_OFFICE_PDF_EMBED_ONLY=1) for deployments that explicitly don't run OnlyOffice.OnlyOffice deployed live on herodemo (2026-04-24)
What landed
OnlyOffice Document Server running as Docker container on the VM:
onlyoffice/documentserver:latest(3.9 GB), pulled to/data/docker(btrfs storage driver — see home#181)127.0.0.1:8088hero_office_server's action env (hero-demo-jwt-secret-change-in-prod)Reverse proxy in
hero_office_uiso OnlyOffice fits hero_router's per-service URL space:development_mik_proxy_onlyoffice→development)proxy_onlyoffice_root/proxy_onlyoffice_path(any HTTP method) at/onlyofficeand/onlyoffice/*restproxy_filepattern; OnlyOffice traffic stays on the single TF Grid name proxyeditor_pagePDF short-circuit (browser native) +proxy_file?inline=1for read-only PDF viewingAction env wiring on herodemo:
hero_office_ui:OO_SERVER_URL=https://herodemo.gent01.grid.tf/hero_office/ui/onlyoffice,OO_UPSTREAM_BASE=http://127.0.0.1:8088hero_office_server:ONLYOFFICE_JWT_SECRET=...,CONNECTOR_EXTERNAL_URL=https://herodemo.gent01.grid.tfVerified end-to-end
Clicking any
.docx/.xlsx/.pptxin the Office archipelago now loads the real OnlyOffice editor in the iframe with edit-mode + autosave callback..pdfcontinues to render via browser-native viewer (faster, no editor JS overhead).Why this approach (vs router-side TCP route)
hero_router proxies to per-service Unix sockets only (
hero_router/src/server/routes.rs:1941-1948). Adding TCP-target routing is a cross-cutting change with broader review surface. Sincehero_office_uialready has an HTTP-proxy handler (proxy_filefor foundry webdav), bridging OnlyOffice inside the same service via a sibling handler is the smaller, more focused change — and keeps OnlyOffice traffic semantically inside the office archipelago. PR #3 lays this out.Demo state
libreoffice --headless --convert-to pdfworkflow remains tracked in home#178 as a lightweight viewer fallback for deploys that don't run OnlyOffice.Closing this issue once PR #3 lands. Demo VM is unblocked now.
Signed-off-by: mik-tf
✅ Office editing fully working on herodemo (2026-04-25)
End-to-end editor works for
.docx/.xlsx/.pptx— real OnlyOffice with slide rendering, formulas, comments, autosave.What it took (full chain)
Infrastructure on herodemo:
/data/dockerwithbtrfsstorage driver (overlay2 fails on TF Grid flist whiteout files)onlyoffice/documentserver:latest, 3.9 GB, JWT enabled, secret matchinghero_office_server's action env)Code in
hero_office_ui(PR #3):proxy_onlyoffice_root/proxy_onlyoffice_path— HTTP reverse proxy to OnlyOffice container at/hero_office/ui/onlyoffice/*axum::WebSocketUpgrade+tokio_tungstenite::connect_async(socket.io requires WS for editor state)X-Forwarded-Host: <host>/hero_office/ui/onlyofficeso OO builds correct public URLsX-Forwarded-Proto: httpsfor the cache URL protocolContent-Security-Policy: upgrade-insecure-requestson the editor page (silently upgrades any residualhttp://URLs OO emits)Code in
hero_office_server(PR #3):edit, download, print, copy, comment, review, fillForms, modifyFilter, modifyContentControl, chat, protectAction env on herodemo:
hero_office_ui:OO_SERVER_URL=https://herodemo.gent01.grid.tf/hero_office/ui/onlyoffice,OO_UPSTREAM_BASE=http://10.1.2.2:8088hero_office_server:ONLYOFFICE_JWT_SECRET=...,CONNECTOR_EXTERNAL_URL=http://10.1.2.2:9990(internal hero_router URL — OO container fetches files without going back through public auth gate)Architecture — single-domain TLS gateway with auth
The "back to hero_router internal" loop matters: OO container needs to fetch documents from
hero_office_uibut must NOT go through public-gateway HTTPS+auth (no credentials in container). SplittingOO_SERVER_URL(browser-side, public HTTPS) fromCONNECTOR_EXTERNAL_URL(OO-container-side, internal HTTP) solves this cleanly.PR #3 status
hero_office/development_mik_proxy_onlyoffice→ lhumina_code/hero_office#3Three commits:
f1abfb5— initial PDF native + HTTP-only OnlyOffice proxydc9c813— WebSocket pass-through + streaming response body86a834c— X-Forwarded-Host/Proto + CSP upgrade-insecure-requests + JWT permissions widenedClosing this issue once PR #3 lands.
Related
Signed-off-by: mik-tf
Merged to hero_office/development 2026-04-25
Squash commit
2dbc543on hero_office development:PR #3 closed. The OnlyOffice connector is now upstream — fresh deploys using
developmenteverywhere will have the integration code without needing the demo-VM hotfix branch.Still demo-VM-only (Phase 2 work):
hero_skills/development_mik_docker_btrfshero_skills/development_mik_onlyoffice_install(service_onlyoffice.nu)hero_skills/development_mik_office_envSigned-off-by: mik-tf
Deploy-side resolved: new
service_onlyofficemodule manages the OnlyOffice Document Server Docker container (pull/run/JWT/healthcheck), andOO_UPSTREAM_BASEis forwarded tohero_office_uiaction. PR lhumina_code/hero_office#3 (commit2dbc543) wires the proxy on the code side. Closing if no remaining gap — please reopen if there is one.Part of:
lhumina_code/hero_skills@7c823d1(PR lhumina_code/hero_skills#126).Tracker: #185.