Bug 248472 - www/seahub: failed upgrade 7.0 -> 7.1
Summary: www/seahub: failed upgrade 7.0 -> 7.1
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Richard Gallamore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-04 19:36 UTC by Boris Tassou
Modified: 2020-09-16 21:14 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (ultima)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Tassou 2020-08-04 19:36:58 UTC
Hi,

On a 12.1-RELEASE-p3 with :
py37-seafdav-7.1.5             Python library for accessing seafile data model
py37-seafobj-7.1.5             Python library for accessing seafile data model
seafile-server-7.1.4           Open Source Cloud Storage (Server)
seahub-7.1.5                   Web frontend for Seafile

When i try to start seahub it failed but without any errors :
https://paste.swordarmor.fr/BiSX

the end :
+ before_start
+ prepare_env
+ [ -z '' ]
+ echo 'LANG is not set in ENV, set to en_US.UTF-8'
LANG is not set in ENV, set to en_US.UTF-8
+ export 'LANG=en_US.UTF-8'
+ [ -z '' ]
+ echo 'LC_ALL is not set in ENV, set to en_US.UTF-8'
LC_ALL is not set in ENV, set to en_US.UTF-8
+ export 'LC_ALL=en_US.UTF-8'
+ export 'CCNET_CONF_DIR=/usr/local/www/haiwen/ccnet'
+ export 'SEAFILE_CONF_DIR=/usr/local/www/haiwen/seafile-data'
+ export 'SEAFILE_CENTRAL_CONF_DIR=/usr/local/www/haiwen/conf'
+ export 'PYTHONPATH=/usr/local/www/haiwen/seafile-server/seafile/lib/python3.7/site-packages:/usr/local/www/haiwen/seafile-server/seafile/lib64/python3.7/site-packages:/usr/local/www/haiwen/seafile-server/seahub/thirdpart:'
+ export 'SEAHUB_LOG_DIR=/usr/local/www/haiwen/logs'
+ export 'SEAFILE_RPC_PIPE_PATH=/usr/local/www/haiwen/seafile-server/runtime'
+ warning_if_seafile_not_running
+ pgrep -f 'seafile-controller -c /usr/local/www/haiwen/ccnet'
+ validate_seahub_running
+ pgrep -f /usr/local/www/haiwen/seafile-server/seahub/manage.py
+ echo 'Starting seahub at port 8000 ...'
Starting seahub at port 8000 ...
+ su -m seafile -c '/usr/local/bin/python3.7 "/usr/local/bin/gunicorn-3.7" seahub.wsgi:application -c "/usr/local/www/haiwen/conf/gunicorn.conf.py" -b "127.0.0.1:8000" --preload --chdir "/usr/local/www/haiwen/seafile-server/seahub"'
+ sleep 5
+ pgrep -f seahub.wsgi:application
+ printf '\033[33mError:Seahub failed to start.\033[m\n'
Error:Seahub failed to start.
+ echo 'Please try to run "./seahub.sh start" again'
Please try to run "./seahub.sh start" again
+ exit 1

If i try to launch seahub.sh :
[root@lytan /usr/local/www/haiwen/seafile-server]# bash -x seahub.sh start
+ echo ''

