Nexcloud deployment by Docker-compose

Hello guys, this is my first contribution to the community, hope it can be useful to you.

I’m been working at a little statement done in docker-compose file, where I used the following images:

Diagram:

Below the Docker-compose.yml:

# for more information you can see the github pull below
# link: https://github.com/nextcloud/docker/pull/630/files

version: '3.8'

services:

  proxy:
    image: jwilder/nginx-proxy:alpine
    labels:
      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
    container_name: nextcloud-proxy
    networks:
      - nextcloud_network
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./proxy/conf.d:/etc/nginx/conf.d:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - ./proxy/certs:/etc/nginx/certs:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    restart: unless-stopped

  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: nextcloud-letsencrypt
    depends_on:
      - proxy
    networks:
      - nextcloud_network
    volumes:
      - ./proxy/certs:/etc/nginx/certs:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped

  db:
    image: mariadb
    container_name: nextcloud-mariadb
    networks:
      - nextcloud_network
    volumes:
      - db:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_PASSWORD=mypassword
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    restart: unless-stopped

  app:
    image: nextcloud:latest
    container_name: nextcloud-app
    networks:
      - nextcloud_network
    depends_on:
      - letsencrypt
      - proxy
      - db
    volumes:
      - nextcloud:/var/www/html
      - ./app/config:/var/www/html/config
      - ./app/custom_apps:/var/www/html/custom_apps
      - ./app/data:/var/www/html/data
      - ./app/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
    environment:
      - VIRTUAL_HOST=app.domain.com
      - LETSENCRYPT_HOST=app.domain.com
      - LETSENCRYPT_EMAIL=example@com.com
    restart: unless-stopped

  collabora:
    image: collabora/code
    container_name: collabora
    cap_add:
      - MKNOD
    environment:
      - domain=example\\.domain\\.com
      - VIRTUAL_HOST=offices.ydns.eu
      - VIRTUAL_NETWORK=nginx-proxy
      - extra_params=--o:ssl.enable=false --o:ssl.termination=true
      - LETSENCRYPT_HOST=offices.domain.com
      - LETSENCRYPT_EMAIL=example@com.com
      - username=admin
      - password=collabora
    networks:
      - nextcloud_network
    restart: unless-stopped

volumes:
  nextcloud:
  db:

networks:
  nextcloud_network:
1 Like

I’m using this configuration minus collabra and let’s encrypt (I have my own purchased SSL), but when I try to use jwilder’s docker image, I get “ERR_TOO_MANY_REDIRECTS” when trying to load the page. Otherwise as far as I can tell I’ve got the same setup as you. Do you know why this could be?

Why do you have port 9980 expose in the configuration file? I assume VIRTUAL_NETWORK=nginx-proxy is used to have Collabora and NGINX in the same network. Containers on the same network have all ports exposed to each other. I also assume ssl.termination=true means that that Collabora is being told it is behind a reverse proxy and ssl.enable=false means use http instead of https.

Hi @BobbyWaz try to delete the label, it just needed when you use letsencrypt container, I used it by the following Readme. I haven’t gotten that error before, however I saw something that you can check out: err_too_many_redirects and also here. Good luck :grinning:

Hi @Ryu945 I uploaded the right .yml no expose port needed :grinning: regarding the ssl declaration I set the http communication at backend, however that is something I need to switch to https, you’re right about it; more over here

I tried this and it says.

“Hmm. We’re having trouble finding that site.”

Thanks for this Docker-Compose script!

I am pretty new to YAML and docker compose, what variables should be changed for my environment?

Also, I saw:

- VIRTUAL_HOST=offices.ydns.eu

in the code… Should that be there or should it be something like offices.example.com?
Two places show offices.DOMAIN.TLD instead of office.DOMAIN.TLD, is this correct?

Hello,

Indeed, I use that virtual host from my enviroment, so you have to change it in order to deploy your collabora app. Both of them pointed to that domain.

- LETSENCRYPT_HOST=offices.example.com
- VIRTUAL_HOST=offices.example.com

happy to know that my yml file it useful :slight_smile: