So, I’ve been trying to adopt a more modular system and learn docker a bit further. So I’m trying to setup a Collabora instance through my docker compose as opposed to just using the built in CODE server, and this is what I have so far:
traefik:
# The official v2 Traefik docker image
image: traefik:v2.9
container_name: traefik
# Enables the web UI and tells Traefik to listen to docker
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker.network=traefik-public"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.dnschallenge=true"
- "--certificatesresolvers.myresolver.acme.dnschallenge.provider=digitalocean"
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=soulfire@example.tld"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
# The HTTP port
- "80:80"
- "443:443"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
- ./letsencrypt:/letsencrypt
environment:
- DO_AUTH_TOKEN=${DO_AUTH_TOKEN}
networks:
- traefik-public
nextcloud:
container_name: nextcloud
restart: unless-stopped
volumes:
- nextcloud:/var/www/html
- nextcloud-config:/var/www/html/config
# Storage location for apps installed from GUI, CLI, etc.
- nextcloud-apps:/var/www/html/custom_apps
# Bind for DigitalOcean block storage, stores user files
- ../mnt/nextcloud/:/var/www/html/data
depends_on:
- db
- redis
build: ./nextcloud
environment:
# The Nextcloud administrator username
NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER}
# The Nextcloud administrator password
NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD}
NEXTCLOUD_UPDATES: 1
# MySQL credentials
MYSQL_DATABASE: "nextcloud"
MYSQL_USER: "nextcloud"
MYSQL_PASSWORD: ${NEXTCLOUD_MYSQL_PASSWORD}
MYSQL_HOST: "db:3306"
# SMTP Settings
# TODO: Figure out why Nextcloud isn't accepting these
SMTP_NAME: "nextcloud"
SMTP_AUTH_TYPE: "LOGIN"
SMTP_PASSWORD: ${NEXTCLOUD_MAIL_PASSWORD}
SMTP_PORT: 465
MAIL_FROM_ADDRESS: "nextcloud@example.tld"
MAIL_DOMAIN: "example.tld"
OVERWRITECLIURL: "https://drive.example.tld"
PHP_UPLOAD_LIMIT: 2048M
REDIS_HOST: redis
networks:
- nextcloud
- mariadb
- redis
- traefik-public
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-public"
- "traefik.http.routers.nextcloud.entrypoints=websecure"
- "traefik.http.routers.nextcloud.rule=Host(`drive.example.tld`)"
- "traefik.http.routers.nextcloud.tls=true"
- "traefik.http.routers.nextcloud.tls.certresolver=myresolver"
# - "traefik.http.routers.nextcloud.middlewares=nextcloud-dav,secHeaders@file"
- "traefik.http.middlewares.nextcloud-dav.replacepathregex.regex=^/.well-known/ca(l|rd)dav"
- "traefik.http.middlewares.nextcloud-dav.replacepathregex.replacement=/remote.php/dav/"
- "traefik.http.services.nextcloud.loadbalancer.server.port=80"
nextcloud-cron:
build: ./nextcloud
container_name: nextcloud-cron
restart: always
volumes:
- nextcloud:/var/www/html
entrypoint: /cron.sh
depends_on:
- db
- redis
nextcloud-office:
container_name: collabora
image: collabora/code:latest
environment:
- "domain=office\\.example\\.tld"
- username=${COLLABORA_USERNAME}
- password=${COLLABORA_PASSWORD}
- "extra_params=--o:ssl.enable=false --o:ssl.termination=true"
- server_name=collabora
depends_on:
- nextcloud
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
networks:
- nextcloud
- traefik-public
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-public"
- "traefik.http.middlewares.redirect-https.redirectScheme.scheme=https"
- "traefik.http.middlewares.redirect-https.redirectScheme.permanent=true"
- "traefik.http.routers.collabora.tls.certresolver=myresolver"
- "traefik.http.routers.collabora.rule=Host(`office.example.tld`)"
- "traefik.http.routers.collabora.entrypoints=websecure"
- "traefik.http.routers.collabora.tls=true"
- "traefik.http.routers.collabora.service=collabora"
- "traefik.http.routers.collabora-http.rule=Host(`office.example.tld`)"
- "traefik.http.routers.collabora-http.entrypoints=web"
- "traefik.http.routers.collabora-http.middlewares=redirect-https"
- "traefik.http.routers.collabora-http.service=collabora"
- "traefik.http.services.collabora.loadbalancer.server.port=9980"
Nextcloud can fully detect Collabora, and gives the approved icon. And going to the instance URL office.example.com gives the result OK
in plain text. However, whenever I try to open a file, the page goes blank. Despite there being nothing within the logs of either, when looking through the network logs across firefox, I keep noticing a POST request to collabora
instead of office.example.com
this is the full request:
{
"POST": {
"scheme": "https",
"host": "collabora",
"filename": "/browser/bcbca64/cool.html",
"query": {
"WOPISrc": "https://drive.jarexibackblaze.xyz/index.php/apps/richdocuments/wopi/files/5045_ocifuo7xuyf6",
"title": "example file.odt",
"lang": "en",
"closebutton": "1",
"revisionhistory": "1"
}
}
}
I wondered if this had to do with Nextcloud and Collabora being on the same network, but I just removed Collabora from the nextcloud network and cleared my browsers site data for the instance. But this didn’t seem to do anything. If anyone could please point out any potential mistakes that I might have made, It would be kindly appreciated. Thank you