Bug 272942 - www/seahub: /usr/local/www/haiwen/seafile-server/seahub/thirdpart/bin/gunicorn - no such file or directory
Summary: www/seahub: /usr/local/www/haiwen/seafile-server/seahub/thirdpart/bin/gunicor...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Richard Gallamore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-04 17:11 UTC by Scott Kitchin
Modified: 2023-08-29 15:06 UTC (History)
4 users (show)

See Also:
ultima: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Kitchin 2023-08-04 17:11:32 UTC
Using FreeBSD 13.2-RELEASE with Python 3.9

When executing seahub using the command './seahub.sh start' and it failed to start.

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...
python3.9: can't open file '/usr/local/www/haiwen/seafile-server/seahub/thirdpart/bin/gunicorn': [Errno 2] No such file or directory
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again
Comment 1 Scott Kitchin 2023-08-04 17:12:45 UTC
It was done with a clean install in jail and error is confirmed.
Comment 2 Boris Tassou 2023-08-24 16:01:22 UTC
Hi,

Same problem on 13.2-RELEASE-p2 after an upgrade.
Comment 3 Richard Gallamore freebsd_committer freebsd_triage 2023-08-24 16:15:33 UTC
It looks like you are trying to use the built-in script, I created custom rc scripts for seafile/seahub. The help message during setup should mention to use: service seahub start
Comment 4 Boris Tassou 2023-08-24 16:38:09 UTC
Seahub still not starting :
https://paste.swordarmor.fr/N3nx
Comment 5 Scott Kitchin 2023-08-24 17:23:19 UTC
Custom rc script still doesn't work.
Comment 6 Richard Gallamore freebsd_committer freebsd_triage 2023-08-24 19:51:48 UTC
Are there any logs here: /usr/local/www/haiwen/seafile-server/logs ?

The seahub.log should be the one you are looking for. If not, you could run the start command in a tty:
su -m seafile -c '/usr/local/bin/python3.9 "/usr/local/bin/gunicorn-3.9" 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"'

There was an option you could pass to gunicorn that forced it to run in the foreground if there was no output. Should be able to run -h to find the correct option.
Comment 7 Boris Tassou 2023-08-25 07:08:56 UTC
there is no log folder in /usr/local/www/haiwen/seafile-server:
[root@seafile /usr/local/www/haiwen/seafile-server]# ls
check-db-type.py		pro.py				seaf-backup-cmd.py		seafile				setup-seafile-mysql.sh
check_init_admin.py		remove-objs.py			seaf-backup-cmd.sh		seafile-background-tasks.sh	setup-seafile.sh
index_op.py			remove-objs.sh			seaf-encrypt.sh			seafile.sh			sql
migrate-repo.py			reset-admin.sh			seaf-fsck.sh			seafobj_migrate.py		sqlite2mysql.py
migrate-repo.sh			run_index_master.sh		seaf-fuse.sh			seahub				sqlite2mysql.sh
migrate.py			run_index_worker.sh		seaf-gc.sh			seahub.sh			upgrade
migrate.sh			runtime				seaf-import.sh			setup-seafile-mysql.py

And the only one i found, no logs in it :
[root@seafile /usr/local/www/haiwen]# find . -name "log*" -type d
./seafile-server/seahub/frontend/src/pages/sys-admin/logs-page
./logs
[root@seafile /usr/local/www/haiwen]# cd logs/
[root@seafile /usr/local/www/haiwen/logs]# ls -Al
total 0

This command doesn't have any output :
[root@seafile /usr/local/www/haiwen/seafile-server]# su -m seafile -c '/usr/local/bin/python3.9 "/usr/local/bin/gunicorn-3.9" 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@seafile /usr/local/www/haiwen/seafile-server]# 