++ readlink -f seahub.sh
+ SCRIPT=/usr/local/www/haiwen/seafile-server/seahub.sh
++ dirname /usr/local/www/haiwen/seafile-server/seahub.sh
+ INSTALLPATH=/usr/local/www/haiwen/seafile-server
++ dirname /usr/local/www/haiwen/seafile-server
+ TOPDIR=/usr/local/www/haiwen
+ default_ccnet_conf_dir=/usr/local/www/haiwen/ccnet
+ default_seafile_data_dir=/usr/local/www/haiwen/seafile-data
+ central_config_dir=/usr/local/www/haiwen/conf
+ seafile_rpc_pipe_path=/usr/local/www/haiwen/seafile-server/runtime
+ manage_py=/usr/local/www/haiwen/seafile-server/seahub/manage.py
+ gunicorn_conf=/usr/local/www/haiwen/conf/gunicorn.conf.py
+ pidfile=/usr/local/www/haiwen/pids/seahub.pid
+ errorlog=/usr/local/www/haiwen/logs/gunicorn_error.log
+ accesslog=/usr/local/www/haiwen/logs/gunicorn_access.log
+ gunicorn_exe=/usr/local/www/haiwen/seafile-server/seahub/thirdpart/bin/gunicorn
+ script_name=seahub.sh
+ [[ start != \s\t\a\r\t ]]
+ [[ start == \s\t\a\r\t ]]
+ [[ 1 == 2 ]]
+ [[ 1 == 1 ]]
+ [[ 1 == 2 ]]
+ port=8000
+ case $1 in
+ start_seahub
+ before_start
+ prepare_env
+ check_python_executable
+ [[ '' != '' ]]
+ which python3.7
+ PYTHON=python3.7
+ validate_ccnet_conf_dir
+ [[ ! -d /usr/local/www/haiwen/ccnet ]]
+ validate_seafile_data_dir
+ [[ ! -d /usr/local/www/haiwen/seafile-data ]]
+ [[ -z '' ]]
+ echo 'LANG is not set in ENV, set to en_US.UTF-8'
LANG is not set in ENV, set to en_US.UTF-8
+ export LANG=en_US.UTF-8
+ LANG=en_US.UTF-8
+ [[ -z '' ]]
+ echo 'LC_ALL is not set in ENV, set to en_US.UTF-8'
LC_ALL is not set in ENV, set to en_US.UTF-8
+ export LC_ALL=en_US.UTF-8
+ LC_ALL=en_US.UTF-8
+ export CCNET_CONF_DIR=/usr/local/www/haiwen/ccnet
+ CCNET_CONF_DIR=/usr/local/www/haiwen/ccnet
+ export SEAFILE_CONF_DIR=/usr/local/www/haiwen/seafile-data
+ SEAFILE_CONF_DIR=/usr/local/www/haiwen/seafile-data
+ export SEAFILE_CENTRAL_CONF_DIR=/usr/local/www/haiwen/conf
+ SEAFILE_CENTRAL_CONF_DIR=/usr/local/www/haiwen/conf
+ export SEAFILE_RPC_PIPE_PATH=/usr/local/www/haiwen/seafile-server/runtime
+ SEAFILE_RPC_PIPE_PATH=/usr/local/www/haiwen/seafile-server/runtime
+ export PYTHONPATH=/usr/local/www/haiwen/seafile-server/seafile/lib/python3.7/site-packages:/usr/local/www/haiwen/seafile-server/seafile/lib64/python3.7/site-packages:/usr/local/www/haiwen/seafile-server/seahub:/usr/local/www/haiwen/seafile-server/seahub/thirdpart:
+ PYTHONPATH=/usr/local/www/haiwen/seafile-server/seafile/lib/python3.7/site-packages:/usr/local/www/haiwen/seafile-server/seafile/lib64/python3.7/site-packages:/usr/local/www/haiwen/seafile-server/seahub:/usr/local/www/haiwen/seafile-server/seahub/thirdpart:
+ warning_if_seafile_not_running
+ pgrep -f 'seafile-controller -c /usr/local/www/haiwen/ccnet'
+ validate_seahub_running
+ pgrep -f /usr/local/www/haiwen/seafile-server/seahub/manage.py
+ pgrep -f seahub.wsgi:application
+ prepare_seahub_log_dir
+ logdir=/usr/local/www/haiwen/logs
+ [[ -d '' ]]
+ mkdir -p /usr/local/www/haiwen/logs
+ export SEAHUB_LOG_DIR=/usr/local/www/haiwen/logs
+ SEAHUB_LOG_DIR=/usr/local/www/haiwen/logs
+ echo 'Starting seahub at port 8000 ...'
Starting seahub at port 8000 ...
+ check_init_admin
+ check_init_admin_script=/usr/local/www/haiwen/seafile-server/check_init_admin.py
+ python3.7 /usr/local/www/haiwen/seafile-server/check_init_admin.py
+ python3.7 /usr/local/www/haiwen/seafile-server/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c /usr/local/www/haiwen/conf/gunicorn.conf.py --preload
python3.7: can't open file '/usr/local/www/haiwen/seafile-server/seahub/thirdpart/bin/gunicorn': [Errno 2] No such file or directory
+ sleep 5
+ pgrep -f seahub.wsgi:application
+ printf '\033[33mError:Seahub failed to start.\033[m\n'
Error:Seahub failed to start.
+ echo 'Please try to run "./seahub.sh start" again'
Please try to run "./seahub.sh start" again
+ exit 1

i try to make a link with the same gunicorn from rc.d script :
ln -s /usr/local/bin/gunicorn-3.7 /usr/local/www/haiwen/seafile-server/seahub/thirdpart/gunicorn

Nothing change but the link work :
[root@lytan /usr/local/www/haiwen/seafile-server]# /usr/local/www/haiwen/seafile-server/seahub/thirdpart/gunicorn
usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: No application module specified.

gunicorn is correctly installed :
[root@lytan /usr/local/www/haiwen/seafile-server]# pkg info | grep gunicorn
py37-gunicorn-19.9.0_1         WSGI HTTP Server for UNIX
[root@lytan /usr/local/www/haiwen/seafile-server]# find / -name gunicorn
/usr/local/lib/python3.7/site-packages/gunicorn
/usr/local/bin/gunicorn
/usr/local/www/haiwen/seafile-server/seahub/thirdpart/gunicorn

