version: '2.0'
services:
  db:
    # Seafile does not support postgres :clown:
    image: mariadb:11
    environment:
      - MYSQL_ROOT_PASSWORD={{ seafile.db.password | mandatory }}
      - MYSQL_LOG_CONSOLE=true
    restart: unless-stopped
    volumes:
      - db_data:/var/lib/mysql
    networks:
      - backend
  memcached:
    image: memcached:latest
    entrypoint: memcached -m 256
    restart: unless-stopped
    networks:
      - backend
  seafile:
    image: seafileltd/seafile-mc:latest
    restart: unless-stopped
    volumes:
      - seafile_data:/shared
      - /dev/null:/var/log/nginx/access.log
      - /dev/null:/var/log/nginx/error.log
    security_opt:
      - "label:disable"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.seafile.rule=Host(`files.unruhig.eu`)"
      - "traefik.http.routers.seafile.entryPoints=websecure"
      - "traefik.http.routers.seafile.middlewares=deny-metrics@file"
      - "traefik.http.services.seafile.loadbalancer.server.port=80"
      # - "prometheus-scrape.enabled=true"
      # - "prometheus-scrape.port=8080"
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD={{ seafile.db.password | mandatory }}
      - TZ=Europe/Berlin
      - SEAFILE_ADMIN_EMAIL={{ seafile.admin.email | mandatory }}
      - SEAFILE_ADMIN_PASSWORD={{ seafile.admin.password | mandatory }}
      - SEAFILE_SERVER_LETSENCRYPT=false
      - SEAFILE_SERVER_HOSTNAME=files.unruhig.eu
    depends_on:
      - db
      - memcached
    networks:
      - backend
      - default # oidc

networks:
  backend:
volumes:
  seafile_data:
  db_data: