HowTo: Ubuntu + Docker + Nextcloud + Talk + Collabora

Thanks for this, it made the installation so simple !

I just had a little error when trying to run docker-compose.
He didn’t like the “” in services.nextcloud.ports and services.collabora.ports
Removed it and it worked

2 Likes

Huh. I’m not sure how that set of funny quotes got in there. Anyway, glad you found it helpful.

I’m getting error on setting up collabora. I followed exactly all the steps except 5.4.Adding Features & 6.2.Running OCC. I think these are not necessary. I tried with port also :9980 but not working.

@pravin Ok, please start your own thread for troubleshooting and make sure to post your Apache and Docker configs.

i have found this recipe here that seems to do the job: https://geek-cookbook.funkypenguin.co.nz/recipes/collabora-online/

–> it is pretty complex i know, but if you can hold on till the end it is worth it.

The only drawback seems to be that the default TCP port from collabora needs to stay open for http traffic on the hosting server, which could potentially expose security risks.

If you find any workaround to that please let me know.

This is the most complete resource I’ve yet come across for setting up Nextcloud in a Docker container. Thank you @KarlF12! I’ve used it as the basis for my own docker-compose.yml to set up Nextcloud which, at the time of writing this post, is at version 19.0.1.

version: '3.7'

networks:
  nextcloud:

services:
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    networks:
      - nextcloud
    ports:
      - 8000:80
    volumes:
      - ${NEXTCLOUD_ROOT}/html:/var/www/html
      - ${NEXTCLOUD_ROOT}/apps:/var/www/html/custom_apps
      - ${NEXTCLOUD_ROOT}/config:/var/www/html/config
      - ${NEXTCLOUD_ROOT}/files:/svr/nextcloud/data
      - ${NEXTCLOUD_ROOT}/themes:/var/www/html/themes
#    extra_hosts:
#      - ${NEXTCLOUD_FQDN}:${NEXTCLOUD_IPADDRESS}
    depends_on:
      - mariadb
      - redis
    environment:
#      - NEXTCLOUD_TRUSTED_DOMAINS='${NEXTCLOUD_FQDN}'
      - NEXTCLOUD_DATA_DIR=/svr/nextcloud/data
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_HOST=nextcloud-mariadb
      - REDIS_HOST=nextcloud-redis
      - TZ=Australia/Perth
      - REDIS_HOST_PASSWORD=${REDIS_PASSWORD}
    restart: unless-stopped

  mariadb:
    image: mariadb
    container_name: nextcloud-mariadb
    volumes:
      - ${NEXTCLOUD_ROOT}/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=nextcloud-mariadb
      - TZ=Australia/Perth
    networks:
      - nextcloud
    restart: unless-stopped

  redis:
    image: redis
    container_name: nextcloud-redis
    command: redis-server --requirepass ${REDIS_PASSWORD}
    networks:
      - nextcloud
    restart: unless-stopped

The main difference is, it now seems that Redis password authentication is a requirement, otherwise, the following errors appear in logs:

The clue was in this thread [SOLVED] Latest Docker image broke the installation (Redis password auth)

My question is around the bits of the compose file that I’ve commented out.

  1. I’m not sure of the value of the extra_hosts: key. I’ve not noticed any visible difference by removing it.

  2. Autoconfiguration using the environment variable NEXTCLOUD_TRUSTED_DOMAINS does not appear to work. A check of the trusted_domains array in config.php confirms this.

Would you care to comment on these points please?

1 Like

Sure, I’m glad my time put into this is going to good use.

What this does is basically adds a value to the container‘s hosts file. In my setup, I needed Nextcloud and Collabora to go through my reverse proxy for the valid certificate, and so I did this to ensure they connect to the correct IP address. I had problems with Collabora until I added this. Whether it’s needed probably depends on the exact setup and your DNS.

https://docs.docker.com/compose/compose-file/#extra_hosts

This is a documented option, so as far as I’m aware, it should work. Could be a bug.

https://github.com/docker-library/docs/blob/master/nextcloud/README.md#auto-configuration-via-environment-variables

2 Likes

Hi, thanks for that turorial.
One question, in nextcloud settings there are same errors about background jobs… (not execuded days ago)
It is possible to run Cron jobs with this tutorial?

Yes. If you need cron support, you will have to adjust the Nextcloud container configuration to build instead of pull. You can find instructions and examples here: https://github.com/nextcloud/docker#adding-features

Basically what you’ll do is download two files into the folder where you have docker-compose.yml which are Dockerfile and supervisord.conf. These two files are found in the examples folder at the link above.

Then on your docker-compose.yml nextcloud container config, you’ll replace the image line with build: .. This makes Docker download an image and modify it according to the instructions in Dockerfile.

When you update now instead of just running docker-compose pull and docker-compose up -d you will also first run docker-compose build --pull to update the base image and re-modify it again. The build process is completely hands-off, you just have to trigger it.

