7.0.5升级到7.1.3出错

停止seafile和seahub后执行升级脚本,出现数据库升级错误:
./upgrade_7.0_7.1.sh


This script would upgrade your seafile server from 7.0 to 7.1
Press [ENTER] to contiune

renaming the gunicorn.conf to gunicorn.conf.py …

Done

Updating seafile/seahub database …

[INFO] You are using SQLite3
[INFO] updating seahub database…
Traceback (most recent call last):
File “/home/haiwen/seafile-server-7.1.3/upgrade/db_update_helper.py”, line 384, in
main()
File “/home/haiwen/seafile-server-7.1.3/upgrade/db_update_helper.py”, line 379, in main
db_updater.update_db()
File “/home/haiwen/seafile-server-7.1.3/upgrade/db_update_helper.py”, line 275, in update_db
super(SQLiteDBUpdater, self).update_db()
File “/home/haiwen/seafile-server-7.1.3/upgrade/db_update_helper.py”, line 129, in update_db
self.update_seahub_sql(seahub_sql)
File “/home/haiwen/seafile-server-7.1.3/upgrade/db_update_helper.py”, line 299, in update_seahub_sql
self.apply_sqls(self.seahub_db, sql_path)
File “/home/haiwen/seafile-server-7.1.3/upgrade/db_update_helper.py”, line 289, in apply_sqls
conn.execute(line)
sqlite3.OperationalError: there is already another table or index with this name: constance_config_old

Failed to upgrade your database

和我遇到的错误一模一样

解决了吗
我在sqlite到mysql的时候也出现了类似错误

我们看下这个问题

在 upgrade/sql/7.1.0/sqlite3/seahub.sql 之前加一句

DROP TABLE IF EXISTS "constance_config_old";

应该能解决这个问题

升级sql ok了,但无法启动seahub,seafile可以正常启动

你用的是什么操作系统。是否按照我们的升级文档把相关的依赖都安装了? https://download.seafile.com/published/seafile-manual/upgrade/upgrade_notes_for_7.1.x.md

可以把 conf/gunicorn.conf 中的 daemon = True 注释掉,这样启动的时候会报告出具体的错误信息。

系统是centos7 系统自带的python2.7
安装了如下:

yum install python3 python3-setuptools python3-pip -y
pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha python3-ldap

daemon = True 注释掉后:

./seahub.sh start

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 …
Error:Seahub failed to start.
Please try to run “./seahub.sh start” again
[root@localhost seafile-server-latest]# vim …/conf/gunicorn.conf.py
[root@localhost seafile-server-latest]# ./seahub.sh start

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 …
Traceback (most recent call last):
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/bin/gunicorn”, line 8, in
sys.exit(run())
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/gunicorn/app/wsgiapp.py”, line 58, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/gunicorn/app/base.py”, line 228, in run
super().run()
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/gunicorn/app/base.py”, line 72, in run
Arbiter(self).run()
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/gunicorn/arbiter.py”, line 58, in init
self.setup(app)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/gunicorn/arbiter.py”, line 118, in setup
self.app.wsgi()
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/gunicorn/app/base.py”, line 67, in wsgi
self.callable = self.load()
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/gunicorn/app/wsgiapp.py”, line 49, in load
return self.load_wsgiapp()
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/gunicorn/app/wsgiapp.py”, line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/gunicorn/util.py”, line 358, in import_app
mod = importlib.import_module(module)
File “/usr/lib64/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 678, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/home/haiwen/seafile-server-7.1.3/seahub/seahub/wsgi.py”, line 25, in
application = get_wsgi_application()
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/wsgi.py”, line 13, in get_wsgi_application
django.setup(set_prefix=False)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/init.py”, line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/apps/registry.py”, line 108, in populate
app_config.import_models()
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/apps/config.py”, line 202, in import_models
self.models_module = import_module(models_module_name)
File “/usr/lib64/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 678, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/registration/models.py”, line 13, in
from seahub.base.accounts import User
File “/home/haiwen/seafile-server-7.1.3/seahub/seahub/base/accounts.py”, line 27, in
from seahub.utils.mail import send_html_email_with_dj_template, MAIL_PRIORITY
File “/home/haiwen/seafile-server-7.1.3/seahub/seahub/utils/mail.py”, line 4, in
from post_office import mail
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/post_office/mail.py”, line 12, in
from .models import Email, EmailTemplate, Log, PRIORITY, STATUS
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/post_office/models.py”, line 14, in
from post_office import cache
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/post_office/cache.py”, line 7, in
cache_backend = get_cache_backend()
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/post_office/settings.py”, line 58, in get_cache_backend
return caches[“default”]
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/cache/init.py”, line 80, in getitem
cache = _create_cache(alias)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/cache/init.py”, line 55, in _create_cache
return backend_cls(location, params)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/cache/backends/memcached.py”, line 162, in init
import memcache
ModuleNotFoundError: No module named ‘memcache’
Error:Seahub failed to start.
Please try to run “./seahub.sh start” again

看一下你的 seahub_settings.py, 确保你的 memcache 的配置如下

CACHES = {
    'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
        'LOCATION': '127.0.0.1:11211',
    },
    'locmem': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    },
}

seahub_settings.py中memcache配置没错

那你先用 pip3 install python-memcache 来解决这个问题吧。

方便的话把你的 seahub_settings.py 贴一下吧

