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

  redis:
    image: ${SEAFILE_REDIS_IMAGE:-redis}
    container_name: seafile-redis
    restart: unless-stopped
    command:
      - /bin/sh
      - -c
      - redis-server --requirepass "$$REDIS_PASSWORD"
    environment:
      - REDIS_PASSWORD=${REDIS_PASSWORD:-}
    networks:
      - seafile-net
 
  memcached:
    image: memcached:1.6.18
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net
 
#  seasearch:  
#    image: ${SEASEARCH_IMAGE:-seafileltd/seasearch:latest}
#    container_name: seafile-seasearch  
#    volumes:  
#      - ${SS_DATA_PATH:-/opt/seasearch-data}:/opt/seasearch/data  
#    environment: 
#      - ZINC_FIRST_ADMIN_USER=${INIT_SS_ADMIN_USER:-}
#      - ZINC_FIRST_ADMIN_PASSWORD=${INIT_SS_ADMIN_PASSWORD:-}
#      - GIN_MODE=${GIN_MODE:-release}
#      - ZINC_WAL_ENABLE=${SS_WAL_ENABLE:-true}
#      - ZINC_STORAGE_TYPE=${SS_STORAGE_TYPE:-}
#      - ZINC_SHARD_NUM=${SS_SHARD_NUM:-}
#      - ZINC_MAX_OBJ_CACHE_SIZE=${SS_MAX_OBJ_CACHE_SIZE:-10GB}
#      - ZINC_S3_ACCESS_ID=${SS_S3_ACCESS_ID:-}
#      - ZINC_S3_USE_V4_SIGNATURE=${SS_S3_USE_V4_SIGNATURE:-false}
#      - ZINC_S3_ACCESS_SECRET=${SS_S3_ACCESS_SECRET:-}
#      - ZINC_S3_ENDPOINT=${SS_S3_ENDPOINT:-s3.us-east-1.amazonaws.com`}
#      - ZINC_S3_BUCKET=${SS_S3_BUCKET:-}
#      - ZINC_S3_USE_HTTPS=${SS_S3_USE_HTTPS:-true}
#      - ZINC_S3_PATH_STYLE_REQUEST=${SS_S3_PATH_STYLE_REQUEST:-true}
#      - ZINC_S3_AWS_REGION=${SS_S3_AWS_REGION:-us-east-1}
#      - ZINC_S3_SSE_C_KEY=${SS_S3_SSE_C_KEY:-}
#      - ZINC_SERVER_MODE=${SS_SERVER_MODE:-}
#      - ZINC_CLUSTER_ID=${SS_CLUSTER_ID:-}
#      - ZINC_ETCD_USERNAME=${SS_ETCD_USERNAME:-}
#      - ZINC_ETCD_PASSWORD=${SS_ETCD_PASSWORD:-}
#      - ZINC_CLUSTER_PROXY_LOG_DIR=${SS_CLUSTER_PROXY_LOG_DIR:-/opt/seasearch/data/log}
#      - ZINC_CLUSTER_PROXY_HOST=${SS_CLUSTER_PROXY_HOST:-0.0.0.0}
#      - ZINC_CLUSTER_PROXY_PORT=${SS_CLUSTER_PROXY_PORT:-4082}
#      - ZINC_ETCD_ENDPOINTS=${SS_ETCD_ENDPOINTS:-127.0.0.1:2379}
#      - ZINC_ETCD_PREFIX=${SS_ETCD_PREFIX:-/zinc}
#      - ZINC_MAX_DOCUMENT_SIZE=${SS_MAX_DOCUMENT_SIZE:-1m}
#      - ZINC_CLUSTER_MANAGER_ADDR=${SS_CLUSTER_MANAGER_ADDR:-127.0.0.1:4081}
#      - ZINC_CLUSTER_MANAGER_LOG_DIR=${SS_CLUSTER_MANAGER_LOG_DIR:-/opt/seasearch/data/log}
#      - ZINC_CLUSTER_MANAGER_HOST=${SS_CLUSTER_MANAGER_HOST:-0.0.0.0}
#      - ZINC_CLUSTER_MANAGER_PORT=${SS_CLUSTER_MANAGER_PORT:-4081}
#      - ZINC_CLUSTER_MANAGER_ETCD_ENDPOINTS=${SS_CLUSTER_MANAGER_ETCD_ENDPOINTS:-127.0.0.1:2379}
#      - ZINC_CLUSTER_MANAGER_ETCD_PREFIX=${SS_CLUSTER_MANAGER_ETCD_PREFIX:-/zinc}
#      - SS_LOG_TO_STDOUT=${SS_LOG_TO_STDOUT:-false}
#      - ZINC_LOG_OUTPUT=${SS_LOG_OUTPUT:-true}
#      - ZINC_LOG_DIR=${SS_LOG_DIR:-/opt/seasearch/data/log}
#      - ZINC_LOG_LEVEL=${SS_LOG_LEVEL:-debug}
#      - ZINC_PLUGIN_GSE_ENABLE = ${SS_PLUGIN_GSE_ENABLE:-false}
#      - ZINC_PLUGIN_GSE_DICT_EMBED = ${SS_PLUGIN_GSE_DICT_EMBED:-}
#      - ZINC_PLUGIN_GSE_DICT_PATH = ${SS_PLUGIN_GSE_DICT_PATH:-}
#    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:13.0.8
    container_name: seafile
    ports:
      - "8003:80"
    volumes:
      - /data/seafile/data:/shared
      - /data/seafile/deps/seafile-controller:/opt/seafile/seafile-pro-server-13.0.8/seafile/bin/seafile-controller
      - /data/seafile/deps/seaf-server:/opt/seafile/seafile-pro-server-13.0.8/seafile/bin/seaf-server
      - /data/seafile/deps/licenseparse.py:/opt/seafile/seafile-pro-server-13.0.8/seahub/seahub/utils/licenseparse.py
    environment:
      - INIT_SEAFILE_MYSQL_ROOT_PASSWORD=password
      - SEAFILE_MYSQL_DB_HOST=db
      - SEAFILE_MYSQL_DB_USER=seafile
      - SEAFILE_MYSQL_DB_PASSWORD=29329c6e-bac6-4f9f-b291-2dde90c79b3c
      - TIME_ZONE=Asia/Shanghai
      - SEAFILE_ADMIN_EMAIL=13609796771@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
      - CACHE_PROVIDER=${CACHE_PROVIDER:-redis}
      - REDIS_HOST=${REDIS_HOST:-redis}
      - REDIS_PORT=${REDIS_PORT:-6379}
      - REDIS_PASSWORD=${REDIS_PASSWORD:-}
      - 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
      - redis
    networks:
      - seafile-net

  seadoc:
    image: seafileltd/sdoc-server:2.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:
