操作系统 Centos 7 x64
内核:3.10.0-327.36.2.el7.x86_64
docker 已经起来
seafile版本: seafile-pro-server-6.0.3
python版本:Python 2.7.5
根据文档部署https://manual.seafile.com/deploy_pro/libreoffice_online.html office 在线编辑.
office 在线编辑已经起来了,但是修改完 seahub_settings.py 部分内容后,启动 seahub.sh 正常
但是 nginx 访问出现 Unhandled Exception
查询 nginx seahub 日志如下
2016/11/22 11:22:34 [error] 47669#47669: *3620 FastCGI sent in stderr: "Traceback (most recent call last):
File "/home/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/flup-1.0.2-py2.7.egg/flup/server/fcgi_base.py", line 558, in run
protocolStatus, appStatus = self.server.handler(self)
File "/home/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/flup-1.0.2-py2.7.egg/flup/server/fcgi_base.py", line 1118, in handler
result = self.application(environ, start_response)
File "/home/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/core/handlers/wsgi.py", line 170, in __call__
self.load_middleware()
File "/home/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/core/handlers/base.py", line 52, in load_middleware
mw_instance = mw_class()
File "/home/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/middleware/locale.py", line 24, in __init__
for url_pattern in get_resolver(None).url_patterns:
File "/home/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/core/urlresolvers.py", line 401, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/core/urlresolvers.py", line 395, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/home/haiwen/seafile-pro-server-6.0.3/pro/python/importlib-1.0.2-py2.6.egg/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/haiwen/seafile-pro-server-6.0.3/seahub/seahub/utils/rooturl.py", line 41, in <module>
(r'^%s' % settings.SITE_ROOT[1:], include(settings.SITE_ROOT_URLCONF)),
File "/home/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/conf/urls/__init__.py", line 33, in include
urlconf_module = import_module(urlconf_module)
File "/home/haiwen/seafile-pro-server-6.0.3/pro/python/importlib-1.0.2-py2.6.egg/
google 找到德国论坛上也有同样情况,但是他是切换回5.1.8版本 手动安装 python-urllib3 解决的.
https://forum.seafile.de/t/solved-seafile-pro-5-1-10-unhandled-exception-error/5413/2
我也尝试卸载了 python-urllib3 直接从 github 拉源码下来 python setup.py install
安装 但是问题依旧.
请问如何解决?
需要安装 python requests 这个包。
sudo pip install requests
原来如此,我是从社区版迁移过去,文档没写所以没装~
现在启动正常,但是访问office编辑的时候弹出空白页
https://test.neroxps.cn/loleaflet/1.9.8/loleaflet.html?WOPISrc=http%3A%2F%2…eroxps.cn%2Fapi2%2Fwopi%2Ffiles%2F270bc81ed881d84912c44170f2ecdb20651bb646 Failed to load resource: the server responded with a status of 403 (Forbidden)
docker 回显以下错误
[ client_req_hdl ] ERR FileServerRequestHandler: Access to file denied: Invalid access token provided. Only alphanumeric, '.' and '_'are allowed
lian
2016 年11 月 22 日 10:25
5
docker 的错误是因为 Collabora Online Development Edition (CODE) 的最新 docker 镜像对一些传入的参数做了格式限制,所以和当前发布的 Seafile 还不兼容。
如果你想测试一下,可以按这个手动改一下代码
diff --git a/seahub_extra/wopi/utils.py b/seahub_extra/wopi/utils.py
index d3c5177..b0c65b6 100644
--- a/seahub_extra/wopi/utils.py
+++ b/seahub_extra/wopi/utils.py
@@ -129,7 +129,10 @@ def get_wopi_dict(request_user, repo_id, file_path, action_name='view'):
# generate access token
file_info = (request_user, repo_id, file_path)
- access_token = uuid.uuid4()
+
+ # collobora office only allowed alphanumeric and _
+ uid = uuid.uuid4()
+ access_token = uid.hex
key = generate_access_token_cache_key(access_token)
cache.set(key, file_info, WOPI_ACCESS_TOKEN_EXPIRATION)
diff --git a/seahub_extra/wopi/views.py b/seahub_extra/wopi/views.py
index 3e25270..6772308 100644
--- a/seahub_extra/wopi/views.py
+++ b/seahub_extra/wopi/views.py
@@ -17,6 +17,7 @@ from seaserv import seafile_api
from seahub.views import check_file_lock
from seahub.utils import gen_inner_file_get_url, \
gen_file_upload_url, get_file_type_and_ext
+from seahub.base.templatetags.seahub_tags import email2nickname
from seahub.settings import FILE_LOCK_EXPIRATION_DAYS
@@ -70,11 +71,19 @@ class WOPIFilesView(APIView):
result = {}
result['BaseFileName'] = os.path.basename(file_path)
- result['OwnerId'] = request_user
result['Size'] = file_size
- # used for office web app cache
result['Version'] = obj_id
+ # for use of collobora office
+ result['UserFriendlyName'] = email2nickname(request_user)
+ result['OwnerId'] = seafile_api.get_repo_owner(repo_id)
+ result['UserId'] = request_user
+ result['PostMessageOrigin'] = 'https://demo.seafile.com' # TODO
+ result['HidePrintOption'] = False
+ result['HideSaveOption'] = False
+ result['HideExportOption'] = False
+ result['EnableOwnerTermination'] = True
+
filename = os.path.basename(file_path)
filetype, fileext = get_file_type_and_ext(filename)
is_locked, locked_by_me = check_file_lock(repo_id,
其中 + result['PostMessageOrigin'] = 'https://demo.seafile.com' # TODO
是我测试用的,你需要改成你自己的地址。
您好,谢谢您的回复。
utils.py 我打上 patch 修改成功。
但 views.py 不成功。
我的 6.0.3 和您提供的 patch 貌似对不上
class WOPIFilesView(APIView):
def get(self, request, file_id, format=None):
""" WOPI endpoint for check file info
"""
token = request.GET.get('access_token', None)
request_user, repo_id, file_path = get_file_info_by_token(token)
if not request_user or not repo_id or not file_path:
logger.error('access_token invalid.')
return HttpResponse(json.dumps({}), status=401,
content_type=json_content_type)
repo = seafile_api.get_repo(repo_id)
if not repo:
logger.error('Library %s not found.') % repo_id
return HttpResponse(json.dumps({}), status=401,
content_type=json_content_type)
obj_id = seafile_api.get_file_id_by_path(repo_id, file_path)
if not obj_id:
logger.error('File %s not found.') % file_path
return HttpResponse(json.dumps({}), status=401,
content_type=json_content_type)
try:
file_size = seafile_api.get_file_size(repo.store_id,
repo.version,
obj_id)
except SearpcError as e:
logger.error(e)
return HttpResponse(json.dumps({}), status=500,
content_type=json_content_type)
if file_size == -1:
logger.error('File %s not found.') % file_path
return HttpResponse(json.dumps({}), status=401,
content_type=json_content_type)
result = {}
result['BaseFileName'] = os.path.basename(file_path)
result['OwnerId'] = seafile_api.get_repo_owner(repo_id)
result['UserId'] = request_user
result['UserFriendlyName'] = email2nickname(request_user)
result['Size'] = file_size
# used for office web app cache
result['Version'] = obj_id
lian
2016 年11 月 23 日 02:32
7
对应你的版本是这个。
diff --git a/seahub_extra/wopi/views.py b/seahub_extra/wopi/views.py
index be6cb62..9c0054b 100644
--- a/seahub_extra/wopi/views.py
+++ b/seahub_extra/wopi/views.py
@@ -71,13 +71,19 @@ class WOPIFilesView(APIView):
result = {}
result['BaseFileName'] = os.path.basename(file_path)
- result['OwnerId'] = seafile_api.get_repo_owner(repo_id)
- result['UserId'] = request_user
- result['UserFriendlyName'] = email2nickname(request_user)
result['Size'] = file_size
- # used for office web app cache
result['Version'] = obj_id
+ # for use of collobora office
+ result['UserFriendlyName'] = email2nickname(request_user)
+ result['OwnerId'] = seafile_api.get_repo_owner(repo_id)
+ result['UserId'] = request_user
+ result['PostMessageOrigin'] = 'https://demo.seafile.com' # TODO
+ result['HidePrintOption'] = False
+ result['HideSaveOption'] = False
+ result['HideExportOption'] = False
+ result['EnableOwnerTermination'] = True
+
filename = os.path.basename(file_path)
filetype, fileext = get_file_type_and_ext(filename)
is_locked, locked_by_me = check_file_lock(repo_id,
还有,用 Collabora Online Development Edition (CODE) 需要:
将 Seafile 运行某个域名下,并配置https,对应证书需要合法证书,不能自签名证书。
翻墙。
您好,目前我服务器情况如下:
server_ip = 192.168.2.200
seafile_domain = demo.neroxps.cn 已使用 letsencrypt 证书,将域名 ip 修改为 192.168.2.200
LibreOffice_domain = test.neroxps.cn 使用 letsencrypt 证书,将域名 ip 修改为 192.168.2.200
Nginx seafile 配置加入 proxy_set_header Host $host;
访问 https://test.neroxps.cn/hosting/discovery 显示页面正常
运行 docker 命令 docker run -d -t -p 9980:9980 -e "domain=demo\.neroxps\.cn" --restart always --cap-add MKNOD collabora/code
但 collabora/code 依然显示 SSL 错误.是不是必须要部署另外一台服务器跑 collabora/code? seafile 不能和 collabora/code 跑在一个 IP 中?
Generating RSA private key, 2048 bit long modulus
..........................................................................................................................+++
..................................................+++
e is 65537 (0x10001)
Generating RSA private key, 2048 bit long modulus
.......................+++
.........................+++
e is 65537 (0x10001)
Signature ok
subject=/C=DE/ST=BW/L=Stuttgart/O=Dummy Authority/CN=localhost
Getting CA Private Key
loolwsd version details: 1.9.8 - 1.9.8
loolforkit version details: 1.9.8 - 1.9.8
office version details: { "ProductName": "Collabora Office", "ProductVersion": "5.1", "ProductExtension": ".10.12", "BuildId": "653cc4c38dd2c05aecbee156aef460f5a361e579" }
wsd-00025-0026 0:02:22.805771 [ client_ws_0002 ] ERR Error in client request handler: SSL Exception| LOOLWSD.cpp:966
在 nextcloud 找到和我差不多情况的用户,好像是要两个ip才行.
分开两个服务器部署 依然错误
[ client_ws_0003 ] ERR Error in client request handler: SSL Exception| LOOLWSD.cpp:966
大哥 这个 ssl 问题咋解决? 两边的nginx 都搞了证书 访问两个服务器的web已经小绿锁了啊
lian
2016 年11 月 25 日 03:15
12
我自己搭建之后,两个域名,对应两个IP,对应两个合法证书后,用最新的 CODE 没遇到 ssl 的报错,但是遇到了
wsd-00024-0028 0:02:48.434609 [ client_ws_0002 ] ERR Missing JSON property: 'BaseFileName'
可能最新的 CODE 又有更改,还需要在多看看。
老大,看到6.1.0社区版支持onlyoffice和libreoffice。
onlyoffice我已经部署完成,但是onlyoffice没有中文界面,中文是好解决,只是没中文界面很难用。
libreoffice的话,从来没部署成功过。
docker 报错信息如下:
wsd-00024-00032 06:33:14.917318 [ websrv_poll ] ERR #19 Exception while processing incoming request: [GET /lool/https%3A%2F%2Fcloud.rslnc.cn%2Fapi2%2Fwopi%2Ffiles%2F9e293fd8dbd...]: Invalid or unknown request.| wsd/LOOLWSD.cpp:167299d746449cb03283dc5784dc%26access_token_ttl%3D1495782193000%26permission%3Dedit/ws HTTP/1.0
请问你们内部测试成功了吗?
你是说 onlyoffice 下一个版本会解决中文界面问题?
而且我发现 onlyoffice 对中文的识别还是有很大问题,例如 onlyoffice 默认是英文,那么现实的字体名称全部都是英文(例如:等线,onlyoffice里面叫DengXian),如果Word 写的文件用的是中文的等线,那么到了onlyoffice就会识别不出成一堆乱码。
那么libreoffice呢?你们测试的版本正常么?我一直都部署不了。包括最新的 6.1.0.
lian
2017 年5 月 27 日 08:24
19
libreoffice加载一些js文件需要翻墙,你翻墙试试。