1. 简介

Seafile 12.06 相比之前的版本主要是集成了 seadoc 和 在线 wiki 的功能,另外针对 UI 界面也作了调整。和版本 11 相比有以下的调整

  • SERVICE_URL FILE_SERVER_ROOT 都被移除,使用 SEAFILE_SERVER_PROTOCOL 和 SEAFILE_SERVER_HOSTNAME 参数代替。SEAFILE_SERVER_PROTOCOL 和 SEAFILE_SERVER_HOSTNAME 在 .env 和 Yaml 配置文件中配置,可以使用 SEAFILE_SERVER_HOSTNAME = 192.168.182.53:8003 这样带端口的方式设置
  • ccnet.conf 配置文件被移除,一些配置参数被删除,可使用的参数可以在 seafile.conf 文件配置
  • 取消了 USER_PASSWORD_MIN_LENGTH, USER_PASSWORD_STRENGTH_LEVEL 参数,只有 USER_STRONG_PASSWORD_REQUIRED 仍可使用
  • 取消了 ADDITIONAL_APP_BOTTOM_LINKS 参数

2. seafile-pro-12.06

2.1. .env

COMPOSE_FILE='seafile.yml'

SEAFILE_IMAGE=seafileltd/seafile-pro-mc:12.0-latest
SEAFILE_DB_IMAGE=mariadb:10.11
SEAFILE_MEMCACHED_IMAGE=memcached:1.6.29
SEAFILE_ELASTICSEARCH_IMAGE=elasticsearch:8.15.0
#SEAFILE_CADDY_IMAGE=lucaslorentz/caddy-docker-proxy:2.9

SEAFILE_VOLUME=/data/seafile/data
SEAFILE_MYSQL_VOLUME=/data/seafile/db
SEAFILE_ELASTICSEARCH_VOLUME=/data/seafile/elasticsearch
#SEAFILE_CADDY_VOLUME=/opt/seafile-caddy

SEAFILE_MYSQL_DB_HOST=db
INIT_SEAFILE_MYSQL_ROOT_PASSWORD=password
SEAFILE_MYSQL_DB_USER=seafile
SEAFILE_MYSQL_DB_PASSWORD=29329c6e-bac6-4f9f-b291-2dde90c79b3c

TIME_ZONE=Asia/Shanghai

JWT_PRIVATE_KEY=0mucRqrGg4/wC+X7bXxccTpUJdz+ySP3FyhrjCR0k5FVyOOqilk4aYfHVWQKx825

SEAFILE_SERVER_HOSTNAME=192.168.182.53:8003
SEAFILE_SERVER_PROTOCOL=http

INIT_SEAFILE_ADMIN_EMAIL=136771@139.com
INIT_SEAFILE_ADMIN_PASSWORD=password
INIT_S3_STORAGE_BACKEND_CONFIG=false
INIT_S3_COMMIT_BUCKET=<your-commit-objects>
INIT_S3_FS_BUCKET=<your-fs-objects>
INIT_S3_BLOCK_BUCKET=<your-block-objects>
INIT_S3_KEY_ID=<your-key-id>
INIT_S3_SECRET_KEY=<your-secret-key>
INIT_S3_USE_V4_SIGNATURE=true
INIT_S3_AWS_REGION=us-east-1
INIT_S3_HOST=s3.us-east-1.amazonaws.com
INIT_S3_USE_HTTPS=true

SEADOC_IMAGE=seafileltd/sdoc-server:1.0-latest
SEADOC_VOLUME=/data/seafile/seadoc-data

ENABLE_SEADOC=true
SEADOC_SERVER_URL=http://192.168.182.53:8003/sdoc-server

NOTIFICATION_SERVER_IMAGE=seafileltd/notification-server:12.0-latest
NOTIFICATION_SERVER_VOLUME=/data/seafile/notification-data

2.2. seafile_12.yml

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-latest
    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=136771@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:

2.3. seafile.nginx.conf

# -*- mode: nginx -*-
# Auto generated at 11/21/2024 17:50:20
server {
listen 80;
server_name 192.168.182.53;
    client_max_body_size 10m;
    location / {
        proxy_pass http://127.0.0.1:8000/;
        proxy_read_timeout 310s;
        proxy_set_header Host $http_host;
        proxy_set_header Forwarded "for=$remote_addr;proto=$scheme";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Connection "";
        proxy_http_version 1.1;

        client_max_body_size 0;
        access_log      /var/log/nginx/seahub.access.log seafileformat;
        error_log       /var/log/nginx/seahub.error.log;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        client_max_body_size 0;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_request_buffering off;
        access_log      /var/log/nginx/seafhttp.access.log seafileformat;
        error_log       /var/log/nginx/seafhttp.error.log;
    }

    location /notification/ping {
        proxy_pass http://127.0.0.1:8083/ping;
        access_log      /var/log/nginx/notification.access.log seafileformat;
        error_log       /var/log/nginx/notification.error.log;
    }

    location /notification {
        proxy_pass http://127.0.0.1:8083/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        access_log      /var/log/nginx/notification.access.log seafileformat;
        error_log       /var/log/nginx/notification.error.log;
    }

    location /seafdav {
        proxy_pass         http://127.0.0.1:8080;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_read_timeout  1200s;
        client_max_body_size 0;

        access_log      /var/log/nginx/seafdav.access.log seafileformat;
        error_log       /var/log/nginx/seafdav.error.log;
    }

location /sdoc-server/ {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
        add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
        if ($request_method = 'OPTIONS') {
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
            add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
            return 204;
        }
        proxy_pass         http://seadoc:80/;
        proxy_redirect     off;
        proxy_set_header   Host              $host;
        proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host  $server_name;
        proxy_set_header   X-Forwarded-Proto $scheme;
        client_max_body_size 100m;
        access_log      /var/log/nginx/seadoc.access.log seafileformat;
        error_log       /var/log/nginx/seadoc.error.log;
    }

    location /socket.io {
        proxy_pass http://seadoc:80;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_redirect off;
        proxy_buffers 8 32k;
        proxy_buffer_size 64k;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
    }

    location /media {
        root /opt/seafile/seafile-server-latest/seahub;
    }
}

2.4. seafile.conf

[fileserver]
port = 8082

[database]
type = mysql
host = db
port = 3306
user = seafile
password = 29329c6e-bac6-4f9f-b291-2dde90c79b3c
db_name = seafile_db
connection_charset = utf8

[notification]
enabled = false
host = 127.0.0.1
port = 8083
log_level = info
jwt_private_key = vc1)!4s-e*_d=3yoz9!v$_enb3=vsfq!0f4$0djhu6($ln()o

2.5. seafevent.conf

[DATABASE]
type = mysql
host = db
port = 3306
username = seafile
password = 29329c6e-bac6-4f9f-b291-2dde90c79b3c
name = seahub_db

[SEAHUB EMAIL]
enabled = true

## interval of sending Seahub email. Can be s(seconds), m(minutes), h(hours), d(days)
interval = 30m

# Enable statistics
[STATISTICS]
enabled=true

[AUDIT]
enabled = true

[INDEX FILES]
external_es_server = true
es_host = elasticsearch
es_port = 9200
enabled = true
interval = 10m

highlight = fvh

## If true, indexes the contents of office/pdf files while updating search index
## Note: If you change this option from "false" to "true", then you need to clear the search index and update the index again. See the FAQ for details.
index_office_pdf = true

# Enable file history
[FILE HISTORY]
enabled = true
suffix = md,txt,doc,docx,xls,xlsx,ppt,pptx,sdoc

2.6. seahub_setting.py

# -*- coding: utf-8 -*-
SECRET_KEY = "g0*tgjoek5@&wzb^fz8l0gm%a8_n38pv78x$qqbywadvl91@1^"

ENABLE_SEADOC = True
SEADOC_PRIVATE_KEY = 'fc-nfb4#y2810@gj8s^hv5z)fpw(+!^wkq6zee+ew1c$&yq(n+'
SEADOC_SERVER_URL = 'http://192.168.182.53:8003/sdoc-server'
#FILE_CONVERTER_SERVER_URL = 'http://sdoc-server:8888'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub_db',
        'USER': 'seafile',
        'PASSWORD': '29329c6e-bac6-4f9f-b291-2dde90c79b3c',
        'HOST': 'db',
        'PORT': '3306',
        'OPTIONS': {'charset': 'utf8mb4'},
        'CONN_MAX_AGE': 60,
        'POOL_SIZE': 5,
    }
}

CACHES = {
    'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
        'LOCATION': 'memcached:11211',
    },
    'locmem': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    },
}
COMPRESS_CACHE_BACKEND = 'locmem'
TIME_ZONE = 'Asia/Shanghai'

3. 扩展功能

3.1. onlyoffice

3.1.1. anyoffice_9.yml

---
services:
  onlyoffice:
    image: onlyoffice/documentserver:8.2.2.1
    restart: unless-stopped
    container_name: seafile-onlyoffice
    ports:
      - "6234:80"
    volumes:
      - /data/onlyoffice/logs:/var/log/onlyoffice
      - /data/onlyoffice/data:/var/www/onlyoffice/Data
      - /data/onlyoffice/lib:/var/lib/onlyoffice
      - /data/onlyoffice/local-production-linux.json:/etc/onlyoffice/documentserver/local-production-linux.json
    environment:
      - JWT_ENABLED=true
      - JWT_SECRET=0mucRqrGg4/wC+X7bXxccTpUJdz+ySP3FyhrjCR0k5FVyOOqilk4aYfHVWQKx825
      - TIME_ZONE=Asia/Shanghai
    networks:
      - seafile-net
 
 
networks:
  seafile-net:
    name: seafile-net

3.1.2. local-production-linux.json

该文件用来设置在线文件打开后自动保存

{
  "services": {
    "CoAuthoring": {
      "autoAssembly": {
        "enable": true,
        "interval": "5m"
      }
    }
  },
  "FileConverter": {
    "converter": {
      "downloadAttemptMaxCount": 3
    }
  }
}

3.1.3. seahub_setting.py

ENABLE_ONLYOFFICE = True
ONLYOFFICE_APIJS_URL = 'http://192.168.182.52:6234/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods', 'csv', 'ppsx', 'pps')
ONLYOFFICE_JWT_SECRET = '0mucRqrGg4/wC+X7bXxccTpUJdz+ySP3FyhrjCR0k5FVyOOqilk4aYfHVWQKx825'

4.

5. 常见问题处理

5.1. 配置参考

https://manual.seafile.com/11.0/deploy_pro/details_about_file_search/

5.2. 数据库出现“[Warning] Aborted connection” 警告

2025-01-06  6:08:43 1457 [Warning] Aborted connection 1457 to db: 'seahub_db' user: 'seafile' host: '172.18.0.6' (Got an error reading communication packets)

http://dev.mysql.com/doc/refman/4.1/ja/communication-errors.html

show status like '%Aborted_clients%' ;
show global variables like '%net_read_timeout%' ;
show global variables like '%net_write_timeout%' ;
show global variables like '%warn%' ;

set global net_read_timeout = 60 ; #默认为30
set global net_write_timeout = 120 ; #默认为60

修改 seahub_settings.py 文件增加以下内容

5.3. 数据库由 10.06 升级为 10.11 版本后的出错

2025-01-06  1:06:48 12950 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).
seafile-mysql          | 2025-01-06  1:06:50 12950 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').

ALTER TABLE mysql.column_stats MODIFY histogram longblob;
ALTER TABLE mysql.column_stats MODIFY hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB');

5.4. 搜索功能未生效

 web 界面的搜索栏中输入的搜索内容不生效

1、elasticsearch 的配置文件中增加    - "xpack.security.enabled=false" 配置选型

2、执行 /opt/seafile/seafile-pro-server-12.0.6/pro/pro.py search --update 更新搜索索引

5.5. 解除最大同步文件数量限制

Seafile.conf 文件中修改或添加以下内容

[fileserver]
port = 8082
max_sync_file_count = -1
fs_id_list_request_timeout = -1

check_virus_on_web_upload = false

5.6. 删除 SERVICE_URL 设置

use seahub-db;
delete from constance_config where constance_key in ("SERVICE_URL", "FILE_SERVER_ROOT");

5.7. 数据库版本升级

数据库版本从 10.6 升级到 10.6.11 时出现 “MariaDB upgrade (mariadb-upgrade) required, but skipped due to $MARIADB_AUTO_UPGRADE setting” 警告。

docker exec -u 0 -it seafile-mysql /bin/bash
mysql_upgrade --user=root --password=xxyy --host=localhost

5.8. 避免小文件特别多的文件夹同步

