seafile-compose.yml
version: '3.0' services: db: image: mariadb:10.6 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 memcached: image: memcached:1.6.18 container_name: seafile-memcached entrypoint: memcached -m 256 networks: - seafile-net elasticsearch: image: docker.seafile.top/seafileltd/elasticsearch:8.6.2 container_name: seafile-elasticsearch environment: - discovery.type=single-node - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms1g -Xmx1g" ulimits: memlock: soft: -1 hard: -1 mem_limit: 2g volumes: - /data/seafile/elasticsearch:/usr/share/elasticsearch/data networks: - seafile-net seafile: image: docker.seafile.top/seafileltd/seafile-pro-mc:11.0-latest container_name: seafile ports: - "8000:80" volumes: - /data/seafile/data:/shared - /data/seafile/deps/seafile-controller:/opt/seafile/seafile-pro-server-11.0.14/seafile/bin/seafile-controller - /data/seafile/deps/seaf-server:/opt/seafile/seafile-pro-server-11.0.14/seafile/bin/seaf-server - /data/seafile/deps/licenseparse.py:/opt/seafile/seafile-pro-server-11.0.14/seahub/seahub/utils/licenseparse.py environment: - DB_HOST=db - DB_ROOT_PASSWD=password - TIME_ZONE=Asia/Shanghai - SEAFILE_ADMIN_EMAIL=136xxxxxx771@139.com - SEAFILE_ADMIN_PASSWORD=password - SEAFILE_SERVER_LETSENCRYPT=false - SEAFILE_SERVER_HOSTNAME=yunpan.waringid.me depends_on: - db - memcached - elasticsearch networks: - seafile-net networks: seafile-net:
chmod -R 777 /data/seafile/elasticsearch vim /data/seafile/data/seafile/conf/seahub_settings.py
seahub_settings.py
CSRF_TRUSTED_ORIGINS = ["https://yunpan.waringid.me"]
Seafile 整合 sdoc-server
SeaDoc 是一个在线协同文档,并有文档的流程管理功能。SeaDoc 围绕以下的关键想法进行设计:
- 富有表现力的并且易于使用的编辑器
- 审阅和批准工作流,可更好地控制文档内容的修改
- 可以链接相关的文档
- AI 集成,以简化内容生成和管理
- 丰富的 API,可以用于自动化文档生成和处理
SeaDoc 的使用场景包括:
- 产品和技术文档的撰写
- 创建知识库文章和在线手册
- 构建团队内部维基
以下配置场景基于 seafile 和 sdoc 都在同一台主机的容器方式配置。
手动创建 SeaDoc 数据库
SeaDoc 和 Seafile 共享 MySQL 服务。在 Seafile MySQL 中创建数据库sdoc_db。
mysql 用户 seafile 的密码保存在 /data/seafile/data/seafile/conf/seahub_settings.py 中。
docker exec it seafile-mysql sh mysql -uroot -p**** create database if not exists sdoc_db charset utf8mb4; GRANT ALL PRIVILEGES ON `sdoc_db`.* to `seafile`@`%.%.%.%`;
修改 seafile 服务器的 nginx.conf 文件
将以下内容添加到 :/data/seafile/data/nginx/conf/seafile.nginx.conf
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://sdoc-server:7070/; 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; } location /socket.io { proxy_pass http://sdoc-server:7070; 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; }
在 seafiel.yml 增加 sdoc 配置
sdoc-server: image: seafileltd/sdoc-server:latest container_name: sdoc-server ports: - 7070:7070 - 8888:8888 volumes: - /data/seafile/seadoc-data/:/shared environment: - DB_HOST=db - DB_PORT=3306 - DB_USER=seafile - DB_PASSWD=29329XXX-bac6-XXXX - DB_NAME=sdoc_db - TIME_ZONE=Asia/Shanghai # Optional, default is UTC. Should be uncomment and set to your local time zone. - SDOC_SERVER_LETSENCRYPT=false # Whether to use https or not. - SDOC_SERVER_HOSTNAME=192.168.182.53 # Specifies your host name if https is enabled. - SEAHUB_SERVICE_URL=http://192.168.182.53:8003 networks: - seafile-net
启动 SeaDoc
docker compose -f seafile.yml down docker compose -f seafile.yml up
等待几分钟程序初始化完成后,查看配置文件 /opt/seadoc-server/sdoc-server/conf/sdoc_server_config.json,记录下 private_key 的内容,稍后用于编辑 Seafile 配置文件。
Seafile 配置
修改seahub_settings.py:
ENABLE_SEADOC = True SEADOC_PRIVATE_KEY = 'fc-nfb4#y281&yq(n+' SEADOC_SERVER_URL = 'http://192.168.182.53:8003/sdoc-server' FILE_CONVERTER_SERVER_URL = 'http://sdoc-server:8888'
启用配置
docker exec -it seafile bash cd seafile-server-latest/ ./seafile.sh restart ./seahub.sh restart
0 评论