version: '3.0'
services:
  db:
    image: mariadb:10.11
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=password  # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /data/seafile/db:/var/lib/mysql  # Requested, specifies the path to MySQL data persistent store.
    networks:
      - seafile-net
    healthcheck:
      test:
        [
          "CMD",
          "/usr/local/bin/healthcheck.sh",
          "--connect",
          "--mariadbupgrade",
          "--innodb_initialized",
        ]
      interval: 20s
      start_period: 30s
      timeout: 5s
      retries: 10
 
  memcached:
    image: memcached:1.6.18
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net

  elasticsearch:
    image: elasticsearch:8.15.0
    container_name: elasticsearch
    environment:
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
      - "xpack.security.enabled=false"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 2g
    volumes:
      - /data/seafile/elasticsearch:/usr/share/elasticsearch/data
    networks:
      - seafile-net
 
  seafile:
    image: seafileltd/seafile-pro-mc:12.0.13
    container_name: seafile
    ports:
      - "8003:80"
    volumes:
      - /data/seafile/data:/shared

    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=password
      - TIME_ZONE=Asia/Shanghai
      - SEAFILE_ADMIN_EMAIL=13600006771@139.com
      - SEAFILE_ADMIN_PASSWORD=password
      - SEAFILE_SERVER_LETSENCRYPT=false
      - SEAFILE_SERVER_HOSTNAME=192.168.182.53:8003
      - SEAFILE_MYSQL_DB_CCNET_DB_NAME=ccnet_db
      - SEAFILE_MYSQL_DB_SEAFILE_DB_NAME=seafile_db
      - SEAFILE_MYSQL_DB_SEAHUB_DB_NAME=seahub_db
      - SEAFILE_SERVER_PROTOCOL=http
      - NON_ROOT=false
      - SEAFILE_ELASTICSEARCH_VOLUME=/data/seafile/elasticsearch
      - JWT_PRIVATE_KEY=0mucRqrGg4/wC+X7bXxccTpUJdz+ySP3FyhrjCR0k5FVyOOqilk4aYfHVWQKx825
      - ENABLE_SEADOC=true
      - SEADOC_SERVER_URL=http://192.168.182.53:8003/sdoc-server
    depends_on:
      - db
      - memcached
      - elasticsearch
    networks:
      - seafile-net

  seadoc:
    image: seafileltd/sdoc-server:1.0-latest
    container_name: seadoc
    volumes:
      - /data/seafile/seadoc-data:/shared
    ports:
      - "7070:80"
    environment:
      - DB_HOST=db
      - DB_PORT=3306
      - DB_USER=seafile
      - DB_PASSWORD=29329c6e-bac6-4f9f-b291-2dde90c79b3c
      - DB_NAME=seahub_db
      - TIME_ZONE=Asia/Shanghai
      - NON_ROOT=false
      - JWT_PRIVATE_KEY=0mucRqrGg4/wC+X7bXxccTpUJdz+ySP3FyhrjCR0k5FVyOOqilk4aYfHVWQKx825
      - SEAHUB_SERVICE_URL=http://192.168.182.53:8003
    networks:
      - seafile-net

networks:
  seafile-net:
