admin 发表于 2023-12-25 00:01:15

群晖NAS容器化部署Seafile+onlyoffice

一、部署seafile和onlyoffice

docker-compose.yml如下:
services:
db:
    image: mariadb:10.11
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=XXXXXX      # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
      - MARIADB_AUTO_UPGRADE=1
    volumes:
      - /aaa/seafile/seafile-mysql/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: elasticsearch:8.6.2
    container_name: seafile-elasticsearch
    environment:
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    volumes:
      - /aaa/seafile/seafile-elasticsearch/data:/usr/share/elasticsearch/data# Requested, specifies the path to Elasticsearch data persistent store.
    networks:
      - seafile-net
         
seafile:
    image: docker.seafile.top/seafileltd/seafile-pro-mc:11.0.5
    container_name: seafile
    ports:
      - "1080:80"
#   - "1443:443"# If https is enabled, cancel the comment.
    volumes:
      - /aaa/seafile/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=XXXXXX         # Requested, the value shuold be root's password of MySQL service.
      - TIME_ZONE=Asia/Shanghai          # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - SEAFILE_ADMIN_EMAIL=XXXX@#XX         # Specifies Seafile admin user, default is 'me@example.com'
      - SEAFILE_ADMIN_PASSWORD=XXXXXX          # Specifies Seafile admin password, default is 'asecret'
      - SEAFILE_SERVER_LETSENCRYPT=false       # Whether to use https or not
      - SEAFILE_SERVER_HOSTNAME=XXXXXX:1080      # Specifies your host name if https is enabled
    depends_on:
      - db
      - memcached
      - elasticsearch
    networks:
      - seafile-net

oods:
    image: onlyoffice/documentserver:latest
    container_name: seafile-oods
    ports:
      - "1081:80"                     
    networks:
      - seafile-net
    environment:
      - JWT_ENABLED=True
      - JWT_SECRET=seafile123   ##可以自定义

networks:
seafile-net:

执行 docker-compose up -d启动相关容器。


二、设置onlyoffice
群晖系统下执行vim /........./seafile/seafile-data/seafile/conf/seahub_settings.py,在最后添加以下内容:

# OnlyOffice
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False               //不使用https访问时,请填写False
ONLYOFFICE_APIJS_URL = 'http://sf.hahaha.net:1081/web-apps/apps/api/documents/api.js'    //IP请填写onlyoffice容器外网的IP,标红路径请勿写错。
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')
ONLYOFFICE_JWT_SECRET = 'seafile123'                ## 和docker-compose.yml 中保持一致</div>

修改并保存后,重启容器 docker restart seafile。
也可以通过docker exec -it seafile bash登陆seafile容器后,执行vim conf/seahub_settings.py.


三、解决“onlyoffice打开文档时提示下载失败”问题
onlyoffice前端页面出现“下载失败”,通常为以下两个排查方向:

排查方向1(docker内不能访问)
很常见的一种情况时后端服务地址,在docker不能访问。
# docker exec -it seafile-oods/bin/bash
# curlhttp://192.168.9.250:1081/web-apps/apps/api/documents/api.js




排查方向2(使用内部IP地址访问后端服务)
查看onlyoffice converter的日志文件(docker中对应位置/var/log/onlyoffce/logs/documentserver/converter/out.log)
如果发现日志文件存在以下报错,那需要进入seafile-oods容器中编辑配置文件/etc/onlyoffice/documentserver/default.json允许私有IP通过。

Error: DNS lookup xxx.xxx.xxx.xx(family:undefined, host:undefined) is not allowed. Because, It is private IP address.


搜索并修改以下字段为true。

request-filtering-agent" : {
      "allowPrivateIPAddress": true,
      "allowMetaIPAddress": true
},解决以上问题后,经测试访问正常。


【解决容器中无法vim和ping问题】
可在容器中运行以下命令进行安装,请注意由于容器的特点,容器重建后将会丢失。
apt-get update
apt-get install vim
apt-get install iputils-ping



参考链接:
https://blog.csdn.net/dwdcth/article/details/124034338?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-124034338-blog-134512380.235%5Ev39%5Epc_relevant_3m_sort_dl_base4&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-124034338-blog-134512380.235%5Ev39%5Epc_relevant_3m_sort_dl_base4&utm_relevant_index=2







页: [1]
查看完整版本: 群晖NAS容器化部署Seafile+onlyoffice