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

0. Install https support for apt

1
sudo apt install apt-transport-https ca-certificates

1. Install Docker CE

Add Docker’s official GPG key

Add docker repository key:

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

Check docker key:

1
sudo apt-key fingerprint 0EBFCD88

Add docker repository

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

Update apt database:

1
sudo apt update

Install docker

1
sudo apt install docker-ce

Test docker

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
root@server:~# 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:

1
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://:

1
2
3
4
# 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

1
2
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:

1
sudo docker pull collabora/code

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

1
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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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:

1
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