In the logs folder, only one file change : ccnet.log
[08/02/20 01:25:59] start to serve on pipe client
[08/02/20 11:57:12] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 13:36:08] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 13:36:35] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:03] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:04] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:06] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:10] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:12] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:13] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:15] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:17] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:17] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:18] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:20] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:21] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/02/20 15:08:24] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/03/20 17:48:31] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/03/20 21:17:46] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/04/20 12:20:29] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/04/20 12:20:34] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/04/20 12:20:37] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/04/20 13:23:25] ../common/connect-mgr.c(210): [conn] incoming handshake fails.
[08/04/20 21:19:09] start to serve on pipe client
[08/04/20 21:20:21] ../common/session.c(337): Exit at Tue Aug  4 21:20:21 2020

[08/04/20 21:23:05] ../common/session.c(148): using config file /usr/local/www/haiwen/conf/ccnet.conf
[08/04/20 21:23:05] ../common/session.c(268): Update pubinfo file
[08/04/20 21:23:05] ../common/connect-mgr.c(515): Opened port 10001 to listen for incoming peer connections
[08/04/20 21:23:05] socket file exists, delete it anyway
[08/04/20 21:31:02] start to serve on pipe client

I upgrade from 7.0 to 7.1 and i use the script in /usr/local/www/haiwen/seafile-server/upgrade/upgrade_7.0_7.1.sh :
[root@lytan /usr/local/www/haiwen/seafile-server/upgrade]# ./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 "/usr/local/www/haiwen/seafile-server/upgrade/db_update_helper.py", line 384, in <module>
    main()
  File "/usr/local/www/haiwen/seafile-server/upgrade/db_update_helper.py", line 379, in main
    db_updater.update_db()
  File "/usr/local/www/haiwen/seafile-server/upgrade/db_update_helper.py", line 275, in update_db
    super(SQLiteDBUpdater, self).update_db()
  File "/usr/local/www/haiwen/seafile-server/upgrade/db_update_helper.py", line 129, in update_db
    self.update_seahub_sql(seahub_sql)
  File "/usr/local/www/haiwen/seafile-server/upgrade/db_update_helper.py", line 299, in update_seahub_sql
    self.apply_sqls(self.seahub_db, sql_path)
  File "/usr/local/www/haiwen/seafile-server/upgrade/db_update_helper.py", line 289, in apply_sqls
    conn.execute(line)
sqlite3.IntegrityError: UNIQUE constraint failed: constance_config.constance_key

Failed to upgrade your database

I don't know where to search.

Thanks for the help.
Comment 1 Boris Tassou 2020-09-14 15:34:19 UTC
Hi,

Even with updates, i still have the issue :
[root@lytan ~]# /usr/local/etc/rc.d/seahub onestart
LANG is not set in ENV, set to en_US.UTF-8
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


Packages have been update :
[root@lytan ~]# pkg info | grep sea
libsearpc-3.2.0_1,1            Simple RPC framework based on GObject System in C
py37-seafdav-7.1.6             Python library for accessing seafile data model
py37-seafobj-7.1.6             Python library for accessing seafile data model
seafile-server-7.1.4           Open Source Cloud Storage (Server)
seahub-7.1.5                   Web frontend for Seafile

If i try the command line in the init script : 
su -m seafile -c '/usr/local/bin/python3.7 "/usr/local/bin/gunicorn-3.7" seahub.wsgi:application -c "/usr/local/www/haiwen/conf/gunicorn.conf.py" -b "127.0.0.1:8000" --preload --chdir "/usr/local/www/haiwen/seafile-server/seahub"'

I have no return/information in the console.

gunicorn.conf.py :
import os

daemon = True
workers = 5

# default localhost:8000
bind = "127.0.0.1:8000"

# Pid
pids_dir = '/usr/local/www/haiwen/pids'
pidfile = os.path.join(pids_dir, 'seahub.pid')

# for file upload, we need a longer timeout value (default is only 30s, too short)
timeout = 1200

limit_request_line = 8190

Some help will be appreciated!

Thanks
Comment 2 Richard Gallamore freebsd_committer 2020-09-14 17:38:08 UTC
Hello Boris,

You should not invoke the seahub.sh startup scripit in the seafile-server folder. Seahub/Seafile is executed under the seafile user and it is possible that invoking it under root will change some of the file permissions.

In order to invoke through cli over service, the command executed is shown when you turned -x on.

> + su -m seafile -c '/usr/local/bin/python3.7 "/usr/local/bin/gunicorn-3.7" seahub.wsgi:application -c "/usr/local/www/haiwen/conf/gunicorn.conf.py" -b "127.0.0.1:8000" --preload --chdir "/usr/local/www/haiwen/seafile-server/seahub"'

Try to invoke this as root and see if it provides more details.

I also suggest deleting or moving all logs before this so we don't have old entries confusing us.

