I am trying to deploy Nextcloud using docker-compose, with Traefik acting as the reverse proxy and automatic LetsEncrypt TLS certificate installer. So far, the Nextcloud server itself and the certificate generation are all working smoothly. However, I am unable to get a Collabora server online. The docker-compose config file below brings up both Nextcloud and Collabora servers, and I can even visit the Collabora server URL at https://collabora.ups.example.com and see a valid TLS cert in my browser. Unfortunately the body of the page is “Bad Gateway”, which usually means something is not working at the reverse proxy level for connecting ports, but I cannot figure out how to correct the configuration. Any help would be appreciated.
version: '3'
networks:
web:
external: true
internal:
external: false
services:
reverse-proxy:
image: traefik:v2.0
container_name: traefik
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/traefik/traefik.yaml:/etc/traefik/traefik.yaml
- /opt/traefik/config.yaml:/etc/traefik/config.yaml
- /opt/traefik/acme.json:/etc/traefik/acme.json
networks:
- web
cloud_ups_example_com_db:
image: mariadb
container_name: cloud_ups_example_com_db
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- /opt/upscloud.example.com/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=57gCFuR4fTNCsQps
- MYSQL_PASSWORD=J34NnXeUNdoXWgLp
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
networks:
- internal
cloud_ups_example_com_app:
image: nextcloud
container_name: cloud_ups_example_com_app
restart: always
environment:
- VIRTUAL_HOST=upscloud.example.com
- MYSQL_HOST=cloud_ups_example_com_db
depends_on:
- cloud_ups_example_com_db
volumes:
- /opt/upscloud.example.com/www:/var/www/html
ports:
- "80"
networks:
- web
- internal
labels:
- "traefik.enable=true"
- "traefik.docker.network=web"
- "traefik.http.routers.cloud_ups_example_com_app-http.rule=Host(`upscloud.example.com`)"
- "traefik.http.routers.cloud_ups_example_com_app-http.entrypoints=http"
- "traefik.http.routers.cloud_ups_example_com_app-http.middlewares=default-http@file"
- "traefik.http.routers.cloud_ups_example_com_app.entrypoints=https"
- "traefik.http.routers.cloud_ups_example_com_app.rule=Host(`upscloud.example.com`)"
- "traefik.http.routers.cloud_ups_example_com_app.tls=true"
- "traefik.http.routers.cloud_ups_example_com_app.tls.certresolver=letsencrypt"
ups_collabora:
image: collabora/code
container_name: ups_collabora
networks:
- web
cap_add:
- MKNOD
expose:
- "9980"
environment:
- domain=upscloud.example.com
- username=admin
- password=password
- VIRTUAL_PROTO=http
- VIRTUAL_PORT=9980
- VIRTUAL_HOST=collabora.ups.example.com
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.docker.network=web"
- "traefik.http.routers.ups_collabora-http.rule=Host(`collabora.ups.example.com`)"
- "traefik.http.routers.ups_collabora-http.entrypoints=http"
- "traefik.http.routers.ups_collabora-http.middlewares=default-http@file"
- "traefik.http.routers.ups_collabora.entrypoints=https"
- "traefik.http.routers.ups_collabora.rule=Host(`collabora.ups.example.com`)"
- "traefik.http.routers.ups_collabora.tls=true"
- "traefik.http.routers.ups_collabora.tls.certresolver=letsencrypt"