If i run it with -h :
[root@seafile /usr/local/www/haiwen]# su -m seafile -c '/usr/local/bin/python3.9 /usr/local/bin/gunicorn-3.9 -h'
usage: gunicorn-3.9 [OPTIONS] [APP_MODULE]

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -c CONFIG, --config CONFIG
                        :ref:`The Gunicorn config file<configuration_file>`. [./gunicorn.conf.py]
  -b ADDRESS, --bind ADDRESS
                        The socket to bind. [['127.0.0.1:8000']]
  --backlog INT         The maximum number of pending connections. [2048]
  -w INT, --workers INT
                        The number of worker processes for handling requests. [1]
  -k STRING, --worker-class STRING

I tried with this command to have log in debug but nothing :
su -m seafile -c '/usr/local/bin/python3.9 /usr/local/bin/gunicorn-3.9 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 -D --log-config /tmp/gunicorn.log --log-level DEBUG'

The gunicorn.conf.py file :
[root@seafile /usr/local/www/haiwen]# cat /usr/local/www/haiwen/conf/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
Comment 8 Richard Gallamore freebsd_committer freebsd_triage 2023-08-25 07:30:29 UTC
Ah yeah, ok so it was the config, just change the daemon = True to False and it will run in foreground.

Couple questions.
1. Is this a fresh install and configured?
2. Is the seafile service started?

Based on your previous comment, it sounds like seafile is not configured. If both the above are no, please follow the pkg-message instructions after install.

https://www.freshports.org/www/seahub/
Comment 9 Boris Tassou 2023-08-25 07:35:13 UTC
For me, it's an upgrade, this seafile is installed since 3 or 4 years.

I changed to False and now i have :
++ su -m seafile -c '/usr/local/bin/python3.9 "/usr/local/bin/gunicorn-3.9" 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"'
Traceback (most recent call last):
  File "/usr/local/bin/gunicorn-3.9", line 33, in <module>
    sys.exit(load_entry_point('gunicorn==21.2.0', 'console_scripts', 'gunicorn')())
  File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 67, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 236, in run
    super().run()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 58, in __init__
    self.setup(app)
  File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 118, in setup
    self.app.wsgi()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.9/site-packages/gunicorn/util.py", line 371, in import_app
    mod = importlib.import_module(module)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/www/haiwen/seafile-server/seahub/seahub/wsgi.py", line 25, in <module>
    application = get_wsgi_application()
  File "/usr/local/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/usr/local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.9/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/usr/local/lib/python3.9/site-packages/django/apps/config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/www/haiwen/seafile-server/seahub/seahub/avatar/models.py", line 28, in <module>
    from seahub.avatar.util import invalidate_cache, get_avatar_file_storage
  File "/usr/local/www/haiwen/seafile-server/seahub/seahub/avatar/util.py", line 8, in <module>
    from seahub.avatar.settings import AVATAR_DEFAULT_URL, AVATAR_CACHE_TIMEOUT,\
  File "/usr/local/www/haiwen/seafile-server/seahub/seahub/avatar/settings.py", line 25, in <module>
    AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