One other tip, I suggest completely uninstalling seafile/seahub and also doing an pkg autoremove. Look into the folder and check the permissions of everything. ccnet, conf, logs, pids, seafile-data and seahub-data should all be owned by seafile as well as files in these directories.

I'm not currently using sqlite, but sqlite files should also be under seafile. Once this has been checked reinstall seafile/seahub and try starting seafile/seahub again.
Comment 3 Boris Tassou 2020-09-16 18:15:17 UTC
I tried the ./seahub.sh because it's in the error message :
[root@lytan ~]# /usr/local/etc/rc.d/seahub onerestart
Seahub is not running
LANG is not set in ENV, set to en_US.UTF-8
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

If i try the su method i haven't any return in the console :
[root@lytan /usr/local/www/haiwen/logs]# su -m seafile -c '/usr/local/bin/python3.7 "/usr/local/bin/gunicorn-3.7" seahub.wsgi:application -c "/usr/local/www/haiwen/conf/gunicorn.conf.py" -b "127.0.0.1:8000" --preload --chdir "/usr/local/www/haiwen/seafile-server/seahub"'
[root@lytan /usr/local/www/haiwen/logs]# ps aux | grep sea
seafile 8619   0.0  0.7 23076 14316  -  Ss   20:11      0:00.01 /usr/local/www/haiwen/seafile-server/seafile/bin/seafile-controller -c /usr/local/www/haiwen/ccnet -d /usr/local/www/haiwen/seafile-data -F /usr/l
seafile 8620   0.0  1.0 29136 19760  -  Ss   20:11      0:00.02 ccnet-server -F /usr/local/www/haiwen/conf -c /usr/local/www/haiwen/ccnet -f /usr/local/www/haiwen/logs/ccnet.log -d -P /usr/local/www/haiwen/pids
seafile 8622   0.0  1.2 49948 24276  -  Ss   20:11      0:00.03 seaf-server -F /usr/local/www/haiwen/conf -c /usr/local/www/haiwen/ccnet -d /usr/local/www/haiwen/seafile-data -l /usr/local/www/haiwen/logs/seafi
root    8666   0.0  0.1 11296  2764  0  S+   20:13      0:00.00 grep sea

i uninstall/remove/reinstall and do "chown -R seafile:seafile /usr/local/www/haiwenn" but nothing change.

In the log file seahub.log i have nothing :

[root@lytan /usr/local/www/haiwen/logs]# cat seahub.log
[root@lytan /usr/local/www/haiwen/logs]# ls -Alrth
total 0
-rw-r--r--  1 seafile  seafile     0B Sep 16 20:12 seahub.log
Comment 4 Richard Gallamore freebsd_committer 2020-09-16 19:39:55 UTC
The su method probably doesn't work because it is expecting environment variables which aren't set. Don't worry about this. I don't suggest using this method anyway.


Instead, to debug this, in /usr/local/www/haiwen/conf/gunicorn.conf.py change the daemon option to False. Then Invoke service seahub onestart. This should provide stdout and stderr to help solve whatever the issue is starting gunicorn.
Comment 5 Boris Tassou 2020-09-16 19:42:28 UTC
Thanks for the help!

With daemon to false :

[root@lytan ~]# /usr/local/etc/rc.d/seahub onestart
LANG is not set in ENV, set to en_US.UTF-8
LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...
Traceback (most recent call last):
  File "/usr/local/bin/gunicorn-3.7", line 11, in <module>
    load_entry_point('gunicorn==19.9.0', 'console_scripts', 'gunicorn')()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 61, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 223, in run
    super(Application, self).run()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 60, in __init__
    self.setup(app)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 120, in setup
    self.app.wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/usr/local/www/haiwen/seafile-server/seahub/seahub/wsgi.py", line 25, in <module>
    application = get_wsgi_application()
  File "/usr/local/lib/python3.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/usr/local/lib/python3.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/usr/local/lib/python3.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: bad magic number in 'seahub.group.models': b'\x03\xf3\r\n'
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again
Comment 6 Richard Gallamore freebsd_committer 2020-09-16 20:46:41 UTC
Did you run the upgrade script for 7.0 to 7.1?

This should be located in /usr/local/www/haiwen/seafile-server/upgrade/
Comment 7 Richard Gallamore freebsd_committer 2020-09-16 21:09:40 UTC
Ok, I'm not sure how you ended up running into that problem as I have not been able to reproduce. On the Seafile forums there was a bug[1] like this. It looks like something to do with your database is causing problems.

In any case, this looks more like a Seafile problem than a port problem. I suggest taking this bug on the Seafile forums.

[1] https://forum.seafile.com/t/seafile-server-7-1-0-is-ready-for-testing-migrate-to-python-3/10566/12
Comment 8 Boris Tassou 2020-09-16 21:14:49 UTC
Yes i use the migration script.

Thanks for the help, i will search on the forum!