It sounds like a lot, but it’s actually pretty easy.

So when I did the docker-compose it gives me an error of “services.callabora.ports contains invalid type”. I have messed with the formatting and it still not works. Is there something I am missing?

Most likely a typo. Can you show what you have?

Here is a copy of it:

version: '3.7'

networks:
 nextcloud:

services:
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    networks:
      - nextcloud
    ports:
      - "127.0.0.1:8080:80"
    volumes:
      - ${NEXTCLOUD_ROOT}/html:/var/www/html
      - ${NEXTCLOUD_ROOT}/data:/srv/nextcloud/data
    extra_hosts:
      - "${NEXTCLOUD_FQDN}:${NEXTCLOUD_IPADDRESS}"
      - "${COLLABORA_FQDN}:${NEXTCLOUD_IPADDRESS}"
    depends_on:
      - mariadb
      - redis
    environment:
      - NEXTCLOUD_TRUSTED_DOMAINS='${NEXTCLOUD_FQDN}'
      - NEXTCLOUD_DATA_DIR=/srv/nextcloud/data
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_HOST=nextcloud-mariadb
      - REDIS_HOST=nextcloud-redis
    restart: unless-stopped

  mariadb:
    image: mariadb
    container_name: nextcloud-mariadb
    restart: unless-stopped
    volumes:
      - ${NEXTCLOUD_ROOT}/mariadb:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_DATABASE=nextcloud
      -  MYSQL_USER=nextcloud
    networks:
      - nextcloud

  redis:
    image: redis
    container_name: nextcloud-redis
    networks:
      - nextcloud
    restart: unless-stopped

  coturn:
    image: instrumentisto/coturn
    container_name: nextcloud-coturn
    restart: unless-stopped
    ports:
      - "3478:3478/tcp"
      - "3478:3478/udp"
    networks:
      - nextcloud
    command:
      - -n
      - --log-file=stdout
      - --min-port=49160
      - --max-port=49200
      - --realm=${NEXTCLOUD_FQDN}
      - --use-auth-secret
      - --static-auth-secret=${COTURN_SECRET}

  collabora:
    image: collabora/code
    container_name: nextcloud-collabora
    restart: unless-stopped
    networks:
      - nextcloud
    ports:
      - “127.0.0.1:9980:9980”
    extra_hosts:
      - "${NEXTCLOUD_FQDN}:${NEXTCLOUD_IPADDRESS}"
      - "${COLLABORA_FQDN}:${NEXTCLOUD_IPADDRESS}"
    environment:
      - 'domain=${NEXTCLOUD_FQDN}'
      - 'dictionaries=en'
    cap_add:
      - MKNOD
    tty: true

Could send the file also if needed.
Thank you for the quick response

Try retyping the quotes around the port numbers here. If you look closely they aren’t like the rest. I see they’re like that in my original post, and I’m not sure how they got that way. Maybe had to do with editing the post from my phone at one point.

Yup that was the issue. Now I have completed the rest of it and I am getting the default webpage for apache2 for the office URL.

Check that the site name in the Apache config is correct and that you have that exact same name in the browser address bar.

To check that your site configs are loaded, you can run: sudo apachectl -S

The site name in the Apache config is correct and the command shows the configs are loaded.

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server cloud.mygood.url (/etc/apache2/sites-enabled/010-nextcloud.conf:1)
         port 80 namevhost cloud.mygood.url (/etc/apache2/sites-enabled/010-nextcloud.conf:1)
         port 80 namevhost office.mygood.url (/etc/apache2/sites-enabled/011-collabora.conf:1)
         port 80 namevhost Name (/etc/apache2/sites-enabled/999-catchall.conf:1)
*:443                  is a NameVirtualHost
         default server cloud.mygood.url (/etc/apache2/sites-enabled/010-nextcloud.conf:15)
         port 443 namevhost cloud.mygood.url (/etc/apache2/sites-enabled/010-nextcloud.conf:15)
         port 443 namevhost office.mygood.url (/etc/apache2/sites-enabled/011-collabora.conf:26)
         port 443 namevhost Name (/etc/apache2/sites-enabled/999-catchall.conf:7)

Hmm. It’s not jumping out to me. I see Apache has selected the wrong default site too. Could you start a new thread and post all the configs?

I have created a new thread it is this: https://help.nextcloud.com/t/help-with-collabora-webpage-showing-apache-default-page

Thank you

Hi Karlf12

Thank you for this instruction
I have a question for enabling the smb feature, I don’t understand what really need to add to Dockerfile
Can please post example file ? and what exactly commands to use
and the rebuild task will remove all my settings on the nextcloud ?

Thank you

@Efi_H Typically you can use the example Dockerfiles as they are.

https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/smb/apache