Seafile is already running :
[root@lytan /usr/local/www/haiwen]# ps aux | grep seafile
seafile   1076   0.0  0.1   25276    5188  -  Ss   17:54      0:01.52 /usr/local/www/haiwen/seafile-server/seafile/bin/seafile-controller -c /usr/local/www/haiwen/ccnet -d /private/seafile/
seafile   1078   0.0  0.3  109064   10712  -  Ss   17:54      0:03.86 seaf-server -F /usr/local/www/haiwen/conf -c /usr/local/www/haiwen/ccnet -d /private/seafile/ -l /var/log/seafile/seafi
root     43031   0.0  0.0   12812    2072  1  S+   09:34      0:00.00 grep seafile
Comment 10 Richard Gallamore freebsd_committer freebsd_triage 2023-08-25 07:40:01 UTC
(In reply to Boris Tassou from comment #9)
Did you run the upgrade scripts? What version did you upgrade from?

You'll need to run every upgrade from whatever version you are on to the installed version. If you haven't upgraded for 3 to 4 years, you will probably have several to run.
Comment 11 Richard Gallamore freebsd_committer freebsd_triage 2023-08-25 07:44:33 UTC
(In reply to Boris Tassou from comment #9)
Disregard my previous comment, it looks like the error is pillow's recent update to 10 which removed ANTIALIAS is 10.0.0. If you are able to rollback pillow, that should fix your issue.
Comment 12 Boris Tassou 2023-08-25 08:00:07 UTC
(In reply to Richard Gallamore from comment #11)
I can't downgrade it, it comes with seahub in dependances.

[root@seafile /usr/local/www/haiwen]# pkg remove py39-pillow
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 4 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
	py39-django-simple-captcha: 0.5.14_1
	py39-pillow: 10.0.0_1
	py39-qrcode: 7.4
	seahub: 9.0.10
Comment 13 Richard Gallamore freebsd_committer freebsd_triage 2023-08-25 16:21:11 UTC
(In reply to Boris Tassou from comment #12)
If you have the old pillow package, I think you should be able to force-install it. I'll try and set up a repro to give specific instructions later today.
Comment 14 Boris Tassou 2023-08-25 17:48:35 UTC
(In reply to Richard Gallamore from comment #13)

I had this package in the pkg cache folder! 
But another error with the version 9.5.0 :
https://paste.swordarmor.fr/FNkr

thanks for your help!
Comment 15 Richard Gallamore freebsd_committer freebsd_triage 2023-08-25 19:14:56 UTC
I recommend moving to the quarterly branch until this can be sorted out. Just tested the quarterly branch and a fresh install is working fine.
Comment 16 Po-Chuan Hsieh freebsd_committer freebsd_triage 2023-08-25 19:24:24 UTC
It seems the problem has been fixed in this commit [1]. I could run the above command in Comment #9 successfully. Please try this patch [2].

[1] https://github.com/haiwen/seahub/commit/cbe0817f2bee0c2b00d3ffd3e047c3141862c6c5
[2] https://people.freebsd.org/~sunpoet/patch/www-seahub.txt
Comment 17 Boris Tassou 2023-08-25 20:33:02 UTC
(In reply to Po-Chuan Hsieh from comment #16)
with this patch, i no longer have the error for PIL, but still this error when i try to access to seafile:
https://paste.swordarmor.fr/gqMz
Comment 18 Boris Tassou 2023-08-25 20:35:21 UTC
(In reply to Boris Tassou from comment #17)

Disregard this comment, if i install : pkg install py39-packaging
seahub start \o/
Comment 19 commit-hook freebsd_committer freebsd_triage 2023-08-26 17:32:25 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ffaa8cd925c26ff03e8d7e358b9fa54e774a9db5

commit ffaa8cd925c26ff03e8d7e358b9fa54e774a9db5
Author:     Richard Gallamore <ultima@FreeBSD.org>
AuthorDate: 2023-08-26 17:24:40 +0000
Commit:     Richard Gallamore <ultima@FreeBSD.org>
CommitDate: 2023-08-26 17:24:40 +0000

    www/seahub: Patch for new version of Pillow

    PR: 272942
    Reported by: Scott Kitchin (scott@kitchin.com), Boris Tassou (boris.tassou@securmail.fr)
    Submitted by: sunpoet
    Obtained from: Seafile

 www/seahub/Makefile                 |  3 ++-
 www/seahub/files/patch-pillow (new) | 50 +++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
Comment 20 Richard Gallamore freebsd_committer freebsd_triage 2023-08-26 17:36:29 UTC
Committed, thanks everyone.
Comment 21 Scott Kitchin 2023-08-28 19:50:18 UTC
The patched seahub-9.0.10_1 doesn't work without py39-packaging installed as it displayed 'internal server error' on the browser.  You need to include py39-packaging as a required package.
Comment 22 Richard Gallamore freebsd_committer freebsd_triage 2023-08-28 20:47:19 UTC
(In reply to Scott Kitchin from comment #21)
Thanks Scott, yes I see what you mean now... This is a missing dependency in gunicorn.

https://github.com/benoitc/gunicorn/blob/master/setup.py#L75
Comment 23 Richard Gallamore freebsd_committer freebsd_triage 2023-08-28 20:53:02 UTC
Created: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273412 for the missing depend.