Integrating Collabora with Nextcloud on Nginx

In one of the previous articles I described how to install nextcloud. If you want extend functionality to online editing XOffice (Open & M$) documents you need to install Collabora service.

Install additional fonts

Install (on Debian) additional MS fonts. New fonts will be available on /usr/share/fonts directory.

apt-get install ttf-mscorefonts-installer

Docker compose

You should add appropriate section on the end of docker compose file. My custom Collabora service is based on collabora/code and btstream/collabora-fonts. The main feature is the possibility of adding custom font from external directory. Just mount the volume.

version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb:10.3.14
    restart: always
    volumes:
      - ./data/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=$ENV_MYSQL_ROOT_PASSWORD
      - MYSQL_PASSWORD=$ENV_MYSQL_PASSWORD
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud:15.0.8-apache
    ports:
      - 50020:80
    links:
      - db
    volumes:
      - $ENV_APP_HTML:/var/www/html
      - $ENV_APP_DATA:/var/www/html/data
      - $ENV_APP_CONFIG:/var/www/html/config
      - $ENV_APP_APPS:/var/www/html/apps
    restart: always

  collabora:
    image: mrcnpdlk/collabora-custom-fonts:1.0
    restart: unless-stopped
    environment:
       - domain=mydomain.com
       - username=admin
       - password=some_password
    volumes:
       - /usr/share/fonts:/usr/share/fonts/Custom
    ports:
      - 127.0.0.1:9980:9980

After starting of services wait one or two minutes – collabora image starts long time.

Nginx configuration

Collabora is started on localhost without SSL, because of that I am using Nginx to add SSL. Add config to site-enabled directory.

server {
    listen 9081 ssl http2;
    listen [::]:9081 ssl http2;
    ssl_certificate     path_to_cert;
    ssl_certificate_key path_to_key;
    server_name my_server_name;
    access_log /var/log/nginx/access.log;
    error_log  /var/log/nginx/error.log;
    large_client_header_buffers 4 8k;

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

    # Capabilities
    location ^~ /hosting/capabilities {
        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;
    }
}

Now, the collabora service is listening on 9081 port of my server with some public IP, for example 1.1.1.1 on domain mydomain.com.

If everything is correct, you will be able to login into admin page: https://mydomain.com:9081/loleaflet/dist/admin/admin.html

Nextcloud configuration

Next step is very easy. Just install Collabora Online app on the Nextcloud and configure it. Set url service: https://mydomain.com:9081 and disable checking SSL if you have self-signed certificate .

Upgrading own NAS

In the previous article about NAS I described how to build it cheaply using used parts. At the end I presented a list of improvements that I intended to do in the near future.

CPU Cooler

Default cooler included into motherboard in my opinion was insufficient. The temperature on my CPU was too high – from 65 C degrees in idle state to 85 C in stress. I have spent a lot of time looking for the best cooler, most of them ware too big for chassis. The final choice has fallen on the AVC product with 4 efficient copper heat pipes and single 10cm quiet fan.

cooler_1

Image 1 of 3

After installation new cooler fulfilled its basic task, temperature of the CPU decreased and varied between 60 and 70 Celsius degrees.

CPU & RAM

Next thing I have been considering was the upgrade of RAM and CPU. Built-in Intel Core2 Duo E4600 unit is quite inefficient. Only two cores and low memory cache were causing problem during for example generating thumbnails for pictures stored in Nexcloud.

My motherboard is designed for processors having socket LGA775. Some LGA 711 CPU, for example Xeons after application special adapter could be installed into LGA 775. These Xeons cost a lot less and are basically identical internally to the high-end Core 2 Quad CPUs.

CoresTDPCache L2CPU MarkPrice
Intel Core2 Duo E4600 @ 2.40 GHz265 W2 MB13854-6 EUR
Intel Core2 Duo E8600 @ 3.33GHz265 W6 MB240815-30 EUR
Intel Core2 Quad Q9500 @ 2.83GHz495 W6 MB354821-30 EUR
Intel Core2 Quad Q9650 @ 3.00GHz495 W12 MB416960-70 EUR
Intel Xeon E5440 @ 2.83GHz480 W12 MB397718 EUR
Intel Xeon E5450 @ 3.00GHz480 W12 MB419830-35 EUR

Summary

As we can see changing some components load and CPU temperature have been decreased.

NamePrice
CPU CoolerAVC LGA 7758 EUR
CPUXeon E5440 4×2.8GHz18 EUR
RAM Memory2x4GB 1333Hz DDR3 DIMM PC3-1060039 EUR
HDD Cooler AAB Cooling IceSilent HDD Cooler 5 EUR
Total:70 EUR