Office documents editor (collabora)
Office documents editor on a Self Host Wizard box: the collabora piece, served at docs.<apps domain>, none sign-in, memory limit 1128 MB.
At a glance
| Field | Value |
|---|---|
| Address | https://docs.<apps domain> |
| Sign-in | none: no office sign-in in front of it |
| Memory limit | 1128 MB (ram_mb: measured peak × 1.3) |
| Database | none shared: it keeps its own data in THX_DATA |
| Needs | nothing |
| Needed by | drive |
| Containers | collabora |
Image: collabora | collabora/code:26.04.6.2.1@sha256:a2f5d4e88addd46033d8440f7a13b82f7e6fe444bf8c6b5a3eadc789f0b5342b |
| Licence (from the README) | MPL-2.0 |
| Upstream (from the README) | https://docs.<apps_domain> |
Turn it on
thx enable adds collabora and everything it needs to the box's state; thx apply then installs it. Apps are applied only once site_domain is set.
sudo thx enable collabora
sudo thx apply
Engineering notes (pieces/collabora/README.md)
Served at https://docs.<apps_domain>, used only from drive: people open,
edit and create .docx .xlsx .pptx (and .odt .ods .odp, older Office formats,
.rtf, .csv) from https://drive.<apps_domain>, several at once in one
document. Collabora Online Development Edition, MPL-2.0, image
collabora/code:26.04.6.2.1 pinned by multi-arch index digest (linux/amd64 and
linux/arm64, the latter checked with docker buildx imagetools inspect).
How it fits
drive is the WOPI host (see pieces/drive/README.md): its /office page gets a
signed token for one user and one file, and posts it into an iframe of this
editor. The editor then calls drive's /wopi/files/<id> over the piece network
at http://drive:8080 to read and save the file. drive depends on this piece
(the contract forbids the reverse: drive sits behind forward auth), so thx puts
this container on drive's network.
Why auth = "none": the editor has no users of its own, and the browser talks
to it directly (the iframe, then a WebSocket per document). Its only way to a
document is a WOPI URL plus a token, and it accepts WOPI URLs for one host,
http://drive:8080; drive refuses a token it did not sign, an expired one, one
for another file, or one whose user has since left the company or been
suspended. Forward auth in front would add an Authelia round trip to every
WebSocket and image request and protect nothing the token does not.
Locked down (files/coolwsd.xml)
- WOPI hosts: drive only (
alias_groups); local files off. - Admin console off; Prometheus metrics need the (unset) admin login.
- Conversion API (
/cool/convert-to):post_allowis a TEST-NET address that no client has, so it answers 403. Behind Caddy every client arrives as the docker gateway, a private address the default list would allow. - Documents cannot fetch from other servers (
lok_allow), macros do not run, AI, Zotero, document signing and remote links are off, no update check. frame-ancestors https://drive.<apps_domain>: only drive's pages may frame it. Collabora appends its own host to that list.- TLS ends at Caddy (
ssl.termination).
Container: all capabilities dropped but CHOWN, FOWNER and SYS_CHROOT. Each
document runs in a chroot jail made by coolforkit-caps, which raises those
three from its file capabilities as it starts, so no-new-privileges cannot be
set (with it, documents would run unjailed). Jails are linked, not mounted
(mount_jail_tree=false), because mounting needs SYS_ADMIN. Unprivileged user
namespaces are not needed. The image has no shell, so there is no healthcheck;
test.sh waits on /hosting/discovery.
Measured (dev PC, ./test.sh)
The test brings up LLDAP, drive (our binary from this tree) and the editor on one network and plays the editor's page over its WebSocket protocol:
- discovery lists edit actions;
frame-ancestorsnames drive; admin console, admin socket, metrics and conversion refused - open link: WOPI source is
drive:8080; non-JSON 415; another company's file 404; another user's/me404; a kind the editor cannot edit 422 - round trip: alice types and saves, the
.docxon disk holds her text - co-editing: bob opens the same file, both appear in one session, bob's save holds both edits
- refused: carol's token (other company), a forged token, a token with a mixed signature, a WOPI host that is not drive, a suspended user; the file unchanged
- quota: a save past alice's 1 MB is refused (507, the editor reports "savefailed") and the file stays whole; after freeing space the save lands
- new empty
.docx,.xlsxand.pptxopen as new documents and save in their format (a slide added to the presentation is in the saved file) /wopi/without a token from another container: 401- in headless Chrome, as a person: New > Document, a name, Enter; the editor
loads inside drive's page under its CSP; typing and Ctrl+S put the sentence
in the
.docx; Back to files lists it; no script errors or CSP violations
RAM, with 6 sessions on 5 documents open at once (two 1-page texts edited by
two users, a 400-paragraph document, a spreadsheet, a presentation) and then
the browser session: working set (anon + kernel + dirty, sampled every 0.1 s)
peaked at 868 MiB (827 MiB in an earlier run without the browser check);
idle after start about 416 MiB. ram_mb = mem_limit = 1128 (868 × 1.3).
memory.peak, which counts page cache, reached the 1076 MiB limit of that run:
the kernel drops cache at the limit, so this is not pressure on the documents.
That run averaged about 80 MiB per open document ((868 − 416) / 6); a box
expecting many people in documents at once should raise the limit from a
measurement under its own load.
Disk: jails are copied into the container's writable layer (no bind mounts), about 420 MB after a run. It is recreated with the container.
Known gaps
- CODE shows a welcome dialog on first use and, now and then, a feedback
prompt. Turning them off needs
home_mode, which caps the editor at 20 connections and 10 documents. - A new document is an empty file until its first change is saved: a person who creates one and closes it without typing leaves a 0-byte file.
- Locks are kept by drive in memory; a drive restart while someone edits forgets them.