services:
  seafile-mysql:
    image: mariadb:10.11
    container_name: seafile-mysql
    ports:
      - "13306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=ROOT_PASSWORD
      - MYSQL_LOG_CONSOLE=true
      - MARIADB_AUTO_UPGRADE=1
    volumes:
      - /opt/seafile/database:/var/lib/mysql
    healthcheck:
      test:
        [
          "CMD",
          "/usr/local/bin/healthcheck.sh",
          "--connect",
          "--mariadbupgrade",
          "--innodb_initialized",
        ]
      interval: 20s
      start_period: 30s
      timeout: 5s
      retries: 10

  seafile-server:
    image: seafileltd/seafile-mc:12.0-latest
    container_name: seafile-server
    ports:
      - "8082:80"
    volumes:
      - /opt/seafile/server:/shared
      - /media/sync/seafile:/shared/seafile/seafile-data
    environment:
      - DB_HOST=seafile-mysql
      - DB_PORT=3306
      - DB_ROOT_PASSWD=ROOT_PASSWORD
      - DB_PASSWORD=PASSWORD
      - TIME_ZONE=Europe/Amsterdam
      - INIT_SEAFILE_ADMIN_EMAIL=admin@veenboer.xyz
      - INIT_SEAFILE_ADMIN_PASSWORD=asecret
      - SEAFILE_SERVER_HOSTNAME=seafile.rik.veenboer.xyz
      - SEAFILE_SERVER_PROTOCOL=https
      - JWT_PRIVATE_KEY=8LzWzeuQ41z1i8fc1cr1L7Kw80VpTgmT
    depends_on:
      - seafile-mysql
