haiwen / seafile-docker

A Docker image for Seafile server
Other
536 stars 181 forks source link

Migration from non-docker not working #307

Closed mainboarder closed 1 year ago

mainboarder commented 1 year ago

There seem to be multiple errors in the documentation for migrating from non docker:

docker-compose logs
Attaching to seafile, seafile-memcached
seafile      | *** Running /etc/my_init.d/01_create_data_links.sh...
seafile      | *** Booting runit daemon...
seafile      | *** Runit started as PID 21
seafile      | *** Running /scripts/enterpoint.sh...
seafile      | 2022-08-27 19:19:35 Nginx ready 
seafile      | 2022-08-27 19:19:35 This is an idle script (infinite loop) to keep container running. 
seafile      | [08/27/2022 19:19:35][upgrade]: The container was recreated, start fix the media symlinks
seafile      | [08/27/2022 19:19:35][upgrade]: Done
seafile      | 
seafile      | Starting seafile server, please wait ...
seafile      | 
seafile      | ** (process:82): WARNING **: 19:19:36.119: seafile-controller.c(586): invalid config_dir: /opt/seafile/ccnet
seafile      | 
seafile      | 
seafile      | ** (process:82): WARNING **: 19:19:36.119: seafile-controller.c(64): seaf-controller exited with code 1
seafile      | 
seafile      | Failed to start seafile server
seafile      | [2022-08-27 19:19:35] Skip running setup-seafile-mysql.py because there is existing seafile-data folder.
seafile      | Traceback (most recent call last):
seafile      |   File "/scripts/start.py", line 86, in <module>
seafile      |     main()
seafile      |   File "/scripts/start.py", line 71, in main
seafile      |     call('{} start'.format(get_script('seafile.sh')))
seafile      |   File "/scripts/utils.py", line 70, in call
seafile      |     return subprocess.check_call(*a, **kw)
seafile      |   File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
seafile      |     raise CalledProcessError(retcode, cmd)
seafile      | subprocess.CalledProcessError: Command '/opt/seafile/seafile-server-9.0.7/seafile.sh start' returned non-zero exit status 1.

So I copied the ccnet directory, chowned to -R root:root and added - /opt/seafile-data/ccnet:/opt/seafile/ccnet to volumes in docker-compose -> This is different from the manual

Afterwards it looked better, but seahub is not able to run. I got a Bad Gateway from nginx. So I entered the container:

docker exec -ti seafile /bin/bash
root@5075ec5b2b8b:/opt/seafile# /opt/seafile/seafile-server-latest/seahub.sh stop

Seahub is not running
Done.

root@5075ec5b2b8b:/opt/seafile# /opt/seafile/seafile-server-latest/seafile.sh stop

Stopping seafile server ...
Done.
root@5075ec5b2b8b:/opt/seafile# /scripts/enterpoint.sh 
2022-08-27 19:33:48 Nginx ready 
2022-08-27 19:33:48 This is an idle script (infinite loop) to keep container running. 
[2022-08-27 19:33:48] Skip running setup-seafile-mysql.py because there is existing seafile-data folder.

Starting seafile server, please wait ...
** Message: 19:33:49.310: seafile-controller.c(621): No seafevents.

Seafile server started

Done.

Starting seahub at port 8000 ...
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again
Traceback (most recent call last):
  File "/scripts/start.py", line 86, in <module>
    main()
  File "/scripts/start.py", line 72, in main
    call('{} start'.format(get_script('seahub.sh')))
  File "/scripts/utils.py", line 70, in call
    return subprocess.check_call(*a, **kw)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/opt/seafile/seafile-server-9.0.7/seahub.sh start' returned non-zero exit status 1.

The seahub log is empty.

running on debian 10. with seafile 9.0.7 (docker) comming from 9.0.7 non-docker.

How do I get seafile to work in docker?

SkywalkerSpace commented 1 year ago

We need more error logs to troubleshoot problems. Please add the following contents to the /opt/seafile/conf/gunicorn.py configuration file.

# Log
accesslog = '/opt/seafile/logs/gunicorn-access.log'
errorlog = '/opt/seafile/logs/gunicorn-error.log'

And then execute /scripts/start.py &. There will be more detailed errors in the /opt/seafile/logs/gunicorn-error.log log file.

mainboarder commented 1 year ago

Hi, I did some testing now. First of all, I changed seatable to seafile in all of your code, as I work with seafile and there is no seatable directory under /opt.

In the meantime I updated to the latest version. From 9.0.7 to 9.0.9. First there was an error, that the user (root) running the script is not the owner of /shared/seafile/seafile-data. So I chown the underlying host-fs directory. This might be missing in the manual. And I would add it, when I get my installation migrated to docker. This one looks new with version 9.0.9. Afterwards it now looks like:

root@5882b399275a:/opt/seafile# /scripts/enterpoint.sh 
2022-10-08 13:07:14 Nginx ready 
2022-10-08 13:07:14 This is an idle script (infinite loop) to keep container running. 
[2022-10-08 13:07:14] Skip running setup-seafile-mysql.py because there is existing seafile-data folder.

Starting seafile server, please wait ...

** (process:153): WARNING **: 13:07:15.111: seafile-controller.c(586): invalid config_dir: /opt/seafile/ccnet

** (process:153): WARNING **: 13:07:15.112: seafile-controller.c(64): seaf-controller exited with code 1

Failed to start seafile server
Traceback (most recent call last):
  File "/scripts/start.py", line 86, in <module>
    main()
  File "/scripts/start.py", line 71, in main
    call('{} start'.format(get_script('seafile.sh')))
  File "/scripts/utils.py", line 70, in call
    return subprocess.check_call(*a, **kw)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/opt/seafile/seafile-server-9.0.9/seafile.sh start' returned non-zero exit status 1.

Again the ccnet error. Good thing: I forgot about it and so I now did not copy the directory, but I created it in the container. Now it works.

But this seems to be a bug for me. In the container should /opt/seafile/ccnet exist, mounted from Host or at least it should be in the manual, shouldn't it? Or is this special with my installation? I did not find this path in my config files.

Tl;dr:

chown -R root:root <HOST-FS/home/seafile/seafile-data> #if you use method 2 here: https://manual.seafile.com/docker/non_docker_to_docker/#method-2
docker-compose up -d
docker exec -ti seafile mkdir /opt/seafile/ccnet
docker-compose down && docker-compose up -d

Test with:

docker exec -ti seafile /bin/bash
/opt/seafile/seafile-server-latest/seahub.sh stop && /opt/seafile/seafile-server-latest/seafile.sh stop
/scripts/enterpoint.sh
SkywalkerSpace commented 1 year ago

Sorry I wrote the wrong path. (> _ <)

/opt/seafile/ccnet is a symbolic link generated by the startup script. You can create the real ccnet directory in the Host.

eg: mkdir /opt/seafile/shared/seafile/ccnet

You can find the parent path in docker-compose.yml: seafile: volumes:

mainboarder commented 1 year ago

I can confirm everything works now! Thank you!