seafile mit docker hinter traefik

24 Januar 2024

seafile mit collabora als docker compose betreiben hinter traefik mit labels

docker compose

version: '2.0'
services:
  db:
    image: mariadb:10.5
    restart: always
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=CHANGEME!  # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /opt/seafile-mysql/db:/var/lib/mysql  # Requested, specifies the path to MySQL data persistent store.
    networks:
      - seafile-net

  memcached:
    image: memcached:1.6
    restart: always
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net

  seafile:
    image: seafileltd/seafile-mc:latest
    restart: always
    container_name: seafile
    hostname: seafile
    volumes:
      - /opt/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=CHANGEME!  # Requested, the value shuold be root's password of MySQL service.
      - TIME_ZONE=Europe/Berlin  # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - SEAFILE_ADMIN_EMAIL=mail@example.com # Specifies Seafile admin user, default is 'me@example.com'.
      - SEAFILE_ADMIN_PASSWORD=CHANGEME!     # Specifies Seafile admin password, default is 'asecret'.
      - SEAFILE_SERVER_LETSENCRYPT=false   # Whether to use https or not.
      - SEAFILE_SERVER_HOSTNAME=server.example.com # Specifies your host name if https is enabled.
    depends_on:
      - db
      - memcached
    labels:
        - traefik.enable=true
        - traefik.docker.network=traefik
        - traefik.http.routers.seafile.rule=Host(`seafile.mydomain.com`)
        - traefik.http.routers.seafile.entrypoints=web-secure
        - traefik.http.routers.seafile.tls=true
        - traefik.http.routers.seafile.service=seafile
        - traefik.http.middlewares.seafile.headers.SSLRedirect=true
        - traefik.http.services.seafile.loadbalancer.server.port=80
    networks:
      - traefik
      - seafile-net

  collabora:
    image: collabora/code
    restart: always
    container_name: collabora
    hostname: collabora
    privileged: true
    environment:
      - "TZ=Europe/Berlin"
#      - "extra_params=--o:ssl.enable=false"
      - "extra_params=--o:ssl.enable=false --o:ssl.termination=true"
      - "username=admin"
      - "password=CHANGEME!"
      - "aliasgroup1=https://seafile.mydomain.com"	# file-server
    cap_add:
      - MKNOD
    labels:
        - traefik.enable=true
        - traefik.docker.network=traefik
        - traefik.http.routers.collabora.entrypoints=web-secure
        - traefik.http.routers.collabora.tls=true
        - traefik.http.routers.collabora.service=collabora
        - traefik.http.middlewares.collabora.headers.SSLRedirect=true
        - traefik.http.services.collabora.loadbalancer.server.port=9980
        - "traefik.http.routers.collabora.rule=Host(`collabora.mydomain.com`)"	#collabora server
#        - traefik.http.routers.collabora.middlewares=default@file
    networks:
      - traefik
      - seafile-net

networks:
  seafile-net:
  traefik:
    external: true

seahub_settings.py

Datei /opt/seafile-data/seafile/conf/seahub_settings.py anpassen:

SERVICE_URL = "https://seafile.mydomain.com/"
CSRF_TRUSTED_ORIGINS = ["https://seafile.mydomain.com"]
[...]
TIME_ZONE = 'Europe/Berlin'
FILE_SERVER_ROOT = "https://seafile.mydomain.com/seafhttp"