Apr 06, 2017
collective.documentviewer integrates the Document cloud document viewer into Plone to provide a nice preview of files, including search, first-page-screenshots and many other features. In this post we will explain how to setup collective.documentviewer to use celery based tasks to convert the documents.

We are long time users of collective.documentviewer as a file viewer in Plone 4. We have it installed, for instance, in Egoibarra.eus and Eibar.eus to show books, magazines, reports and decisions produced in different formats (mainly PDF and MS-Word DOC and DOCX files).

When we first set up the viewer, we installed it using plone.app.async based asynchronous tasks because back then it was the only way to free the main Zope instance threads from doing the document conversion process.

Some weeks ago, we had to install collective.documentviewer in a yet-to-be-published new Plone 5 site and realised that now celery can be used to handle those async tasks. The installation was very easy and we were very satisfied with the results, so we upgraded and migrated the old Plone 4 site to use celery to do the document conversion.

The configuration is very easy, and you can find an example buildout for both Plone 4 and Plone 5 that uses celery to do all the hard work.

In both cases you will need to install redis on your server. You can just apt-get install redis-server or run a docker container: docker run -p 6379:6379 -d redis.

The buildout creates a supervisor (started with bin/supervisord) that runs the ZEO server, Plone server and the celery worker). 

Mikel Larreategi
Apr 27, 2018 01:41 PM
I failed to add a 'supervisor' part in buildout parts.

I have just fixed the examples.

Thanks!
Franz G. Reinisch
Apr 29, 2018 07:12 AM
Yes I found out soon after as well. But this buildout was most helpful for me and I learned a lot from it, and my document viewer works fine. Thanks a lot.
Commenting has been disabled.

You may be interested in these other articles