Seafile和onlyoffice互通问题(已解决)

问题已经解决:
centos 默认安装的docker,该版本太老了。我描述的问题是一个Bug在新版已经修复。
解决方法是安装最新的docker-CE

系统信息。

[root@seafile ~]# more /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@seafile ~]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-208.git7d71120.el7_9.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Mon Jun  7 15:36:09 2021
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-208.git7d71120.el7_9.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Mon Jun  7 15:36:09 2021
 OS/Arch:         linux/amd64
 Experimental:    false

centos测试前已经关闭SELinux和防火墙。

Seafile和onlyoffice安装在同一台宿主机上,宿主机IP为:10.10.10.142。

IMAGE PORTS NAMES
onlyoffice/documentserver 0.0.0.0:8080->80/tcp,0.0.0.0:8443->443/tcp onlyoffice
seafileltd/seafile-mc:latest 0.0.0.0:80->80/tcp,0.0.0.0:443->443/tcp seafile
mariadb:10.5 3306/tcp seafile-mysql
memcached:1.5.6 11211/tcp seafile-memcached

onlyoffice已安装好,启用SSL。能正常访问欢迎页面。

Seafile已启用SSL,能正常上传文件。修改 seahub_settings.py

# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
# ONLYOFFICE_APIJS_URL = 'http{s}://{your OnlyOffice server's domain or IP}/web-apps/apps/api/documents/api.js'
ONLYOFFICE_APIJS_URL = 'https://10.10.10.142:8443/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')

重启容器后,不能使用onlyoffice打开文件,提示下载失败。

进入 onlyoffice容器后,发现能ping 通10.10.10.142.尝试访问seafile主页出错。

 wget https://10.10.10.142/accounts/login/?next=/
--2021-11-27 16:54:00--  https://10.10.10.142/accounts/login/?next=/
Connecting to 10.10.10.142:443... failed: No route to host.

查看 /var/log/onlyoffice/documentserver/converter/out.log也发现有文件下载错误的提示。

[2021-11-27T16:46:29.573] [ERROR] nodeJS - error downloadFile:url=https://10.10.10.142/seafhttp/files/99ca5d66-4417-47ea-bd4a-d82c6786d8a2/seafile
-tutorial.doc;attempt=1;code:EHOSTUNREACH;connect:null;(id=000206f33b7933c256dd)
Error: connect EHOSTUNREACH 10.10.10.142:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
[2021-11-27T16:46:31.583] [ERROR] nodeJS - error downloadFile:url=https://10.10.10.142/seafhttp/files/99ca5d66-4417-47ea-bd4a-d82c6786d8a2/seafile
-tutorial.doc;attempt=2;code:EHOSTUNREACH;connect:null;(id=000206f33b7933c256dd)
Error: connect EHOSTUNREACH 10.10.10.142:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
[2021-11-27T16:46:33.591] [ERROR] nodeJS - error downloadFile:url=https://10.10.10.142/seafhttp/files/99ca5d66-4417-47ea-bd4a-d82c6786d8a2/seafile
-tutorial.doc;attempt=3;code:EHOSTUNREACH;connect:null;(id=000206f33b7933c256dd)
Error: connect EHOSTUNREACH 10.10.10.142:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
[2021-11-27T16:47:35.405] [WARN] nodeJS - update cluster with 1 workers
[2021-11-27T16:47:35.429] [WARN] nodeJS - worker 1260 started.
[2021-11-27T16:47:35.438] [WARN] nodeJS - update cluster with 1 workers

我感觉是什么时候限制了容器间利用宿主机ip互通,查询网上也有类似说法。但是说的很简单,没能看懂。各位大神有详细一点的教程吗?

您好,我遇到了同样的问题,但是我的docker版本是20.10.10。请问最终您是怎么解决的?

docker exec -it onlyoffice bash
cat /var/log/onlyoffice/documentserver/converter/out.log
把日志帖出来看看。
我的经验是不能使用IP地址互联,OnlyOffice下载文件时会检查证书,发现证书和URL不符是拒绝下载文件的。

请问是升级了onlyoffice所在服务器的docker版本吗?

