Search code examples
phpdockerdocumentnextcloudcollaborative-editing

Docker Nextcloud Failed to load Collabora Online - please try again later


I have this error message:

Failed to load Collabora Online - please try again later

at the top-right corner of the self hosted nextcloud website when I try to open the file

Welcome to Nextcloud Hub.docx

In Nextcloud that is running as a docker container.

Welcome to Nextcloud Hub.docx is located in Files > Documents as an example file.

screenshot

I am using the official image of nextcloud:19-apache
that I started this way:

#!/bin/sh

set -e;
set -f;

docker run -d \
--name nextcloud \
-p 8080:80 \
-v /tmp/nextcloud/var/www/html:/var/www/html \
-v /tmp/nextcloud/var/lib/mysql:/var/lib/mysql \
-v /tmp/nextcloud/var/lib/postgresql/data:/var/lib/postgresql/data \
nextcloud:19-apache

sleep 3;

firefox "http://localhost:8080"

exit 0;

And I check logs this way:

docker logs nextcloud

There are no errors/warnings besides this one entry:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message

Clicking in nextcloud web Settings > apps shows that both apps required for Collabora are installed:

enter image description here

However there is no status of them if they are running as they should or not.

The status of all of the running container:

NETWORK ID          NAME                DRIVER              SCOPE
88efc7e2489f        bridge              bridge              local
b75e841984e3        host                host                local
efff0416acdb        none                null                local


-------------------------------------------------------------

CONTAINER ID  IMAGE                CREATED              STATUS   IP                  PORTS                                            NAMES
58c7069e0a4d  nextcloud:19-apache  2020-09-21T13:59:53  running  bridge:172.17.0.2   map[80/tcp:[map[HostIp:0.0.0.0 HostPort:8080]]]  /nextcloud

How to make Collabora working and open that document docx? (there is no problem when opening *.pdf or *.md files, edit them and have saved with a revision history)


Solution

  • So I took a look at this. I have always used Nextcloud only by Docker-Compose, Traefik or Nginx and the Colabora Server as extra Server.

    1. For Collabora to work, the Apache server must listen inside on port 9980. For it to do so you would have to put the Apache Config revise (ProxyPass). See on Part2 in the Documentation Link

    2. I cannot recommend the local Collabora Server because it is often crashes. But that's not the point here.

    3. I wouldn't do it that way at all, but rather use docker-compose to assemble the service.

    I have implemented a local installation of Nextcloud with Collabora via the Traefik Proxy. You don't have to worry about the webserver redirecting to the right port because Traefik takes care of that.

    Docker-Compose Example

    If you have any questions, just ask!

    In my example I use Local Domains that resolve to the Docker IP. Just edit the Hosts file. But you know that for sure...

    192.168.x.x collabora.local.com 192.168.x.x nextcloud.local.com

    Install Docker-Compose if you do not already have it.

    Create Networt "web": $ docker network create web

    Create Docker-Compose file: $ touch docker-compose.yml

    Add:

    version: "3.3"
    
    volumes:
      db:
      nextcloud:
    
    services:
      traefik:
        image: "traefik:v2.3"
        container_name: "traefik"
        restart: always
        command:
          - "--api.insecure=true"
          - "--providers.docker=true"
          - "--providers.docker.exposedbydefault=false"
          - "--entrypoints.web.address=:80"
        ports:
          - "80:80"
          - "8080:8080"
        volumes:
          - "/var/run/docker.sock:/var/run/docker.sock:ro"
          - "/etc/localtime:/etc/localtime:ro"
        networks:
          - web
          - internal
    
      nextcloud:
        image: "nextcloud:19-apache"
        container_name: "nextcloud-app"
        restart: unless-stopped
        depends_on:
          - traefik
          - db
        volumes:
          - "nextcloud:/var/www/html"
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.nextcloud-app.entrypoints=web"
          - "traefik.http.routers.nextcloud-app.rule=Host(`nextcloud.local.com`)"
        networks:
          - web
          - internal
    
      collabora:
        image: "collabora/code"
        container_name: collabora-app
        restart: unless-stopped
        expose:
          - "9980"
        environment:
          - domain=nextcloud.local.com
          - extra_params=--o:ssl.enable=false
          - username=admin
          - password=admin
        cap_add:
          - MKNOD
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.collabora.entrypoints=web"
          - "traefik.http.routers.collabora.rule=Host(`collabora.local.com`)"
          - "traefik.http.services.collabora.loadbalancer.server.port=9980"
        networks:
          - web
    
      db:
        image: mariadb:latest
        container_name: nextcloud-db
        restart: always
        environment:
          - MYSQL_HOSTNAME=maria_db
          - MYSQL_ROOT_PASSWORD=Secure_Root_Password
          - MYSQL_DATABASE=nextcloud
          - MYSQL_USER=nextcloud
          - MYSQL_PASSWORD=Secure_Password
        ports:
          - "3306:3306"
        volumes:
          - "db:/var/lib/mysql"
        networks:
          - internal
        labels:
          - "traefik.enable=false"
    
    networks:
      web:
        external: true
      internal:
        external: false
    
    

    start: docker-compose up

    start as deamon: docker-compose up -d

    stop: docker-compose down