haiwen / seafile-docker

A Docker image for Seafile server
Other
544 stars 184 forks source link

[BUG] Unable to setup fresh instance in seafileltd/seafile-mc:latest #181

Closed TechupBusiness closed 4 years ago

TechupBusiness commented 4 years ago

I was not able to setup a new instance because of an unfortunate chicken-egg issue...

First issue is, that the missing folder seafile-server-latest, because it can't find setup-seafile-mysql.py. I thought I could fix it by placing a symlink: ln -s /opt/seafile/seafile-server-7.0.4 /opt/seafile/seafile-server-latest

It was not a solution (read further down why)...

Error was:

seafile_1    | *** Running /scripts/start.py...
seafile_1    | Oct  2 15:33:35 b1f061e04940 cron[29]: (CRON) INFO (pidfile fd = 3)
seafile_1    | Oct  2 15:33:35 b1f061e04940 cron[29]: (CRON) INFO (Running @reboot jobs)
seafile_1    | [2019-10-02 15:33:35] Now running setup-seafile-mysql.py in auto mode.
seafile_1    | sed: can't read /opt/seafile/seafile-server-latest/setup-seafile-mysql.py: No such file or directory
seafile_1    | Traceback (most recent call last):
seafile_1    |   File "/scripts/start.py", line 86, in <module>
seafile_1    |     main()
seafile_1    |   File "/scripts/start.py", line 56, in main
seafile_1    |     init_seafile_server()
seafile_1    |   File "/scripts/bootstrap.py", line 134, in init_seafile_server
seafile_1    |     .format(get_script('setup-seafile-mysql.py')))
seafile_1    |   File "/scripts/utils/__init__.py", line 69, in call
seafile_1    |     return subprocess.check_call(*a, **kw)
seafile_1    |   File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
seafile_1    |     raise CalledProcessError(retcode, cmd)
seafile_1    | subprocess.CalledProcessError: Command 'sed -i -e '/def validate_mysql_user_host(self, host)/a \ \ \ \ \ \ \ \ return host' /opt/seafile/seafile-server-latest/setup-seafile-mysql.py' returned non-zero exit status 2
seafile_1    | *** /scripts/start.py exited with status 1.
seafile_1    | *** Shutting down runit daemon (PID 24)...
seafile_1    | *** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown...
seafile_1    | Oct  2 15:33:36 b1f061e04940 syslog-ng[17]: syslog-ng shutting down; version='3.13.2'
seafile_1    | *** Killing all processes...

Temporary tried WORKAROUND:

Create a Dockerfile and add the content:

FROM seafileltd/seafile-mc:latest
RUN ln -s /opt/seafile/seafile-server-7.0.4 /opt/seafile/seafile-server-latest

In docker-compose.yml replace

    image: seafileltd/seafile-mc:latest

with:

    build:
      context: .
      dockerfile: "Dockerfile"

UNFORTUNATELY start.py is trying to create this symlink and kills all processes because it already exists:

[...]
seafile_1    | Now creating seahub database tables ...
seafile_1    | 
seafile_1    | ----------------------------------------
seafile_1    | 
seafile_1    | creating seafile-server-latest symbolic link ...  
seafile_1    | 
seafile_1    | 
seafile_1    | Error: Failed to create symbolic link /opt/seafile/seafile-server-latest: [Errno 17] File exists
seafile_1    | Traceback (most recent call last):
seafile_1    |   File "/scripts/start.py", line 86, in <module>
seafile_1    |     main()
seafile_1    |   File "/scripts/start.py", line 56, in main
seafile_1    |     init_seafile_server()
seafile_1    |   File "/scripts/bootstrap.py", line 140, in init_seafile_server
seafile_1    |     call('{} auto -n seafile'.format(setup_script), env=env)
seafile_1    |   File "/scripts/utils/__init__.py", line 69, in call
seafile_1    |     return subprocess.check_call(*a, **kw)
seafile_1    |   File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
seafile_1    |     raise CalledProcessError(retcode, cmd)
seafile_1    | subprocess.CalledProcessError: Command '/opt/seafile/seafile-server-latest/setup-seafile-mysql.sh auto -n seafile' returned non-zero exit status 1
seafile_1    | *** /scripts/start.py exited with status 1.
seafile_1    | *** Shutting down runit daemon (PID 26)...
seafile_1    | *** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown...
seafile_1    | Oct  2 15:38:38 5803909278c7 syslog-ng[17]: syslog-ng shutting down; version='3.13.2'
seafile_1    | *** Killing all processes...
TechupBusiness commented 4 years ago

@lins05 @freeplant

It's a pity that there seems to be low interest by the developer company in China, to notice and take care of obvious bugs.

After digging deep into the manual and checking the installation scripts, I decided to stop the project "creating a proper seafile-ce docker image". The software is not made for easy configuration and automated deployment. No wonder it needs lot's of complicated scripts here in this docker github to make it running (and it still don't work then). And these scripts use undocumented features like adding the admin credentials via txt file etc, I don't get why it needs to be so complicated and undocumented. Again: a pity.

If this application would support a proper setup via environment variables in the core of the application, there would be no need for many complicated scripts here. For the moment I need to say goodbye to this project and will check later if it progressed further into the not-so-new world of containerization.

renfeipeng commented 4 years ago

If you are new to launch an instance, I can't think of any reason for this problem. I tested it myself many times and not found such bug.

seafile | Now creating seahub database tables ... seafile | seafile | ---------------------------------------- seafile | seafile | creating seafile-server-latest symbolic link ... done seafile | seafile | seafile | seafile | seafile | ----------------------------------------------------------------- seafile | Your seafile server configuration has been finished successfully. seafile | ----------------------------------------------------------------- seafile | seafile | run seafile server: ./seafile.sh { start | stop | restart } seafile | run seahub server: ./seahub.sh { start | stop | restart } seafile |