How to integrate Collabora Online on a Nextcloud server

One of the use cases of a Nextcloud server is that it can be used as a collaboration and sharing tool.

Our current Nextcloud setup allows document sharing and collaborative editing but for you to edit a document , you need to download it first, edit it and then upload it once more. This has a lot of limitations and not to mention that the process of downloading, editing and uploading a document can get really tiresome. That’s where Collabora Online comes in.

Collabora Online is a powerful LibreOffice-based online office suite with collaborative editing, which supports all major document, spreadsheet and presentation file formats and works in all modern browsers.

It supports editing your documents in real time with multiple other editors . Users can insert and reply to comments and invite others without a Nextcloud account for anonymous editing of files with a public link shared folder.

Collabora Online supports dozens of full-feature document formats including but not limited to DOC, DOCX, PPT, PPTX, XLS, XLSX + ODF, Import/View Visio.

In this guide, we are going to show you how to integrate Collabora on your Nexcloud server through the use of a docker image.

Requirements:
• A Nextcloud server
• A Fully Qualified Subdomain name
So now let’s log in to our next cloud server and get started. We are going to follow the following steps:

Updating our server

Like I said before, it’s always good practice to ensure that we are using the latest packages available.

sudo apt-get update && apt upgrade

Installing Docker

We are going to be using docker-ce , that is docker community edition. Before we do the installation, we are going to configure the docker repository on our Ubuntu server to ensure that we get the latest feature updates.

Docker provides a procedure for configuring their repo. You can check it out here. That’s where we will be getting our instructions from.
Below is the procedure I used for my Nexcloud server.

• Removing old-versions of docker

sudo apt-get remove docker docker-engine docker.io containerd runc

• Install packages to allow apt to use a repository over HTTPS

sudo apt-get install \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg-agent \
     software-properties-common

• Add Docker’s official GPG key

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

• Add a stable docker repository

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

• Update packages and Install Docker engine

sudo apt-get update && apt upgrade
sudo apt-get install docker-ce docker-ce-cli containerd.io

Once the installtion is complete we can run the command systemctl status docker to confirm that indeed docker is installed and started.

Configure subdomain to be used for collabora online

We are going to use a different subdomain from the one we used to setup our Nextcloud server.

This is done from the control panel of your hosting provider. The configuration is the same; we create a subdomain and point it’s DNS A record to our Nextcloud IP address.

We will need this subdomain while setting up the Collabora online app on our Nextcloud server.

We are going to use collabora.linuxnimbus.com as our subdomain for collabora online.

Installing Collabora Online

We are going to do this using docker. That’s why we installed docker initially. Docker tries to make everything easy because everything is in a container and we all have to do is pull down a container.

We are going to use the following command to do that:

sudo docker pull collabora/code

Where collabora is the docker repository we are using and code is the program that we are installing, that is Collabora Online Development Edition.
You should get a status message indicating that the image has been downloaded successfully.

Now we are going to start the docker image. For that we are going to use

sudo docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=collabora\.linuxnimbus\.com'  --restart always --cap-add MKNOD  collabora/code

Setup Apache to point our subdomain to our collabora online server started locally

We already have apache installed . Before we continue, we need to activate a number of apache modules

sudo a2enmod proxy
sudo a2enmod proxy_wstunnel
sudo a2enmod proxy_http
sudo a2enmod ssl
systemctl reload apache2

Now we are going to create a virtual host in /etc/apache2/sites-available. We are going to name our virtual host as collabora.conf.

vi /etc/apache2/sites-available/collabora.conf

At this point we are going to use a sample virtual host that is available on Nextcloud website. You can check it out here.

</VirtualHost *:443>
 ServerName collabora.linuxnimbus.com:443
 SSL configuration, you may want to take the easy route instead and use Lets Encrypt!
 SSLEngine on
 SSLCertificateFile /path/to/signed_certificate
 SSLCertificateChainFile /path/to/intermediate_certificate
 SSLCertificateKeyFile /path/to/private/key
 SSLProtocol             all -SSLv2 -SSLv3
 SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
 SSLHonorCipherOrder     on
 Encoded slashes need to be allowed
 AllowEncodedSlashes NoDecode
 Container uses a unique non-signed certificate
 SSLProxyEngine On
 SSLProxyVerify None
 SSLProxyCheckPeerCN Off
 SSLProxyCheckPeerName Off
 keep the host
 ProxyPreserveHost On
 static html, js, images, etc. served from loolwsd
 loleaflet is the client part of LibreOffice Online
 ProxyPass           /loleaflet https://127.0.0.1:9980/loleaflet retry=0
 ProxyPassReverse    /loleaflet https://127.0.0.1:9980/loleaflet
 WOPI discovery URL
 ProxyPass           /hosting/discovery https://127.0.0.1:9980/hosting/discovery retry=0
 ProxyPassReverse    /hosting/discovery https://127.0.0.1:9980/hosting/discovery
 Main websocket
 ProxyPassMatch "/lool/(.*)/ws$" wss://127.0.0.1:9980/lool/$1/ws nocanon
 Admin Console websocket
 ProxyPass   /lool/adminws wss://127.0.0.1:9980/lool/adminws
 Download as, Fullscreen presentation and Image upload operations
 ProxyPass           /lool https://127.0.0.1:9980/lool
 ProxyPassReverse    /lool https://127.0.0.1:9980/lool
 Endpoint with information about availability of various features
 ProxyPass           /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities retry=0
 ProxyPassReverse    /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities
</VirtualHost> 

So after copying the sample virtual host, we are going to change the ServerName to reflect our collabora online subdomain name .

We also need to change the paths for the SSL certificate. At this point we need to run Let’s encrypt . We are going to run the following command

certbot certonly -d collabora.linuxnimbus.com 

We are going to go with option one since we have Apache up and running already.

Once the command executes, the SSL files will be generated under /etc/letsecnrypt/live/collabora.linuxnimbus.com

Now we replace the path of the SSL certificate on the virtual host configuration file that we created.

For my case I have something like this

SSLEngine on
 SSLCertificateFile /etc/letsencrypt/live/collabora.linuxnimbus.com/cert.pem
 SSLCertificateChainFile /etc/letsencrypt/live/collabora.linuxnimbus.com/fullchain.pem
 SSLCertificateKeyFile /etc/letsencrypt/live/collabora.linuxnimbus.com/privkey.pem

Now we go ahead and enable the virtual host file

sudo a2ensite collabora.conf
systemctl reload apache2

Once apache reloads successfully, we now have collabora online and running. All we need now is to install and configure the app on Nexcloud.

Configure Collabora Online App

Log in to the Nexcloud on your web browser.
Go to the Apps section and choose “Office & text” Install the “Collabora Online app”
Go to Admin Settings -> Collabora Online -> Specify the server you have setup before, the subdomain
Save changes

Congratulations, your Nextcloud has Collabora Online Office integrated!

Updating

When newer images of docker are released, you can follow the procedure below to do the update

  • Get new docker image:
    docker pull collabora/code
  • List docker images:
    docker ps
    from the output you can get the Container ID of your Collabora Online docker image.
  • stop and remove the Collabora Online docker image:
    docker stop CONTAINER_ID
    docker rm CONTAINER_ID
  • start the new image:
    docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=collabora\\.linuxnimbus\\.com' --restart always --cap-add MKNOD collabora/code

Leave a Reply

Your email address will not be published. Required fields are marked *