root@dab43adf8f3c:/# cat /var/log/onlyoffice/documentserver/converter/out.log
[2023-02-03T11:13:22.946] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:13:22.954] [WARN] nodeJS - worker 860 started.
[2023-02-03T11:13:22.958] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:14:12.930] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:14:12.937] [WARN] nodeJS - worker 972 started.
[2023-02-03T11:14:12.940] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:32:42.394] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:32:42.409] [WARN] nodeJS - worker 863 started.
[2023-02-03T11:32:42.425] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:33:30.609] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:33:30.617] [WARN] nodeJS - worker 970 started.
[2023-02-03T11:33:30.620] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:54:55.649] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:54:55.657] [WARN] nodeJS - worker 871 started.
[2023-02-03T11:54:55.660] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:55:43.292] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T11:55:43.300] [WARN] nodeJS - worker 973 started.
[2023-02-03T11:55:43.303] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:18:37.823] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:18:37.832] [WARN] nodeJS - worker 865 started.
[2023-02-03T12:18:37.836] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:19:26.596] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:19:26.603] [WARN] nodeJS - worker 972 started.
[2023-02-03T12:19:26.605] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:21:49.895] [ERROR] nodeJS - error downloadFile:url=https://yun.iteait.com:4430/seafhtxlsx;attempt=1;code:ETIMEDOUT;connect:true;(id=84add6e6a73f47284117)
Error: ETIMEDOUT
at Timeout. (/snapshot/server/build/server/Common/node_modules/request/request.js:848:19)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
[2023-02-03T12:22:07.054] [ERROR] nodeJS - error downloadFile:url=https://yun.iteait.com:4430/seafhttp/B0%E6%A0%87%E5%87%862016%E7%89%88.xlsx;attempt=1;code:ETIMEDOUT;connect:true;(id=3d7489d615060bf4426a)
Error: ETIMEDOUT
at Timeout. (/snapshot/server/build/server/Common/node_modules/request/request.js:848:19)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
[2023-02-03T12:22:17.074] [ERROR] nodeJS - error downloadFile:url=https://yun.iteait.com:4430/seafht8%A1%A8.xls;attempt=1;code:ETIMEDOUT;connect:true;(id=c610d4a71136c44098ed)
Error: ETIMEDOUT
at Timeout. (/snapshot/server/build/server/Common/node_modules/request/request.js:848:19)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
[2023-02-03T12:23:47.656] [ERROR] nodeJS - error downloadFile:url=https://yun.iteait.com:4430/seafht1%8A.docx;attempt=1;code:ETIMEDOUT;connect:true;(id=0929fe110fc2ab966ba2)
Error: ETIMEDOUT
at Timeout. (/snapshot/server/build/server/Common/node_modules/request/request.js:848:19)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
[2023-02-03T12:24:40.680] [ERROR] nodeJS - error downloadFile:url=https://yun.iteait.com:4430/%A6.docx;attempt=1;code:ETIMEDOUT;connect:true;(id=70603551165d68b985d9)
Error: ETIMEDOUT
at Timeout. (/snapshot/server/build/server/Common/node_modules/request/request.js:848:19)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
[2023-02-03T12:26:09.699] [ERROR] nodeJS - error downloadFile:url=https://yun.iteait.com:4430/seaAE%AE.docx;attempt=1;code:ETIMEDOUT;connect:true;(id=f4b1787213d778307807)
Error: ETIMEDOUT
at Timeout. (/snapshot/server/build/server/Common/node_modules/request/request.js:848:19)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
[2023-02-03T12:30:54.595] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:30:54.616] [WARN] nodeJS - worker 865 started.
[2023-02-03T12:30:54.638] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:31:43.120] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:31:43.128] [WARN] nodeJS - worker 972 started.
[2023-02-03T12:31:43.130] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:42:04.655] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:42:04.672] [WARN] nodeJS - worker 875 started.
[2023-02-03T12:42:04.681] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:42:40.683] [ERROR] nodeJS - error downloadFile:url=https://yun.iteait.com:4430/slsx;attempt=1;code:ETIMEDOUT;connect:true;(id=04fe771539d979d04f0d)
Error: ETIMEDOUT
at Timeout. (/snapshot/server/build/server/Common/node_modules/request/request.js:848:19)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
[2023-02-03T12:42:53.437] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:42:53.444] [WARN] nodeJS - worker 983 started.
[2023-02-03T12:42:53.447] [WARN] nodeJS - update cluster with 1 workers
[2023-02-03T12:43:38.435] [ERROR] nodeJS - error downloadFile:url=https://yun.iteait.com:4430/seafhttp/files/.docx;attempt=1;code:ETIMEDOUT;connect:true;(id=f4b1787213d778307807)
Error: ETIMEDOUT
at Timeout. (/snapshot/server/build/server/Common/node_modules/request/request.js:848:19)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)

备注:日志的真实文件路径已作隐藏处理