SECRET_KEY = "t95h2ufyhacm!_1-e622=g&((0w=inz(7n$8g&uzftp%-ds^#"
FILE_SERVER_ROOT = 'https://
**/seafhttp’
EMAIL_USE_TLS = False
EMAIL_HOST = ‘***’
EMAIL_HOST_USER = ‘***’
EMAIL_HOST_PASSWORD = ‘***’
EMAIL_PORT = ‘25’
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER
CACHES = {
‘default’: {
‘BACKEND’: ‘django.core.cache.backends.memcached.MemcachedCache’,
‘LOCATION’: ‘127.0.0.1:11211’,
},
‘locmem’: {
‘BACKEND’: ‘django.core.cache.backends.locmem.LocMemCache’,
}
}
~

下面的配置是正确的

'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',

你的配置是很早前的旧版的, 需要更新到上面的配置方式

‘BACKEND’: ‘django.core.cache.backends.memcached.MemcachedCache’,

改成这样后可以启动了:
CACHES = {
‘default’: {
‘BACKEND’: ‘django_pylibmc.memcached.PyLibMCCache’,
‘LOCATION’: ‘127.0.0.1:11211’,
},
‘locmem’: {
‘BACKEND’: ‘django.core.cache.backends.locmem.LocMemCache’,
}

但web页面出现问题:

Page unavailable

Sorry, but the requested page is unavailable due to a server hiccup.

Our engineers have been notified, so check back later.

是不是nginx配置有问题?
server {
listen 80;
server_name sf.yesway.cn;
rewrite ^ https://$http_host$request_uri? permanent;
}
server {
listen 443 ssl;
// ssl on;
ssl_certificate /etc/ssl/yesway.cn.serverca.crt;
ssl_certificate_key /etc/ssl/yesway.cn.privkey.key;
server_name sf.yesway.cn;
proxy_set_header X-Forwarded-For $remote_addr;
location / {
proxy_pass http://127.0.0.1:8000;
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_read_timeout 1200s;

     # used for view/edit office file via Office Online Server
     client_max_body_size 0;

     access_log      /var/log/nginx/seahub.access.log;
     error_log       /var/log/nginx/seahub.error.log;
}
  location /seafhttp {
      rewrite ^/seafhttp(.*)$ $1 break;
      proxy_pass http://127.0.0.1:8082;
      client_max_body_size 0;
      proxy_connect_timeout  36000s;
      proxy_read_timeout  36000s;
  }
  location /media {
      root /home/haiwen/seafile-server-latest/seahub;
  }
}

看看 seahub.log 中有什么日志。

嗯,解决了我的问题。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/exception.py”, line 109, in get_exception_response
response = callback(request, **dict(param_dict, exception=exception))
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/utils/decorators.py”, line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/views/defaults.py”, line 47, in page_not_found
body = template.render(context, request)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/template/backends/django.py”, line 66, in render
return self.template.render(context)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/template/base.py”, line 205, in render
with context.bind_template(self):
File “/usr/lib64/python3.6/contextlib.py”, line 81, in enter
return next(self.gen)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/template/context.py”, line 263, in bind_template
updates.update(processor(self.request))
File “/home/haiwen/seafile-server-7.1.3/seahub/seahub/base/context_processors.py”, line 93, in base
avatar_url, is_default, date_uploaded = api_avatar_url(username, 72)
File “/home/haiwen/seafile-server-7.1.3/seahub/seahub/avatar/util.py”, line 42, in cached_func
return cache.get(key) or cache_set(key, func(user, size))
File “/usr/local/lib/python3.6/site-packages/django_pylibmc/memcached.py”, line 130, in get
return super(PyLibMCCache, self).get(key, default, version)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/cache/backends/memcached.py”, line 79, in get
val = self._cache.get(key)
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe0 in position 1: ordinal not in range(128)
2020-04-02 04:53:35,333 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /api2/repos/
Traceback (most recent call last):
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/exception.py”, line 41, in inner
response = get_response(request)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/base.py”, line 249, in _legacy_get_response
response = self._get_response(request)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/base.py”, line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/base.py”, line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/views/decorators/csrf.py”, line 58, in wrapped_view
return view_func(*args, **kwargs)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/django/views/generic/base.py”, line 68, in view
return self.dispatch(request, *args, **kwargs)
File “/home/haiwen/seafile-server-7.1.3/seahub/seahub/api2/base.py”, line 23, in dispatch
response = super(APIView, self).dispatch(*a, **kw)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/rest_framework/views.py”, line 505, in dispatch
response = self.handle_exception(exc)
File “/home/haiwen/seafile-server-7.1.3/seahub/seahub/api2/base.py”, line 20, in handle_exception
return super(APIView, self).handle_exception(exc)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/rest_framework/views.py”, line 465, in handle_exception
self.raise_uncaught_exception(exc)
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/rest_framework/views.py”, line 476, in raise_uncaught_exception
raise exc
File “/home/haiwen/seafile-server-7.1.3/seahub/thirdpart/rest_framework/views.py”, line 502, in dispatch
response = handler(request, *args, **kwargs)
File “/home/haiwen/seafile-server-7.1.3/seahub/seahub/api2/views.py”, line 916, in get
response = HttpResponse(json.dumps(repos_json), status=200,
File “/usr/lib64/python3.6/json/init.py”, line 231, in dumps
return _default_encoder.encode(obj)
File “/usr/lib64/python3.6/json/encoder.py”, line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File “/usr/lib64/python3.6/json/encoder.py”, line 257, in iterencode
return _iterencode(o, 0)
File “/usr/lib64/python3.6/json/encoder.py”, line 180, in default
o.class.name)
TypeError: Object of type ‘bytes’ is not JSON serializable

web页面问题,同时客户端获取资料库失败

可以看一下系统按照的 Python3 是什么版本

7.0.5用原始的seahub_setting.py 可以正常使用。7.1.3用改过的seahub_setting.py有问题。

python3 -V
Python 3.6.8