How to install Collabora Online on docker on Nextcloud 13 on a Debian 9 system.

0. Install https support for apt

sudo apt install apt-transport-https ca-certificates

1. Install Docker CE

Add Docker’s official GPG key

Add docker repository key:

curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -

Check docker key:

sudo apt-key fingerprint 0EBFCD88

Add docker repository

echo "deb https://download.docker.com/linux/debian stretch stable" | sudo tee -a /etc/apt/sources.list.d/docker.list

Update apt database:

sudo apt update

Install docker

sudo apt install docker-ce

Test docker

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world

c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabddcf9431a1feb60fd967798512411de4cd
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.
# [...]

Configure docker to work with Debian

Change the docker storage driver in the docker service file to overlay2. Under Debian 9 proceed as follows:

sudo cp /lib/systemd/system/docker.service /etc/systemd/system/

Edit the file /etc/systemd/system/docker.service and replace ExecStart=/usr/bin/dockerd -H fd:// with ExecStart=/usr/bin/dockerd --storage-driver=overlay2 -H fd://:

# File: /etc/systemd/system/docker.service
# [...]
# ExecStart=/usr/bin/dockerd -H fd://
ExecStart=/usr/bin/dockerd --storage-driver=overlay2 -H fd://

Then restart systemd, docker and your container

sudo systemctl daemon-reload
sudo systemctl restart docker

NOTE: Changing the storage driver also removes the according aufs folder in the docker /lib folder and all contents.

2. Install collabora/code image

Pull collabora/code image:

sudo docker pull collabora/code

Run collabora container. The domain must be the nextcloud installation domain:

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

3. Setup nginx as a reverse proxy

Setup nginx as a reverse proxy which will provide a valid ssl setup. We can either run this reverse proxy on a seperate (sub-)domain or add it to the same domain your Nextcloud runs on. Add a new server block to your nginx config or add the location entries to an existing one if you’re re-using the same domain.

server {
  listen       443 ssl;
  server_name  cloud.example.com;
  # You can set a dedicated domain like:
  # server_name  office.example.com;

  ssl_certificate /path/to/your/certficate;
  ssl_certificate_key /path/to/your/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;
  }

  # 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;
  }

  # Download, presentation and image upload
  location ^~ /lool {
    proxy_pass https://localhost:9980;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $http_host;
  }
}

Restart nginx:

sudo systemctl restart nginx

4. Install and config Collabora Online app

Install Collabora Office app.

Configure Nextcloud to use Collabora Office:

  • Navigate to Settings -> Collabora Online
  • Set Collabora Online server to https://cloud.example.com or whatever domain you use for your collabora office reverse proxy;
  • Apply settings.

Enjoy your new Collabora Online Office :-)

References