Office
Word, Excel and PowerPoint files, and their OpenDocument equivalents, open in Hearth Office: an office engine that runs as a container of its own next to Hearth. Browsers load the editor from the engine's address. The engine never receives documents from the browser: it fetches and saves them through Hearth's server, which checks every request against the person's access at that moment. Hearth Office also turns office files into PDF for the PDF tools (Convert to PDF).
Without Hearth Office, office files can still be stored, shared and downloaded, but not edited.
The engine container
Add the engine to the compose file. The image is published by digest;
use the one named in deploy/office/Dockerfile of the Hearth version
you run, so the engine and Hearth match.
hearth-office:
image: ghcr.io/ifedan-ed/hearth-office@sha256:<digest from deploy/office/Dockerfile>
restart: unless-stopped
environment:
WOPI_ENABLED: "true"
EXAMPLE_ENABLED: "false"
ADMINPANEL_ENABLED: "false"
# The engine reaches Hearth on the private Docker network.
ALLOW_PRIVATE_IP_ADDRESS: "true"
JWT_SECRET: ${OFFICE_JWT_SECRET}
volumes:
- ./data/office/themes:/var/www/euro-office/documentserver/web-apps/apps/common/main/resources/themes:ro
- ./data/office/fonts:/usr/share/fonts/truetype/hearth:ro
- office-engine-db:/var/lib/postgresql
- office-engine-files:/var/lib/euro-office/documentserver/App_Data/cache/files
ports:
- 127.0.0.1:8085:80
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1/healthcheck"]
interval: 30s
retries: 5
start_period: 120s
mem_limit: 4g
The two volumes keep converted documents across engine updates, so a document's first open after an update does not wait for a new conversion. The engine keeps no other state; it is not part of the backup.
On the Hearth containers:
OFFICE_SHARED_DIR: /data/office
OFFICE_JWT_SECRET: ${OFFICE_JWT_SECRET}
volumes:
- ./data/office:/data/office
OFFICE_SHARED_DIRis the folder Hearth shares with the engine. Hearth writes the editor's colour themes there (made from your theming, picked up within five minutes) and the extra fonts you upload. It must belong to the container user, 65532.OFFICE_JWT_SECRETis the engine'sJWT_SECRET, the same value, at least 32 characters (openssl rand -hex 32). Hearth signs Convert to PDF's requests with it. Without it, Office still edits but does not convert to PDF.
Give the engine its own address through your proxy, such as
office.example.org, with WebSockets passed through (co-editing uses
them) and framing allowed only by Hearth:
office.example.org {
encode zstd gzip
header Content-Security-Policy "frame-ancestors 'self' https://hearth.example.org"
reverse_proxy 127.0.0.1:8085
}
Connecting Hearth to the engine
Hearth needs three addresses: the engine's for browsers, the engine's for Hearth's server, and Hearth's own for the engine. Set them once after the first start:
docker compose exec -T hearth /hearth office set \
--hearth-office-url https://office.example.org \
--hearth-office-internal-url http://hearth-office \
--wopi-url http://hearth:8080 \
--wopi-allow 172.31.184.0/24
--wopi-allow lists the networks the engine's requests may come from:
the Docker network both containers are on. Requests from anywhere else
are refused. The command also turns Office on.
hearth office show prints whether Office is on, the addresses and
whether the engine answers.
Administration, Office
- Office: on or off for everyone.
- Hearth Office: address for browsers, Hearth Office: address for
Hearth's server, Hearth's address for the engine and Allowed engine
networks: the same values
hearth office settakes. - Format of new documents: Office Open XML (.docx, .xlsx, .pptx) or OpenDocument (.odt, .ods, .odp), for the documents people make from Files' New menu.
- File types: the extensions that open in Office.
- Who may use Office: Everyone, or members of the groups you tick.
- Secure view: a watermark text, and which documents open in secure view (All documents, Read only, Shared with someone, Public links, Links that hide download, chosen groups or tags). In secure view the engine refuses printing, downloading and copying out, and draws the watermark. The watermark deters; a technical visitor could remove it from their own screen.
- Prepare the editor in the background: on by default. While Files lists office documents, the browser fetches the editor when the page is idle, so the first open is as fast as a later one. It is never done on a phone, on mobile data or with data saver on.
- Templates: upload documents people can start from in Files' New menu.
- Fonts: upload extra fonts. Hearth Office picks them up when it
restarts (
docker compose restart hearth-office).
The editor's assistant (AI Tools in the editor) is switched on in Administration, Copilot, with the Copilot (Copilot). The engine needs a key to reach it:
# on the Hearth containers
OFFICE_ENGINE_KEY: ${OFFICE_ENGINE_KEY}
OFFICE_ENGINE_KEY (at least 32 characters) is the key the engine
presents to Hearth's assistant gateway. Give the same value to the engine
in its AI settings (aiSettings in its NODE_CONFIG, provider address
http://hearth:8080/api/v1/office/ai); deploy/docker-compose.yml in the
repository has the complete block. Empty: no assistant in the editor.
Fonts
Documents look right only when the fonts they name are there.
- Calibri and Cambria documents use Carlito and Caladea, which have the same widths and are in the engine's image.
- Microsoft's core fonts for the web (Times New Roman, Arial, Georgia,
Verdana, Courier New and the rest) may not be passed on, so they are
not in the image. If your licence allows it, put them in
data/office/corefontsand mount that folder into the engine at/usr/share/fonts/truetype/msttcorefonts(read only). PointPDF_SERVER_FONTS_DIRat the same folder on the Hearth containers, so the PDF editor can use them too (configuration). - Any other font: upload it in Administration, Office, Fonts.
Spelling and grammar
The editor's spelling and grammar check (Review tab) uses a LanguageTool server of your own. It needs no internet access: put it on an internal network that only Hearth can reach.
hearth-languagetool:
image: erikvl87/languagetool:6.8
restart: unless-stopped
environment:
Java_Xms: 256m
Java_Xmx: 1g
networks:
- proofing
mem_limit: 1536m
networks:
proofing:
internal: true
Add the proofing network to the hearth container and set:
LANGUAGETOOL_URL: http://hearth-languagetool:8010
The editor reaches LanguageTool only through Hearth, and nothing is kept.
Updating the engine
Take the digest from the new Hearth version's deploy/office/Dockerfile,
change it in your compose file, and run docker compose up -d hearth-office. People with a document open lose their connection while
the engine restarts, so do it at a quiet time.