Setting up LibreOffice conversion to PDF

Setting up LibreOffice as a document converter for Sakai will massively improve the quality of the document preview functionality in the new grader. LibreOffice can be setup as a full blown server serving  multiple nodes or as a Docker image running on each Sakai node. This guide will focus on the Docker image per Sakai node approach.

Step-by-step guide

  1. Install Docker on your Sakai node. This may well be your development machine if you're just trying this out. Visit https://docker.com  and install the version for your OS.
  2. Now download and run the libreoffice/online:master Docker image. On linux or OSX you'd use this command: docker run -d -p 9980:9980 -e "extra_params=--o:ssl.enable=false" libreoffice/online:master.  Details on the environment variable you can supply can be found at https://hub.docker.com/r/libreoffice/online/
  3. Now you will have a LIbreOffice Online server running in a Docker container and listening on port 9980. On linux you can verify this with this command: netstat -nlp | grep 9980.
  4. In your sakai.properties or local.properties, add this property: fileconversion.enabled=true. Restart Tomcat. The file conversion service in Sakai should now talk to your Dockerised LIbreOffice Online server. This is currently setup to work with attachments in Sakai. Try this out in the Assignments tool by submitting a large powerpoint file. Within a few minutes that file should be available as a PDF and you'll be able to view it in the browser from the new grader.
  5. You can configure the Libre Office server's url with this property: fileconversion.converterurl. OOTB, it defaults to http://localhost:9980.


Performance

There are a couple of sakai properties to help if you encounter issues with performance/reliability.

  1. fileconversion.pausemillis : This defaults to 1000 and is the pause that occurs between each document in the queue being sent off to the Libre server. If you're seeing pegging on the Libre server, try upping this to throttle the requests coming from Sakai.
  2. fileconversion.queueintervalminutes: This defaults to 1 and defines the length of time between each read of the conversion queue in Sakai. Obviously, this will also affect the load on the Libre server, together with pausemillis, throttling the rate of requests. This one is more aimed at Sakai's load though.
  3. fileconversion.workerthreads: Again, more a Sakai property. The conversion service uses a thread pool and this defaults to 5 workers.

File Types OOTB

DOCX
DOC
ODT
ODP
PPT
PPTX