[Collabora] Configuration with docker-compose

Hey,
I got it working! :smiley:

But I am now using a subdomain and ssl encryption, like the guides suggested. With the reverse proxy container I’m using it’s just much easier.

jwilder/nginx-proxy creates the reverse proxy configuration automatically. So I didn’t have to edit any config files. It’s all docker-compose :wink:.

I simply had to tell the reverse proxy to use a https backend and redirect the requests to the collabora port 9980 via environment variables. It’s even possible to use expose instead of ports so the collabora port is not public accessible on the host.

Combined with the letsencrypt-companion I don’t even have to worry about certificates.

Here my compose file:

version: '2'


services:
  proxy:
    image: jwilder/nginx-proxy
    container_name: proxy
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./proxy/conf.d:/etc/nginx/conf.d
      - ./proxy/vhost.d:/etc/nginx/vhost.d
      - ./proxy/html:/usr/share/nginx/html
      - ./proxy/certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - proxy-tier

  letsencrypt-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: letsencrypt-companion
    volumes_from:
      - proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./proxy/certs:/etc/nginx/certs:rw


  web:
    image: nginx
    container_name: nextcloud_webserver
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    links:
      - app
    volumes_from:
      - app
    environment:
      - VIRTUAL_HOST=<cloud.domain.tld>
      - VIRTUAL_NETWORK=nginx-proxy
      - VIRTUAL_PORT=80
      - LETSENCRYPT_HOST=<cloud.domain.tld>
      - LETSENCRYPT_EMAIL=<admin@domain.tld>
    networks:
      - proxy-tier


  app:
    image: indiehosters/nextcloud
    container_name: nextcloud_fpm
    links:
      - db
    volumes:
      - ./nextcloud/apps:/var/www/html/apps
      - ./nextcloud/config:/var/www/html/config
      - ./nextcloud/data:/var/www/html/data
    networks:
      - proxy-tier


  db:
    image: mariadb
    container_name: db
    volumes:
      - ./nextcloud/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=<password>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=<userpassword>
    networks:
      - proxy-tier

  redis:
    image: redis
    container_name: redis
    networks:
      - proxy-tier

  collabora:
    image: collabora/code
    container_name: collabora
    expose:
      - 9980
    cap_add:
      - MKNOD
    environment:
      - domain=<cloud.domain.tld>
      - VIRTUAL_HOST=<office.domain.tld>
      - VIRTUAL_NETWORK=nginx-proxy
      - VIRTUAL_PORT=9980
      - VIRTUAL_PROTO=https
      - LETSENCRYPT_HOST=<office.domain.tld>
      - LETSENCRYPT_EMAIL=<admin@domain.tld>
    networks:
      - proxy-tier


networks:
  proxy-tier:
    external:
      name: nginx-proxy
3 Likes