Seafile pro setup with Aliyun OSS not working

大家好:
使用官方的服务器手册在ECS上链接同一区域OSS不成功,可能在配置过程中忽略某些设置,特来请教。
过程如下:
1.ECS1基础环境Ubuntu16,按要求安装必要软件包;
2.同一区域OSS创建3个Buckets:commit、fs、block;
3.ESC2通过Docker运行Memcached,更改缓存、开放端口11211;
3.ECS1内网测试Memcached链接成功,Python OSS SDK测试Buckets成功;
4.ECS1运行seafile-pro-server-6.0.3/setup-seafile-mysql.sh安装seafile;
4.修改conf/seafile.conf,按服务手册添加如下配置:

[commit_object_backend]
name = oss
bucket = commit
key_id = <key id>
key = <key>
region = shanghai
memcached_options = --SERVER=10.0.0.2 --POOL-MIN=10 --POOL-MAX=100

[fs_object_backend]
name = oss
bucket = fs
key_id = <key id>
key = <key>
region = shanghai
memcached_options = --SERVER=10.0.0.2 --POOL-MIN=10 --POOL-MAX=100

[block_backend]
name = oss
bucket = block
key_id = <key id>
key = <key>
region = shanghai
memcached_options = --SERVER=10.0.0.2 --POOL-MIN=10 --POOL-MAX=100

5.执行./seafile.sh start无异常。
6.执行./seahub.sh start配置管理员邮箱与密码后显示
Error:Seahub failed to start.
Please try to run “./seahub.sh start” again
由于seahub没能成功启动,所以logs里没有seahub.log、seafevents.log等文件,查看不了出错信息。
请高手指点。

你直接运行一下 ./seahub.sh start-fastcgi 看看命令行有没有报什么错误

输入./seahub.sh start-fastcgi 后提示如下:

Traceback (most recent call last):
  File "/haiwen/seafile-pro-server-6.0.3/seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/core/management/__init__.py", line 303, in execute
    settings.INSTALLED_APPS
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/conf/__init__.py", line 48, in __getattr__
    self._setup(name)
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/conf/__init__.py", line 44, in _setup
    self._wrapped = Settings(settings_module)
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/Django-1.8.16-py2.7.egg/django/conf/__init__.py", line 92, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/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 "/haiwen/seafile-pro-server-6.0.3/seahub/seahub/__init__.py", line 3, in <module>
    from handlers import repo_created_cb, repo_deleted_cb
  File "/haiwen/seafile-pro-server-6.0.3/seahub/seahub/handlers.py", line 16, in <module>
    import seafevents
  File "/haiwen/seafile-pro-server-6.0.3/pro/python/seafevents/__init__.py", line 37, in <module>
    from .virus_scanner import get_virus_record, handle_virus_record, \
  File "/haiwen/seafile-pro-server-6.0.3/pro/python/seafevents/virus_scanner/__init__.py", line 2, in <module>
    from .virus_scan import VirusScan
  File "/haiwen/seafile-pro-server-6.0.3/pro/python/seafevents/virus_scanner/virus_scan.py", line 7, in <module>
    from seafobj import commit_mgr, fs_mgr, block_mgr
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/seafobj/__init__.py", line 2, in <module>
    from .commits import commit_mgr
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/seafobj/commits.py", line 53, in <module>
    commit_mgr = SeafCommitManager()
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/seafobj/commits.py", line 23, in __init__
    self.obj_store = objstore_factory.get_obj_store('commits')
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/seafobj/objstore_factory.py", line 186, in get_obj_store
    from seafobj.backends.alioss import SeafObjStoreOSS
  File "/haiwen/seafile-pro-server-6.0.3/seahub/thirdpart/seafobj/backends/alioss.py", line 3, in <module>
    from oss.oss_api import OssAPI
ImportError: No module named oss.oss_api
Error:Seahub failed to start.

何解?

Seafile 没有找到 aliyun oss 的依赖,看这里 https://manual-cn.seafile.com/deploy_pro/setup_with_oss.html按照 这个文档 安装 OSS Python SDK。

这就奇怪了,已参照阿里云文档https://help.aliyun.com/document_detail/32171.html 安装Python SDK2.2,而且自己测试用Python访问访问Bucket成功。
不同的是自已写的Python.py import oss2而非oss.oss_api

那你试试 import oss 应该也会报同样错误的。

需要你再自己装一下 oss

感谢,已解决。之前自己用Python文件测试时使用的是Python SDK 2.x,导入模块为oss2,但是Seafile目前支持的是Python SDK 0.x,重新安装后使用oss测试成功。建议服务文档里增加对SDK使用版本的说明。

2 个赞