官方原来强调过 Seafile 不适合用来同步 Git 仓库,因为 Seafile 采用文件分块存储机制,将文件拆分成多个小块进行存储,因此可能会破坏这些元数据的完整性,同时也有同步机制的冲突,缺乏针对 Git 的优化,导致同步 Git 仓库出现问题。同理 node_modules 、vendor 之类的目录通常包含大量小文件,Seafile 在同步大量文件时可能会遇到性能问题,导致同步速度变慢,甚至出现错误。

所以添加 Seafile-ignore.txt,同步时根据规则排除指定的文件和文件夹,只在客户端生效,以下是的 coding 文件夹在用的列表,供参考。

# Seafile-ignore.txt
Desktop.ini
*/Desktop.ini
.sync/
*/.sync/
Icon?
*/Icon?
.git/
*/.git/
# OS generated files #
$RECYCLE.BIN/
*/$RECYCLE.BIN/
System Volume Information/
*/System Volume Information/
ehthumbs.db
*/ehthumbs.db
desktop.ini
*/desktop.ini
Thumbs.db
*/Thumbs.db
lost+found/
*/lost+found/
.DocumentRevisions-V100/
*/.DocumentRevisions-V100/
.TemporaryItems/
*/.TemporaryItems/
.fseventsd/
*/.fseventsd/
.iCloud/
*/.iCloud/
.DS_Store
*/.DS_Store
.DS_Store?
*/.DS_Store?
.Spotlight-V100/
*/.Spotlight-V100/
.Trashes/
*/.Trashes/
.Trash-*/
*/.Trash-*/
*.swn
*.swp
*.swo
*.crdownload
.@__thumb/
.thumbnails/
*/.thumbnails/
*.tmp/
*/*.tmp/
*.tmp.chck
*.tmp.chck/
.dropbox/
.dropbox.attr/
.dropbox.cache/
.streams/
.caches/
*/.caches/
.Statuses/
.teamdrive/
.SynologyWorkingDirectory/
@eaDir/
@SynoResource/
DfsrPrivate/
.UTSystemConfig/
*/.UTSystemConfig/
.rqd/
._sync_*.db*
.sync_*.db*
.csync_journal.db*
.owncloudsync.log*
.test/
*/.test/
.idea/
*/.idea/
node_modules/
*/node_modules/
vendor/
*/vendor/
GolangProjects/src/pkg/
GolangProjects/pkg/
GolangProjects/bin/
GolangProjects/test/
*/.vscode/
*/dist/
*/unpackage/
*/__pycache__/
www/rageframe2/backend/runtime/debug
www/rageframe2/web/backend/assets

5.9. 禁止显示 seadoc 的知识库及对应的图标

添加以下的 css 到定制 css 中

a.nav-link.ellipsis[title="知识库"][href="/published/"] {
  display: none;
}

.side-panel-folded a.nav-link[href="/published/"]:has( > #main-side-nav-folded-wikis ) {
  display: none;
}


  • No labels

7 Comments

  1. Anonymous

    您好,我这边用文档的seafile12 yml文件跑下来提示yaml: line 41: did not find expected key,请问是文件少了一些配置吗

    1. Anonymous

      yml格式不正确,找个格式化工具检查

  2. 虚拟的现实

    估计是有些空格、回车换行之类的格式化在复制粘贴的时候存在差异

  3. Anonymous

    请问seahub_setting.py中 SEADOC_PRIVATE_KEY = 'fc-nfb4#y2810@gj8s^hv5z)fpw(+!^wkq6zee+ew1c$&yq(n+',这个密钥是从哪里找来的呢?官方说法是seadoc_converter_settings.py文件中,可是这个文件找不到,后来又看官方有人说从12版本开始不使用这个配置文件了,那要如何获取这个 SEADOC_PRIVATE_KEY 呢

    1. 虚拟的现实

      如果直接用 12 版本官方的配置文件安装,确实没有这个配置文件了。

      全新安装请参考 https://wiki.waringid.me/x/WgBmB

      1. You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.
  4. Anonymous

    请问我现在外网用http自动转https,知道是什么问题么?

    1. 虚拟的现实

      如果配置上面都没有问题,一般都是浏览器的问题。

      如果你在地址栏中没有输入 http://域名这样的方式访问,直接输入地址或域名浏览器默认自动切换到 https 的访问