Gronis / docker-seafile

A seafile server docker container
MIT License
33 stars 12 forks source link

First run results in ModuleNotFoundError: No module named 'seaserv' #12

Closed axtgr closed 1 year ago

axtgr commented 1 year ago

Running this command:

docker run --rm -e "SEAFILE_NAME=Seafile" -e "SEAFILE_ADDRESS=seafile.example.com" -e "SEAFILE_ADMIN=admin@seafile.example.com" -e "SEAFILE_ADMIN_PW=SuperSecretPassword" gronis/seafile

produces the following log:

Python 3.9.2
ldd (Debian GLIBC 2.31-13+deb11u2) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
ls: cannot access '/opt/haiwen/ccnet': No such file or directory
/tmp/seafile.env: line 2: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

Seahub is not running
Done.

/tmp/seafile.env: line 2: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

seafile server not running yet
Done.
Copying /opt/haiwen/seafile-server-9.0.9/seahub/media/avatars => /seafile/seahub-data/avatars
Dropping /opt/haiwen/seafile-server-9.0.9/seahub/media/avatars
Linking /opt/haiwen/seahub-data => /seafile/seahub-data
Linking /opt/haiwen/seafile-server-9.0.9/seahub/media/avatars => /seafile/seahub-data/avatars
/tmp/seafile.env: line 2: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

Error: there is no conf/ directory.
Have you run setup-seafile.sh before this?

setup_sqlite
/tmp/seafile.env: line 2: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Checking packages needed by seafile ...

Checking python on this machine ...
Find python: python3

  Checking python module: python-sqlite3 ... Done.

Checking for sqlite3 ...Done.

Checking Done.

This is your config information:

server name:        Seafile
server ip/domain:   seafile.example.com
seafile data dir:   /opt/haiwen/seafile-data
fileserver port:    8082
Generating ccnet configuration in /opt/haiwen/ccnet...

Generating seafile configuration in /opt/haiwen/seafile-data ...

Creating database now, it may take one minute, please wait... 

/seafile

Done.

creating seafile-server-latest symbolic link ... done

-----------------------------------------------------------------
Your seafile server configuration has been completed successfully.
-----------------------------------------------------------------

run seafile server:     ./seafile.sh { start | stop | restart }
run seahub  server:     ./seahub.sh  { start <port> | stop | restart <port> }

-----------------------------------------------------------------
If the server is behind a firewall, remember to open these tcp ports:
-----------------------------------------------------------------

port of seafile fileserver:   8082
port of seahub:               8000

When problems occur, refer to

      https://download.seafile.com/published/seafile-manual/home.md

for more information.

/tmp/seafile.env: line 2: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

Starting seafile server, please wait ...
** Message: 09:03:36.204: seafile-controller.c(621): No seafevents.

Seafile server started

Done.
/tmp/seafile.env: line 2: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Traceback (most recent call last):
  File "/opt/haiwen/seafile-server-9.0.9/check_init_admin.py", line 19, in <module>
    from seaserv import ccnet_api
ModuleNotFoundError: No module named 'seaserv'

I've tried using the older 9.0.* versions, but they all throw the same error.

axtgr commented 1 year ago

The error is fixed by adjusting PYTHONPATH:

export PYTHONPATH="/opt/haiwen/seafile-server-${VERSION}/seafile/lib/python3/site-packages"

However, another error appears:

Linking /opt/haiwen/ccnet => /seafile/ccnet
Linking /opt/haiwen/conf => /seafile/conf
Linking /opt/haiwen/seafile-data => /seafile/seafile-data
Linking /opt/haiwen/seahub-data => /seafile/seahub-data
ln: failed to create symbolic link '/opt/haiwen/seahub-data/seahub-data': Permission denied

The reason is that /opt/haiwen/seahub-data/seahub-data already exists at the moment of linking. If I add a line to seafile-entrypoint.sh that deletes the directories before linking, the script finishes successfully and Seafile seems to work fine.

My final entrypoint in docker-compose looks like this:

entrypoint: /bin/sh -c '
      export PYTHONPATH="/opt/haiwen/seafile-server-$${VERSION}/seafile/lib/python3/site-packages"
      && sed "256 i rm -rf \$${ARGS[1]}" -i /usr/local/bin/seafile-entrypoint.sh
      && /usr/local/bin/seafile-entrypoint.sh'
Gronis commented 1 year ago

Thanks for reporting! I have changed the setup script accordingly: