How To Install Collabora Using Docker On Ubuntu 16.04

This Collabora install is used for integration with Nextcloud.

1. Create subdomain for the Collabora online server

$ sudo mkdir /var/www/office.example.com/html

2. Install a valid SSL certificate

See How To Issue LetsEncrypt ACMEv2 Wildcard Certs

3. Add a new nginx server block

https://icewind.nl/entry/collabora-online/

Add this code to the end of an existing server block or create a new server block for the subdomain you created above. Substitute the server_name for the correct subdomain name and the ‘/path/to/certificate' to the path to your ssl certificate:

server {
    listen       443 ssl;
    server_name  office.example.com;

    ssl_certificate /path/to/certficate;
    ssl_certificate_key /path/to/key;
    
    # static files
    location ^~ /loleaflet {
        proxy_pass https://localhost:9980;
        proxy_set_header Host $http_host;
    }

    # WOPI discovery URL
    location ^~ /hosting/discovery {
        proxy_pass https://localhost:9980;
        proxy_set_header Host $http_host;
    }

   # main websocket
   location ~ ^/lool/(.*)/ws$ {
       proxy_pass https://localhost:9980;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "Upgrade";
       proxy_set_header Host $http_host;
       proxy_read_timeout 36000s;
   }
   
   # download, presentation and image upload
   location ~ ^/lool {
       proxy_pass https://localhost:9980;
       proxy_set_header Host $http_host;
   }
   
   # Admin Console websocket
   location ^~ /lool/adminws {
       proxy_pass https://localhost:9980;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "Upgrade";
       proxy_set_header Host $http_host;
       proxy_read_timeout 36000s;
   }

   #Enable mobile editing feature
   location ^~ /hosting/capabilities {
       proxy_pass https://localhost:9980;
       proxy_set_header Host $http_host;
}

}

4. Install Docker

See How To Install Docker On Ubuntu 16.04

5. Install the Collabora online server

Make sure to use the back slashes in the url to escape the periods. ‘–name office' is optional and can be any name you choose.

$ docker pull collabora/code
$ docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=cloud\\.example\\.com' --name office --restart always --cap-add MKNOD collabora/code

or an alternative example with the .co.uk tld:

$ docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=cloud\\.example\\.co\\.uk'  --name office --restart always --cap-add MKNOD collabora/code

or if you want to use the docker container with more than one Nextcloud (all hosts are separated by ‘\|' ):

$ docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=cloud\\.example\\.com\|cloud2\\.example2\\.com' --name office --restart always --cap-add MKNOD collabora/code

ERRORS & SOLUTIONS

Extra steps I found I needed for docker to communicate with the host os:

$ sudo ufw allow 9980

https://tech.oeru.org/installing-nextcloud-and-collabora-office-online-docker-ubuntu-1604

$ sudo ufw allow in on docker0
$ sudo ufw allow from 172.17.0.0/24 to any
$ sudo ufw allow from 172.18.0.0/24 to any
$ sudo ufw allow from 172.19.0.0/24 to any
$ sudo ufw allow from 172.20.0.0/24 to any
$  sudo nano /etc/default/ufw

and copy the line DEFAULT_FORWARD_POLICY=”DROP” tweak it to look like this (commenting out the default, but leaving it there for future reference!):

#DEFAULT_FORWARD_POLICY="DROP"
DEFAULT_FORWARD_POLICY="ACCEPT"

You also have to edit /etc/ufw/sysctl.conf and remove the “#” at the start of the following lines, so they look like this:

$ sudo nano /etc/ufw/sysctl.conf

Uncomment this to allow this host to route packets between interfaces

net/ipv4/ip_forward=1
net/ipv6/conf/default/forwarding=1
net/ipv6/conf/all/forwarding=1

and finally restart the network stack and ufw on your server

$ sudo service networking restart
$ sudo service ufw restart

Updating

Occasionally, new versions of this docker image are released with security and feature updates. Grab new docker image:

$ docker pull collabora/code

List docker images:

$ docker ps

from the output you can glean 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=cloud\\.nextcloud\\.com' --name office --restart always --cap-add MKNOD collabora/code 

REFERENCES

https://nextcloud.com/collaboraonline/
https://icewind.nl/entry/collabora-online/
https://tech.oeru.org/installing-nextcloud-and-collabora-office-online-docker-ubuntu-1604

Allow document creating/editing capabilities in the Nextcloud Android app when using Nginx
https://github.com/nextcloud/android/issues/3329#issuecomment-449645542


Hosting

Develop and scale your apps globally with DigitalOcean and/or Vultr – or use shared hosting with no server maintenance required at iMarketHost.com.

Installation & Maintenance

If you would like to get this app installed, maintained or need training, Contact Me to get current rates.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.