When spinning up a fresh container, I receive the following error halfway through the initial setup script:
seafile | Starting seahub... seafile | + echo 'Starting seahub...' seafile | + ./seahub.sh start-fastcgi seafile | seafile | LANG is not set in ENV, set to en_US.UTF-8 seafile | LC_ALL is not set in ENV, set to en_US.UTF-8 seafile | ./seahub.sh: line 209: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) seafile | Starting seahub (fastcgi) at 127.0.0.1:8000 ... seafile | seafile | Error happened during creating seafile admin.
This is a snippet from the logs. The container starts fine, and I can actually get to the login page, but since the admin account has not been created, I cannot log in.
I’ve been digging through the Seafile codebase to find out where this pops up, and it looks like the check_init_admin.py
file is where the exception is thrown, which is called by seahub.sh
.
I’m creating the container using the following docker-compose
:
version: '3'
services:
cloud:
container_name: seafile
image: stonemaster/docker-seafile-server
volumes:
- /containers/Seafile:/data
expose:
- "80"
environment:
- SEAFILE_EXTERNAL_PORT=80
- SEAFILE_HOSTNAME=localhost
- SEAFILE_SERVER_NAME=test
- SEAFILE_ADMIN_EMAIL=actual@email.com
- SEAFILE_ADMIN_PASSWORD=password
networks:
default:
external:
name: nginx-proxy
There is another reverse proxy in front of this container. I’m assuming this won’t interfere with the admin creation process, but I’m still mentioning it just in case.
By the way: thanks for creating this. It is much, much better than the strange dockerfile wrapper script presented by the Seafile devs themselves.
Содержание
- Creation of initial seafile admin fails #5
- Comments
- http://host:8000 after seafile-admin start #743
- Comments
- It’s the first time you start the seafile server. Now let’s create the admin account
- Successfully created seafile admin
- it is supposed to trig to build all dependencies (including ccnet, libsearpc, and seafile)
- The default install directory is under /usr/local/www/haiwen/
- User have to manually copy linux server version seahub/thirdpart contents because I don’t know whether the
- freebsd port system allows me to hold another tar there
- I also don’t want to deal with every python modules
- make sure that you have the following in the above directory
- You should following the manual book to change path, and config
- You should following the manual book to change path, and config
Creation of initial seafile admin fails #5
When spinning up a fresh container, I receive the following error halfway through the initial setup script:
This is a snippet from the logs. The container starts fine, and I can actually get to the login page, but since the admin account has not been created, I cannot log in.
I’ve been digging through the Seafile codebase to find out where this pops up, and it looks like the check_init_admin.py file is where the exception is thrown, which is called by seahub.sh .
I’m creating the container using the following docker-compose :
There is another reverse proxy in front of this container. I’m assuming this won’t interfere with the admin creation process, but I’m still mentioning it just in case.
By the way: thanks for creating this. It is much, much better than the strange dockerfile wrapper script presented by the Seafile devs themselves.
The text was updated successfully, but these errors were encountered:
Could you give some information on the Docker and Docker-compose versions used?
I have a similar setup in use with an NGINX Reverse proxy and that definitely doesn’t interfer.
This indeed is a strange bug because the Travis Build runs some unit tests and the admin creation is essential for anything to work.
- Is there maybe a permission problem of some sort with the host mount /containers/Seafile ?
- And could you check dmesg / syslog output to problems related to SELinux or other things interfering with docker?
- What happens without the host mount (not persitent of course)?
- EDITED: What distribution do you use?
My Docker host is an Ubuntu server 17.10 machine, with Docker version 17.12.0-ce and Docker-compose version 1.18.0 .
I’ve been testing around some more (also based on your questions). Not mounting the volume still gives the same creation error, so it does not seem to be a permission error on the volume itself. As far as any dmesg logs, there are no things out of the ordinary. I tried looking into some other logging, but Seafile itself does not log a lot regarding the python bootstrap scripts they are providing, so it seems like a dead end there.
However, I found something interesting. Executing the docker run equivalent of my compose file does work. So that would be the following (minus the volume, still for testing purposes):
So this seems to be an issue related to Docker-compose?
This is super weird. To my understanding docker-compose is just wrapper for docker and shouldn’t do any extra stuff. I have docker 1.13 and docker-compose 1.8 , so much older versions than you. I am also using Ubuntu but 16.04.
Could you post the logs of Docker after trying to create the container using docker-compose ? You should be able to get the logs using journalctl -u docker -n 1000 on Ubuntu.
The following is the resulting log of specifically creating the container.
And using docker run :
They seem identical regarding the operations themselves. The moment the creation error pops up, there is no log entry created by Docker.
Could it be a rights issue, that UID and GID need to be passed into the container to properly work when using docker-compose ? I’m guessing here, as it seems to be a longshot.
Just encountered similar with a manual build on Ubuntu 20.04 and Seafile 7.1.5
Starting seahub.sh asks for admin email and password then gives the above error «Error happened during creating seafile admin»
Except in my case I cannot access the site at this point and on server curl 127.0.0.1:8000 returns nothing
Of note I did need to install libmemcached-dev via apt before I could install pylibmc and django-pylibmc via pip3
Источник
http://host:8000 after seafile-admin start #743
I am porting the 3.0.4 to FreeBSD 9.2 Release. I understand that you have no support. Although some ports dependencies are not fully written, the build, installation, and init runs for major components seem fine. I have a question, without setting apache or Ngix, what I should expect to http://host:8000 just after
I hit 500 Internal Server Error, does it mean httpserver has problem? Which log file I can triage what happens.
The text was updated successfully, but these errors were encountered:
It is quite interesting for me to find out that someone installed seafile sucessfully under freebsd.
I believe you forgot execute ./manage.py syncdb in seahub directory before you start seafile. Or you can reference our manual
You might want to turn on django’s debug mode to get more information by adding a line to seahub_setting.py :
PS: I spent some hours compiling seafile under FreeBSD, and only found out I got stuck with libevent2. I referenced some old issues with BSDs support (e.g. haiwen/ccnet#4 ) . I thought it is non-trivial work and I will look into the BSDs support of seafile once I get some free time. And it would be very awesome if you can contribute back to seafile.
I would contribute to a bounty on this. big-grizzly will your work help us get the server running on FreeNAS?
Somehow the above issue is resolved because I know there is something missing for FreeBSD code. Now the important problem in front of me is all the servers are running. But the downloading file size is always 0 byte, although the file size show in main web interface is 200+K bytes. When uploading, connection is always failed.
Yes, if possible, I would like to help FreeBSD, and FreeNAS community to port this project.
big-grizzly, you might want to comment here —> http://forums.pcbsd.org/showthread.php?t=22607
you might get some support, if others know you are working on the project already. I put in a ticket with ixsystems asking them what it would take to get this into FreeNAS.
Hi @big-grizzly @stephenhoos
It sounds coooooooool to get seafile into FreeNAS.
If there is anything I can help with, please don’t hesitate to cc me, or email me rwindz0 AT gmail DOT c0m.
I am not a programmer just a sysadmin, so I can help with testing, but not programming. I run a few FreeNAS boxes, and I can spin up VMs too, so let me know if you need help with testing or anything like that.
big_grizzly, you do not have permission to access this page. This could be due to one of several reasons:
1. Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else’s post, access administrative features or some other privileged system?
2. If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
It seems that I hit some issue to post reply.
On Monday, August 11, 2014 10:55 AM, stephenhoos notifications@github.com wrote:
I am not a programmer just a sysadmin, so I can help with testing, but not programming. I run a few FreeNAS boxes, and I can spin up VMs too, so let me know if you need help with testing or anything like that.
—
Reply to this email directly or view it on GitHub.
big_grizzly, where are you having the problem? It looks like your reply
showed up on github
On Wed, Aug 13, 2014 at 3:06 PM, big-grizzly notifications@github.com
wrote:
big_grizzly, you do not have permission to access this page. This could be
due to one of several reasons:
- Your user account may not have sufficient privileges to access this
page. Are you trying to edit someone else’s post, access administrative
features or some other privileged system? - If you are trying to post, the administrator may have disabled your
account, or it may be awaiting activation.
It seems that I hit some issue to post reply.
On Monday, August 11, 2014 10:55 AM, stephenhoos notifications@github.com
wrote:
I am not a programmer just a sysadmin, so I can help with testing, but not
programming. I run a few FreeNAS boxes, and I can spin up VMs too, so let
me know if you need help with testing or anything like that.
—
Reply to this email directly or view it on GitHub.
—
Reply to this email directly or view it on GitHub
#743 (comment).
some patches for FreeBSD(or FreeNAS, untested though)
sadly, seafile (seaf-daemon) requires additional support for fs change watch via kqueue, so building seafile-client (gui) would be quite tough.
Now the major parts work, and libsearpc, and ccnet can pass poudriere in freebsd ports. I am working on finalize sea file ports. There could be small script issue because one script still hangs somewhere.
My working version is on 9.3-release amd64 (the uploading and downloading issues are gone)
On Friday, August 22, 2014 11:13 AM, Chilledheart notifications@github.com wrote:
some patches for FreeBSD(or FreeNAS, untested though)
* ccnet https://github.com/Chilledheart/ccnet/tree/bsd_support
* seafile https://github.com/Chilledheart/seafile/tree/bsd_support
sadly, seafile (seaf-daemon) requires additional support for fs change watch via kqueue, so building seafile-client (gui) would be quite tough.
—
Reply to this email directly or view it on GitHub.
root@freebsd93:/usr/local/www/haiwen/seafile-server # ./seahub.sh restart
Seahub is not running
Starting seahub at port 8000 .
It’s the first time you start the seafile server. Now let’s create the admin account
What is the email for the admin account?
[ admin email ] yan_jingfeng@yahoo.com
What is the password for the admin account?
[ admin password ]
Enter the password again:
[ admin password again ]
Successfully created seafile admin
Loading ccnet config from /usr/local/www/haiwen/ccnet
Loading seafile config from /usr/local/www/haiwen/seafile-data
Seahub is started
Created libevhtp (initial in freebsd already, need some correction), libsearpc, ccnet, sea file, and sea hub ports. Will submit to ports within one-two days.
On Friday, August 22, 2014 11:13 AM, Chilledheart notifications@github.com wrote:
some patches for FreeBSD(or FreeNAS, untested though)
* ccnet https://github.com/Chilledheart/ccnet/tree/bsd_support
* seafile https://github.com/Chilledheart/seafile/tree/bsd_support
sadly, seafile (seaf-daemon) requires additional support for fs change watch via kqueue, so building seafile-client (gui) would be quite tough.
—
Reply to this email directly or view it on GitHub.
bug list 193132,193133,193134,and 193135 to freebsd port tree (libevhtp has been committed, should be 1.2.9_1 soon)
it is supposed to trig to build all dependencies (including ccnet, libsearpc, and seafile)
make install
make clean
The default install directory is under /usr/local/www/haiwen/
User have to manually copy linux server version seahub/thirdpart contents because I don’t know whether the
freebsd port system allows me to hold another tar there
I also don’t want to deal with every python modules
make sure that you have the following in the above directory
[files]
drwxr-xr-x 6 root wheel 25 Aug 28 05:54 wsgidav
drwxr-xr-x 5 root wheel 5 Aug 28 05:54 Djblets-0.6.14.dev-py2.6.egg
drwxr-xr-x 4 root wheel 10 Aug 28 05:54 seafobj.orig
drwxr-xr-x 4 root wheel 4 Aug 28 05:54 gunicorn-0.16.1-py2.6.egg
drwxr-xr-x 4 root wheel 4 Aug 28 05:55 python_daemon-1.5.5-py2.6.egg
drwxr-xr-x 4 root wheel 4 Aug 28 05:55 lockfile-0.9.1-py2.6.egg
drwxr-xr-x 4 root wheel 4 Aug 28 05:55 chardet-2.1.1-py2.6.egg
drwxr-xr-x 4 root wheel 4 Aug 28 05:55 flup-1.0-py2.6.egg
drwxr-xr-x 4 root wheel 4 Aug 28 05:55 Django-1.5.1-py2.6.egg
-rwxr-xr-x 1 root wheel 326 Aug 28 05:55 gunicorn_django
-rw-r—r— 1 root wheel 397 Aug 28 05:55 easy-install.pth
-rwxr-xr-x 1 root wheel 191 Aug 28 05:55 django-admin.py
-rwxr-xr-x 1 root wheel 190 Aug 28 05:55 chardetect.py
-rw-r—r— 1 root wheel 2362 Aug 28 05:55 site.py
-rwxr-xr-x 1 root wheel 343 Aug 28 05:55 seafdav.orig
-rwxr-xr-x 1 root wheel 326 Aug 28 05:55 gunicorn_paster
-rwxr-xr-x 1 root wheel 312 Aug 28 05:55 gunicorn
-rw-r—r— 1 root wheel 1767 Aug 28 05:55 site.pyc
drwxr-xr-x 3 root wheel 5 Aug 28 05:55 six-1.4.1-py2.6.egg
drwxr-xr-x 4 root wheel 21 Aug 28 06:12 rest_framework
drwxr-xr-x 4 root wheel 9 Aug 28 06:12 registration
drwxr-xr-x 4 root wheel 10 Aug 28 06:12 captcha
[files]
mount -t procfs proc /proc
cd /usr/local/www/haiwen/seafile-server/seahub
for file in makemessages.sh.template run-seahub.sh.template send_user_notifications.sh.template setenv.sh.template; do
cp $ $
done
You should following the manual book to change path, and config
source seahub/setenv.sh
./setup-seafile.sh
./seafile.sh start
./seafile.sh stop
On Friday, August 22, 2014 11:13 AM, Chilledheart notifications@github.com wrote:
some patches for FreeBSD(or FreeNAS, untested though)
* ccnet https://github.com/Chilledheart/ccnet/tree/bsd_support
* seafile https://github.com/Chilledheart/seafile/tree/bsd_support
sadly, seafile (seaf-daemon) requires additional support for fs change watch via kqueue, so building seafile-client (gui) would be quite tough.
—
Reply to this email directly or view it on GitHub.
@big-grizzly I am not sure, but you might want to reference the python’s requirements.txt for thirdpart stuff, notably django
and djblets. Perhaps port www/py-django15 and www/py-djblets would fit this gap.
Yeah, I just found them in the freebsd bugzilla. List the links here for convenience :
First of all, I definitely will make try on python module requirement. I think that my original struggling experience with python modules on my 9,2 box is quite bad, especially for django15. The above two modules are still some starts. Gunicorn also make some trouble at that time. Honestly, that 9.2 box has some trouble of python version selection, and some other unclear issue in port mgmt.
Now, I fully work on a new 9.3-rel box, and I will try to fill in the gap as much as possible for sure. The bugs filed in freebsd port tree provide me a baseline that the server side can work on BSD system.
Secondary, I have finished building ccnet 3.1.4, seafile 3.1.4, latest libsearpc now. During the weekend, I will try to make python module into pkg as many as possible.
Finally, I guess turning ports to PBIs should be relatively «easy». Then, stephenhoos can have something tests on PC-BSD.
BTW, libevhtp has fix with bugid 191931 (seafile port needs it), which create shared object by default. It should be in the port tree soon.
On Friday, August 29, 2014 9:56 PM, Chilledheart notifications@github.com wrote:
The port efforts for 3.1.5 has been done, which reach similar situ with porting 3.0.4. I will try to update the bug ids listed in previous post.
Now the steps are simplified to be:
(1) build seahub
(2) mount -t procfs proc /proc
(3)
cd /usr/local/www/haiwen/seafile-server/seahub
for file in makemessages.sh.template run-seahub.sh.template send_user_notifications.sh.template setenv.sh.template; do
cp $ $
done
(4)
cd /usr/local/www/haiwen/seafile-server
You should following the manual book to change path, and config
source seahub/setenv.sh
./setup-seafile.sh
./seafile.sh start
./seahub.sh start
(other detail settings should follow the manual)
There are 2 issues for porting.
(1) requirements.txt
is not part of release 3.1.5, and some of the requirements are not show in 3.1.5 third party packages. For example, pt-selenium. I added it into 3.1.5 port for future reference.
(2) Now the trouble maker is python djblets. The seafile chooses the combination of django and djblets in an interesting way. djblets 0.6.14 requires newer than django 1.1.1, and using django 1.5.1, which fit for the requirement of djblets. System like debian removes djblets package. while FreeBSD has djblets 0.7.28 port. However, the port follows egg requirement strictly, which uses django 1.4.x.
If I want to following normal way to install djblets 0.6.14 by ports, or packages, it will blocks to use existing djblets 0.7.28. I anyway will submit py-djblets06 ports. I don’t prefer to this way.
Let me know if there is any suggestion. Thank you.
Finally, start to work on PBI for PC-BSD.
Best,
Jingfeng
On Saturday, August 30, 2014 2:48 AM, Jingfeng Yan yan_jingfeng@yahoo.com wrote:
First of all, I definitely will make try on python module requirement. I think that my original struggling experience with python modules on my 9,2 box is quite bad, especially for django15. The above two modules are still some starts. Gunicorn also make some trouble at that time. Honestly, that 9.2 box has some trouble of python version selection, and some other unclear issue in port mgmt.
Now, I fully work on a new 9.3-rel box, and I will try to fill in the gap as much as possible for sure. The bugs filed in freebsd port tree provide me a baseline that the server side can work on BSD system.
Secondary, I have finished building ccnet 3.1.4, seafile 3.1.4, latest libsearpc now. During the weekend, I will try to make python module into pkg as many as possible.
Finally, I guess turning ports to PBIs should be relatively «easy». Then, stephenhoos can have something tests on PC-BSD.
BTW, libevhtp has fix with bugid 191931 (seafile port needs it), which create shared object by default. It should be in the port tree soon.
Источник
- Environment variable
- Tests. Either write a new test scenario, which will extend test duration probably unnecessary, or activate for all scenarios and assume if it works with memcached, it works without.
Just check UI should work.
Two tests in mind:
- Check login page (only static content available, as far as I know) can be fetched and login is successful (because we can)
- Check
media
folder accessibility
Implementation ideas:
CSRF=$(curl -s -c cookies http://$HOST:$PORT/accounts/login/ | sed -n 's/.* name="csrfmiddlewaretoken" value="([^"]*).*/1/p') curl -is -b cookies -d "csrfmiddlewaretoken=$CSRF&login=$SEAFILE_ADMIN_EMAIL&password=$SEAFILE_ADMIN_PASSWORD" http://$HOST:$PORT/accounts/login/ | grep 302
# Something more relevant can be to retrieve avatar URL from previous test curl -s http://$HOST:$PORT/media/favicons/favicon.png | sha1sum - | grep 71a42c2032dedfe7c6a066ed2296a8db2b120155
Tests should probably be added to current API tests (renamed to Seahub tests) since more in deep UI tests need ton of javascript execution.
Title. Will complete API tests for now.
- Environment variable
- Test
- Environment variable
- Tests. Note: Need a new test case as for update and new instance
As briefly discussed in #35, running init step with a container which was previously used leads to conflicts.
Following symlinks should be cleaned before initialization (relative to /opt/seafile
):
seafile-server-<version>/seahub/media
seafile-server-latest
conf
seafile-data
seahub-data
logs
ccnet
seahub.db
hello,
in my rock64 debian the container seafile have the init error:
2022-10-07T20:35:11+02:00 [Init] Cleaning media folder
2022-10-07T20:35:12+02:00 [Init] Exposing media folder in the volume
ln: failed to create symbolic link './seafile-server-9.0.9/seahub/media': File exists
2022-10-07T20:36:16+02:00 [Entrypoint] Local time set to Europe/Paris
2022-10-07T20:36:16+02:00 [Entrypoint] Checking permissions
my .env :
PUID=1000
PGID=1000
TZ=Europe/Paris
URL=rock64
SEAFILE_ADMIN_EMAIL=***************
SEAFILE_ADMIN_PASSWORD=**********
USE_HTTPS=0
MYSQL_HOST=db
MYSQL_USER_PASSWD=secret
MYSQL_ROOT_PASSWD=secret
SEAFILE_CONF_DIR=./seafile/conf
SEAFILE_LOGS_DIR=./seafile/logs
SEAFILE_DATA_DIR=./seafile/seafile-data
SEAFILE_SEAHUB_DIR=./seafile/seahub-data
DATABASE_DIR=./db
SEAFILE_SQLITE_DIR=./seafile/sqlite
SWAG_DIR=./swag
Sometimes, I’m getting following log output:
2021-10-31T14:49:31+00:00 [Entrypoint] Local time set to Atlantic/Canary
2021-10-31T14:49:31+00:00 [Entrypoint] Checking permissions
2021-10-31T14:49:31+00:00 [Entrypoint] PUID not set, using current
2021-10-31T14:49:32+00:00 [Entrypoint] GUID not set, using current
2021-10-31T14:49:32+00:00 [Entrypoint] Adjusting identifiers
usermod: no changes
2021-10-31T14:49:35+00:00 [Entrypoint] Running launch script
2021-10-31T14:49:37+00:00 [Launch] Making symlink to latest version
2021-10-31T14:49:37+00:00 [Launch] Linking internal configuration and data folders with the volume
2021-10-31T14:49:37+00:00 [Launch] Launching seafile
Starting seafile server, please wait ...
** Message: 14:49:40.529: seafile-controller.c(536): No seafevents.
Seafile server started
Done.
LANG is not set in ENV, set to en_US.UTF-8
./seafile-server-latest/seahub.sh: line 210: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...
----------------------------------------
It's the first time you start the seafile server. Now let's create the admin account
----------------------------------------
What is the email for the admin account?
[ admin email ]
Error happened during creating seafile admin.
Seahub is started
Done.
2021-10-31T14:50:23+00:00 [Launch] Done
2021-10-31T14:50:23+00:00 [Entrypoint] Waiting for termination
These lines in particular:
...
Starting seahub at port 8000 ...
----------------------------------------
It's the first time you start the seafile server. Now let's create the admin account
----------------------------------------
What is the email for the admin account?
[ admin email ]
Error happened during creating seafile admin.
Seahub is started
...
Also, sometimes only shows these (without interactive messages, but with the error line):
...
Starting seahub at port 8000 ...
Error happened during creating seafile admin.
Seahub is started
...
I’m not sure about the cause, but it appears randomly. Service is properly configured to use mysql/mariadb database, with admin user and pass set at environment variables and using volumes for persistence. My deployment configuration is published at: https://gitlab.com/pedroetb-projects/seafile/-/blob/master/docker-compose.yml (docker-compose.yml
and .env
for defaults).
Despite this, service is working fine, thanks! Only sharing this because it may be helpful.
Which license is applicable/wished for the source code in this repository?
There are a few different licenses to choose from for a community-oriented project, but clarifying this might be a good idea.
https://choosealicense.com/
./build_image.sh -l arm/v7 -v 8.0.7
Loading environment…
installing: mips64le qemu-mips64el already registered
installing: mips64 qemu-mips64 already registered
Restarting builder container..
4487d90d7044
[+] Building 5.2s (12/33)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 3.31kB 0.1s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:bullseye-slim 2.7s
=> [internal] load metadata for docker.io/library/debian:bullseye 2.7s
=> [internal] load build context 0.2s
=> => transferring context: 81.72kB 0.1s
=> [stage-1 1/7] FROM docker.io/library/debian:bullseye-slim@sha256:b0d53c872fd640c2af2608ba1e693cfc7dedea30abcd8f584b23d583ec6dadc7 0.3s
=> => resolve docker.io/library/debian:bullseye-slim@sha256:b0d53c872fd640c2af2608ba1e693cfc7dedea30abcd8f584b23d583ec6dadc7 0.3s
=> [builder 1/21] FROM docker.io/library/debian:bullseye@sha256:2906804d2a64e8a13a434a1a127fe3f6a28bf7cf3696be4223b06276f32f1f2d 0.3s
=> => resolve docker.io/library/debian:bullseye@sha256:2906804d2a64e8a13a434a1a127fe3f6a28bf7cf3696be4223b06276f32f1f2d 0.3s
=> CACHED [stage-1 2/7] RUN apt-get update && apt-get install —no-install-recommends -y sudo procps sqlite3 libmariadb3 libmemcached11 python3 python3-setuptools python3-ldap python3-sqlalchem 0.0s
=> CACHED [stage-1 3/7] WORKDIR /opt/seafile 0.0s
=> CACHED [stage-1 4/7] RUN groupadd -g 999 runtime && useradd -ms /bin/bash -G sudo,runtime seafile && echo ‘%sudo ALL=(ALL) NOPASSWD:ALL’ >> /etc/sudoers && chown seafile:runtime . && chmod g+w . 0.0s
=> CACHED [builder 2/21] RUN apt-get update -y && apt-get install -y wget sudo libmemcached-dev golang 0.0s
=> ERROR [builder 3/21] RUN wget https://raw.githubusercontent.com/haiwen/seafile-rpi/master/build3.sh 0.7s
[builder 3/21] RUN wget https://raw.githubusercontent.com/haiwen/seafile-rpi/master/build3.sh:
#11 0.343 —2021-12-31 07:49:04— https://raw.githubusercontent.com/haiwen/seafile-rpi/master/build3.sh
#11 0.423 Resolving raw.githubusercontent.com (raw.githubusercontent.com)… 185.199.108.133, 185.199.109.133, 185.199.110.133, …
#11 0.434 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443… connected.
#11 0.478 HTTP request sent, awaiting response… 404 Not Found
#11 0.637 2021-12-31 07:49:05 ERROR 404: Not Found.
#11 0.637
Dockerfile:16
14 |
15 | # Retrieve seafile build script
16 | >>> RUN wget https://raw.githubusercontent.com/haiwen/seafile-rpi/master/build3.sh
17 | RUN chmod u+x build3.sh
18 |
error: failed to solve: process «/bin/sh -c wget https://raw.githubusercontent.com/haiwen/seafile-rpi/master/build3.sh» did not complete successfully: exit code: 8
I set the UID/GID because the files are owned by an ID other than the default 1000. Apparently, when the container starts that triggers a chown -R user:user /opt/seafile
step.
This may have something to do with my hardware but it’s extremely slow. It might take an hour (or more) for the container to start. I think the problem is that there are tens of thousands of files.
Is there a way to change the default 1000 to something else? Can I update the image, somehow? I can’t have it take this long every time it starts.
As discussed in #13 starting Seahub with a given port only affect display.
What matters is the binding in gunicorn.conf.py
which is handled fine.
Nevertheless it’s still a bug and could be confusing, but it’s really far from my priorities so it will stay as wontfix
atm.
Context
Install failed once due to the edge case of the db restarting to initialize at first launch.
In case of early fail (example below) no database is created thus there’s nothing to clean.
seafile_1 | verifying password of user root ...
seafile_1 | Failed to connect to mysql server using user "root" and password "***": Can't connect to MySQL server on 'db' (115)
Expected
Nothing. The cleaning script has to silently do nothing.
Got
seafile_1 | 2021-07-02T10:39:37+02:00 [Init] Cleaning old databases
seafile_1 | Traceback (most recent call last):
seafile_1 | File "<stdin>", line 6, in <module>
seafile_1 | File "/opt/seafile/seafile-server-8.0.5/seahub/thirdpart/MySQLdb/cursors.py", line 206, in execute
seafile_1 | res = self._query(query)
seafile_1 | File "/opt/seafile/seafile-server-8.0.5/seahub/thirdpart/MySQLdb/cursors.py", line 319, in _query
seafile_1 | db.query(q)
seafile_1 | File "/opt/seafile/seafile-server-8.0.5/seahub/thirdpart/MySQLdb/connections.py", line 259, in query
seafile_1 | _mysql.connection.query(self, query)
seafile_1 | MySQLdb._exceptions.OperationalError: (1008, "Can't drop database 'ccnet_db'; database doesn't exist")
seafile_1 | 2021-07-02T10:39:37+02:00 [Init] Retrying install
Fixes to evaluate
- Put a try catch, probably the cleanest way
- Redirect to null. Why not.
Context
When using a clean MySQL container in version 8, the following error occurs at first launch:
Error happened during creating seafile admin.
And in seafile.log
:
../common/seaf-db.c(709): Failed to connect to MySQL: Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
Fix attempts
Tried to use default-libmysqlclient-dev
instead of libmariadb-dev
, with no visible improvement.
Actual fix will come in the future.
Workaround
A more detailed procedure here. In a nutshell:
Connect to db container:
$ docker exec -it mysql_container_name /bin/bash
Update authentication plugin:
$ mysql -u root -p mysql> ALTER USER 'seafile' IDENTIFIED WITH mysql_native_password BY 'secret';
Come back on the host and set the credentials in interactive mode:
$ docker exec -it seafile_container_name seafile-server-latest/seahub.sh restart
Then everything should work fine.
- Add required dependencies
- Add
USE_SQLITE
env var - Check which env vars have to be used in install script
- Check how to expose the data in the volume
- Upgrade init script
- Do some testing
- Update doc (should probably do a table for each install to avoid a big mess)
- Study the usefulness of a 2-pipelines way to avoid useless dependencies? -> no needs
- Check deps installed by the build script
- Check deps installed by the dockerfile
- Remove all useless deps
- Check size difference between images
- Evaluate the need of a 2-pipelines way
FILESERVER_PORT
probably yes since it’s written in a config file.
SEAHUB_PORT
probably not since seahub.sh
isn’t started with any specific port.
Need to do some testing.
Creation of initial seafile admin fails #5
Comments
When spinning up a fresh container, I receive the following error halfway through the initial setup script:
This is a snippet from the logs. The container starts fine, and I can actually get to the login page, but since the admin account has not been created, I cannot log in.
I’ve been digging through the Seafile codebase to find out where this pops up, and it looks like the check_init_admin.py file is where the exception is thrown, which is called by seahub.sh .
I’m creating the container using the following docker-compose :
There is another reverse proxy in front of this container. I’m assuming this won’t interfere with the admin creation process, but I’m still mentioning it just in case.
By the way: thanks for creating this. It is much, much better than the strange dockerfile wrapper script presented by the Seafile devs themselves.
The text was updated successfully, but these errors were encountered:
Could you give some information on the Docker and Docker-compose versions used?
I have a similar setup in use with an NGINX Reverse proxy and that definitely doesn’t interfer.
This indeed is a strange bug because the Travis Build runs some unit tests and the admin creation is essential for anything to work.
- Is there maybe a permission problem of some sort with the host mount /containers/Seafile ?
- And could you check dmesg / syslog output to problems related to SELinux or other things interfering with docker?
- What happens without the host mount (not persitent of course)?
- EDITED: What distribution do you use?
My Docker host is an Ubuntu server 17.10 machine, with Docker version 17.12.0-ce and Docker-compose version 1.18.0 .
I’ve been testing around some more (also based on your questions). Not mounting the volume still gives the same creation error, so it does not seem to be a permission error on the volume itself. As far as any dmesg logs, there are no things out of the ordinary. I tried looking into some other logging, but Seafile itself does not log a lot regarding the python bootstrap scripts they are providing, so it seems like a dead end there.
However, I found something interesting. Executing the docker run equivalent of my compose file does work. So that would be the following (minus the volume, still for testing purposes):
So this seems to be an issue related to Docker-compose?
This is super weird. To my understanding docker-compose is just wrapper for docker and shouldn’t do any extra stuff. I have docker 1.13 and docker-compose 1.8 , so much older versions than you. I am also using Ubuntu but 16.04.
Could you post the logs of Docker after trying to create the container using docker-compose ? You should be able to get the logs using journalctl -u docker -n 1000 on Ubuntu.
The following is the resulting log of specifically creating the container.
And using docker run :
They seem identical regarding the operations themselves. The moment the creation error pops up, there is no log entry created by Docker.
Could it be a rights issue, that UID and GID need to be passed into the container to properly work when using docker-compose ? I’m guessing here, as it seems to be a longshot.
Just encountered similar with a manual build on Ubuntu 20.04 and Seafile 7.1.5
Starting seahub.sh asks for admin email and password then gives the above error «Error happened during creating seafile admin»
Except in my case I cannot access the site at this point and on server curl 127.0.0.1:8000 returns nothing
Of note I did need to install libmemcached-dev via apt before I could install pylibmc and django-pylibmc via pip3
Источник
Error happened during creating seafile admin
It is mostly likely some required Python packages of Seahub is not installed correctly.
You can check the detailed error messages in /var/log/nginx/seahub.error.log if you use Nginx.
Website displays «Page unavailable», what can I do?¶
- You can check the back trace in Seahub log files ( installation folder/logs/seahub.log )
- You can also turn on debug mode by adding DEBUG = True to seahub_settings.py and restarting Seahub with ./seahub.sh restart , then refresh the page, all the debug infomations will be displayed.
Failed to send email, what can I do?¶
Please check logs/seahub.log.
There are some common mistakes:
- Check whether there are typos in the config ( seahub_settings.py , e.g. you could have forgotten to add a single quote EMAIL_HOST_USER = XXX , which should be EMAIL_HOST_USER = ‘XXX’ or you could have a space at the end of a config line.
- Your mail server is not available.
AD (LDAP)¶
Can’t connect to LDAP server with ldaps¶
Description¶
Seafile server can’t communication with my LDAP server. The ccnet.log shows:
Answer¶
If you are using pro edition, you can check the LDAP configuration by running a script as described in useing ldap pro (search Testing your LDAP Configuration).
If the script can correctly talk to ldap server, it is most likely caused by incompatible of bundled LDAP libraries. You can follow useing ldap pro (the end of document) to remove the bundled LDAP libraries.
How to restrict Seafile access to certain accounts in AD¶
You can use FILTER field in LDAP configuration in ccnet.conf . For example, the following filter restricts the access to Seafile to members of a group.
AD also supports subgroups. The following filter restricts the access to Seafile to membersand subgroups of a group.
Upgrade¶
After upgrading Web UI is broken because CSS files can’t be loaded¶
Please remove the cache and try again, rm -rf /tmp/seahub_cache/* . If you configured memecached, restart memcached, then restart Seahub.
If the problem is not fixed, check whether seafile-server-latest point to the correct folder. Then check whether seafile-server-latest/seahub/media/CACHE is correctly being generated (it should contain the auto-generated CSS file(s)).
Avatar pictures vanished after upgrading the server, what can I do?¶
- You need to check whether the «avatars» symbolic link under seahub/media/ is linking to ../../../seahub-data/avatars. If not, you need to correct the link according to the «minor upgrade» section in Upgrading-Seafile-Server.
- If your avatars link is correct, and avatars are still broken, you may need to refresh Seahub cache using rm -rf /tmp/seahub_cache/* or by restarting memcached if being used.
Server can’t start¶
Seafile/Seahub can’t start after upgrade or any other reasons¶
Please check whether the old version of Seahub is still running.
Please check whether you use the right user to run or upgrade Seafile. Pay special attention to the following files:
- seafile-directory/seafile-server-6.0.3/runtime/error.log
- seafile-directory/seafile-server-6.0.3/runtime/access.log
- seafile-directory/logs/*
You can run the following command to change fix the permission for the whole directory:
You can also try remove the cache directory of Seahub
Please also check the permission of seahub.pid and seahub.log . If Seahub can’t write to these files, it will fail to start.
SeafEvents¶
Seafevents can’t be started¶
Description¶
Office files online preview can’t work. There is no logs in seafevents.log. From controller.log , the seafevent process is being started again and again.
Answer¶
Please check the permission of seafevent.pid and seafevent.log . If seafevent can’t write to these files, it will fail to start.
Another possible reason is that you don’t have all the necessary Python dependancies installed. Especially if you enable publishing events to Redis but not installed the Redis Python library.
Seafile GC shows errors, FSCK can’t fix them¶
GC scans the history. But FSCK only scans the current version. You can ignore the error. It is a minor issue.
Ceph and S3¶
Seafile server can’t started when using Ceph¶
Description¶
Seafile server can’t started when using Ceph as storage backend. seafile.log is empty. controller.log shows:
Answer¶
This is most likely caused by Ceph library incompatible. If you deploy Seafile on Ubuntu or Debian, make sure you are using the binary built for Ubuntu.
Virus scan and search index doesn’t work with HTTPS S3¶
The use_https = true options in seafile.conf config are working just for regular file operations to S3, but not indexing or AV scanning.
Create ‘/etc/boto.cfg’ and add the following:
Then the issue can be resolved.
GC error when removing blocks in Ceph¶
Description¶
We just did a GC run which came up with errors when deleting blocks. This seems to happen with all blocks/libraries. Below is an example for a single library.
Answer¶
That should be related to the behavior of cache tier in Ceph. You could try to use «rados rm» command to remove that object. If it returns the same error (no such file or directory), it should be the same issue. You should try to copy that object out before removing it, in case you still need it later.
Источник
Tasks
Create system user
Create a user and his own group to run the Seafile Server. We choose the name seafserver for the user as well as for his group. useradd -h for a short help of the switches.
You can check the result:
Install Seafile Server
We will install Seafile Server in /opt/seafile , Seafile data in /srv/seafile_data .
Install required packages
Debian
Ubuntu
CentOS
Arch Linux | ARM
Change the arch arch=(‘i686’ ‘x86_64’ ‘armv6h’) to arch=(‘any’) if you’re using the Pi 3.
Download latest stable Seafile Server package
Download the lastest Seafile Server package from here and put it in /opt/Seafile/installed . Adjust the version number.
Download the lastest Seafile Server package from here and put it in /opt/Seafile/installed . Adjust the version number.
Untar the package
It should look something like this:
Configure Seafile Server and databases
Task | Action |
---|---|
[ server name ] | |
[ This server’s ip or domain ] | |
[ default «/opt/seafile/seafile-data» ] | «/srv/seafile-data» |
[ default «8082» ] | |
[ 1 or 2 ] | «1 (create new databases)» |
[ default «localhost» ] | |
[ default «3306» ] | |
[ root password ] | |
[ default «seafile» ] | |
[ password for seafile ] | |
[ default «ccnet-db» ] | |
[ default «seafile-db» ] | |
[ default «seahub-db» ] |
Set file and folder permission
Now the user seafserver needs to own the whole stuff:
It should look like this:
First Start of Seafile Server
We can start Seafile Server as user seafserver
Task | Action |
---|---|
[ admin email ] | |
[ admin password ] | |
[ admin password again ] |
Change of Seafile-data location
Stop Seafile Server
There is some data located in the /opt directory. We need to move the data to /srv and change this.
RECOMMENDED: Change config file
Change the config file path to let seafile server access it’s data directory:
ALTERNATIVE: Symlink
Create a symlink to let seafile server access it’s data directory:
At least start your Seafile Server again as user ‘seafserver’ to check it’s still working. Stop Seafile Server before proceeding to the next step.
Verification
Use nmap to check the necessary ports are open. 22 is SSH , only open if you installed SSH server . 3306 is mariadb , only bound to localhost , not accessible from outside via network. 8000 is seahub , the web interface . 8082 is seafile , the data service daemon :
For a test open a web browser and log into your new Seafile Server:
Enable Seafile Server autostart (systemd)
For a convenient start of Seafile Server we need some appropriate definition files for the operating system. Debian 9/Ubuntu/CentOS use systemd as init system, so we create service files for systemd.
Create a file /etc/systemd/system/seafile.service with the following contents:
Create another file /etc/systemd/system/seahub.service with this contents:
Reload the systemd configuration:
Now you should be able to start your Seafile Server like any other ordinary service:
Verify if it is working (web browser: http:// :8000/ )
You can stop Seafile Server:
To start Seafile Server at system startup the services need to be enabled:
To verify the automatic startup you need to reboot your server and afterwards Seafile Server should be running.
But you can do a reboot later. Continue with the next step.
Copyright © 2018 Seafile Community, Contribution, Github
Источник
Changing seafile-data directory #38
Comments
Seafile installs great but the data directory is pointed towards /home/yunohost.app/seafile-data. I’d like to point it to my mounted external HD at /media/storage/seafile-data/.
Anytime I try to fix this myself I get a slew of errors resulting in a 502 Gateway Error when trying to access the Seafile GUI. Am I missing something in my steps below?
- I stop the seafile and seahub services (/opt/yunohost/seafile/seafile-server-6.3.4/seahub.sh stop, /opt/yunohost/seafile/seafile-server-6.3.4/seafile.sh stop)
- I edit the file in /opt/yunohost/seafile/ccnet/seafile.ini from /home/yunohost.app/seafile-data to /media/storage/seafile-data (nano /opt/yunohost/seafile/ccnet/seafile.ini)
- I copy all files from the old data directory to the new (cp -R /home/yunohost.app/seafile-data/ /media/storage/seafile-data/)
- I set root ownership for the new seafile-data directory (chown -R root:group /media/storage)
- I run seaf-fsck.sh to confirm the d./seaf-fsck.shta transferred correctly (/opt/yunohost/seafile/seafile-server-6.3.4/seaf-fsck.sh
- I start seafile and seahub again.
Seafile works fine and will begin uploading files, but after I reboot the system then I get the 502 Gateway Error.
The text was updated successfully, but these errors were encountered:
So I ran the command to give that directory ownership:
chown -R seafile:seafile /media/storage/seafile-data
Now instead of a «502 Bad Gateway» error when trying to load the web GUI, I get a «Page unavailable. Sorry, but the requested page is unavailable due to a server hiccup. Our engineers have been notified, so check back later.» and a server internal error when using SeaDrive.
If I go to my domain /seafhttp then I get a «502 Bad Gateway» error.
Источник
- Tasks
- Create system user
- Install Seafile Server
- Install required packages
- Download latest stable Seafile Server package
- Untar the package
- Configure Seafile Server and databases
- Set file and folder permission
- First Start of Seafile Server
- Change of Seafile-data location
- Verification
- Enable Seafile Server autostart (systemd)
Tasks
- Create a Seafile service user
- Install Seafile Server
- Change Seafile Server data location
- Enable Seafile Server autostart
Create system user
Create a user and his own group to run the Seafile Server. We choose the name seafserver
for the user as well as for his group. useradd -h
for a short help of the switches.
root@cloudserver:~# mkdir /opt/seafile
root@cloudserver:~# useradd -U -m -d /opt/seafile seafserver
You can check the result:
root@cloudserver:~# ls -l /opt/seafile/
total 4
drwxr-xr-x 2 seafserver seafserver 4096 Jul 3 17:10 Server
root@cloudserver:~# grep seafserver /etc/passwd
seafserver:x:1001:1001::/opt/seafile:
root@cloudserver:~# grep seafserver /etc/group
seafserver:x:1001:
Install Seafile Server
We will install Seafile Server in /opt/seafile
, Seafile data in /srv/seafile_data
.
Install required packages
Debian
root@cloudserver:~# apt-get update && apt-get install python-setuptools python-imaging
python-ldap python-mysqldb python-memcache python-urllib3
Ubuntu
root@cloudserver:~# apt-get update && apt-get install python-setuptools python-imaging
python-ldap python-mysqldb python-memcache python-urllib3
CentOS
root@cloudserver:~# yum install python-setuptools python-imaging
python-ldap python-mysqldb python-memcache python-urllib3
Arch Linux | ARM
root@cloudserver:~# pacman -S base-devil wget python2 python2-requests python2-imaging python2-ldap python2-pip python2-numpy mysql-python
root@cloudserver:~# cower -d libsepol libselinux && cd libsepol && makepk -si && cd .. && cd libselinux && makepk -si
Change the arch
arch=('i686' 'x86_64' 'armv6h')
toarch=('any')
if you’re using the Pi 3.
root@cloudserver:~# pip2 install --upgrade pip && pip2 install pillow moviepy captcha
Download latest stable Seafile Server package
- 64 Bit
Download the lastest Seafile Server package from here and put it in /opt/Seafile/installed
. Adjust the version number.
root@cloudserver:~# mkdir /opt/seafile/installed
root@cloudserver:~# wget -P /opt/seafile/installed https://download.seadrive.org/seafile-server_6.2.3_x86-64.tar.gz
- Raspberry Pi
Download the lastest Seafile Server package from here and put it in /opt/Seafile/installed
. Adjust the version number.
root@cloudserver:~# mkdir /opt/seafile/installed
root@cloudserver:~# wget -P /opt/seafile/installed https://github.com/haiwen/seafile-rpi/releases/download/v6.3.4/seafile-server_6.3.4_stable_pi.tar.gz
Untar the package
root@cloudserver:~# tar -xz -C /opt/seafile -f /opt/seafile/installed/seafile-server_*
It should look something like this:
root@cloudserver:~# ls -l /opt/seafile
total 8
drwxr-xr-x 2 root root 4096 Jul 3 17:22 installed
drwxrwxr-x 6 500 500 4096 Jun 13 07:52 seafile-server-6.2.3
Configure Seafile Server and databases
# Create the seafile data folder
root@cloudserver:~# mkdir /srv/seafile-data
# Run the seafile server setup script
root@cloudserver:~# /bin/bash /opt/seafile/seafile-server-*/setup-seafile-mysql.sh
Task | Action |
---|---|
[ server name ] |
< Servername > |
[ This server's ip or domain ] |
< Server’s DNS or IP address > |
[ default "/opt/seafile/seafile-data" ] |
«/srv/seafile-data» |
[ default "8082" ] |
< leave the port as it is > |
[ 1 or 2 ] |
«1 (create new databases)» |
[ default "localhost" ] |
< database runs on this server > |
[ default "3306" ] |
< standard port for mysql or mariadb > |
[ root password ] |
< enter DB server root password > |
[ default "seafile" ] |
< it’s the name of the user in mariadb > |
[ password for seafile ] |
< give the user a password, no need to remember > |
[ default "ccnet-db" ] |
< > |
[ default "seafile-db" ] |
< > |
[ default "seahub-db" ] |
< > |
Set file and folder permission
Now the user seafserver needs to own the whole stuff:
root@cloudserver:~# chown -R seafserver:seafserver /opt/seafile /srv/seafile-data
It should look like this:
root@cloudserver:~# ls -l /opt/seafile
total 20
drwx------ 2 seafserver seafserver 4096 Jul 3 17:59 ccnet
drwx------ 2 seafserver seafserver 4096 Jul 3 17:59 conf
drwxr-xr-x 2 seafserver seafserver 4096 Jul 3 17:22 installed
drwxrwxr-x 6 seafserver seafserver 4096 Jun 13 07:52 seafile-server-6.1.1
lrwxrwxrwx 1 seafserver seafserver 20 Jul 3 17:59 seafile-server-latest -> seafile-server-6.1.1
drwxr-xr-x 3 seafserver seafserver 4096 Jul 3 17:59 seahub-data
root@cloudserver:~# ls -l /srv
total 4
drwx------ 3 seafserver seafserver 4096 Jul 3 17:59 seafile-data
First Start of Seafile Server
We can start Seafile Server as user seafserver
root@cloudserver:~# su -l seafserver
$ seafile-server-latest/seafile.sh start
$ seafile-server-latest/seahub.sh start
Task | Action |
---|---|
[ admin email ] |
< enter the mail address you’ll use as admin account > |
[ admin password ] |
< give it a password > |
[ admin password again ] |
< password again > |
Change of Seafile-data location
Stop Seafile Server
$ seafile-server-latest/seahub.sh stop
$ seafile-server-latest/seafile.sh stop
$ exit
There is some data located in the /opt
directory. We need to move the data to /srv
and change this.
RECOMMENDED: Change config file
Change the config file path to let seafile server access it’s data directory:
root@cloudserver:~# mv /opt/seafile/seahub-data /srv/seahub-data/
root@cloudserver:~# echo '/srv/seahub-data' > /opt/seafile/ccnet/seafile.ini
ALTERNATIVE: Symlink
Create a symlink to let seafile server access it’s data directory:
root@cloudserver:~# mv /opt/seafile/seahub-data /srv/seahub-data/
root@cloudserver:~# ln -s /opt/seafile/seahub-data /srv/seahub-data
At least start your Seafile Server again as user ‘seafserver’ to check it’s still working. Stop Seafile Server before proceeding to the next step.
Verification
Use nmap
to check the necessary ports are open. 22
is SSH
, only open if you installed SSH server
. 3306
is mariadb
, only bound to localhost
,
not accessible from outside via network. 8000
is seahub
, the web interface
. 8082
is seafile
, the data service daemon
:
$ nmap localhost
Starting Nmap 7.40 ( https://nmap.org ) at 2017-07-04 06:53 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000025s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
3306/tcp open mysql
8000/tcp open http-alt
8082/tcp open blackice-alerts
Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds
$ nmap <Server IP>
Starting Nmap 7.40 ( https://nmap.org ) at 2017-07-04 06:59 EDT
Nmap scan report for <Server IP>
Host is up (0.000024s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
8000/tcp open http-alt
8082/tcp open blackice-alerts
Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds
For a test open a web browser and log into your new Seafile Server:
http://<Server IP>/8000/
Enable Seafile Server autostart (systemd)
For a convenient start of Seafile Server we need some appropriate definition files for the operating system. Debian 9/Ubuntu/CentOS use systemd as
init system, so we create service files for systemd.
Create a file /etc/systemd/system/seafile.service
with the following contents:
[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target mysql.service
[Service]
Type=oneshot
ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start
ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop
RemainAfterExit=yes
User=seafserver
Group=seafserver
[Install]
WantedBy=multi-user.target
Create another file /etc/systemd/system/seahub.service
with this contents:
[Unit]
Description=Seafile hub
After=network.target seafile.service
[Service]
# change start to start-fastcgi if you want to run fastcgi
ExecStart=/opt/seafile/seafile-server-latest/seahub.sh start
ExecStop=/opt/seafile/seafile-server-latest/seahub.sh stop
User=seafserver
Group=seafserver
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Reload the systemd configuration:
root@cloudserver:~# systemctl daemon-reload
Now you should be able to start your Seafile Server like any other ordinary service:
root@cloudserver:~# systemctl start seafile
root@cloudserver:~# systemctl start seahub
Verify if it is working (web browser: http://<Server IP>:8000/
)
You can stop Seafile Server:
root@cloudserver:~# systemctl stop seahub
root@cloudserver:~# systemctl stop seafile
To start Seafile Server at system startup the services need to be enabled:
root@cloudserver:~# systemctl enable seafile
Created symlink /etc/systemd/system/multi-user.target.wants/seafile.service → /etc/systemd/system/seafile.service.
root@cloudserver:~# systemctl enable seahub
Created symlink /etc/systemd/system/multi-user.target.wants/seahub.service → /etc/systemd/system/seahub.service.
To verify the automatic startup you need to reboot your server and afterwards Seafile Server should be running.
But you can do a reboot later. Continue with the next step.
Seafile — это личное облачное хранилище для хранения данных в стиле Dropbox.
https://www.seafile.com
Сегодня мы установим Seafile 9.0.2 на Debian 11.
- Имеется сервер с операционной системой Debian 11. Где-то в облаке.
- Seafile для безопасности запустим под отдельным пользователем как службы.
- В качестве БД используем MySQL 8 на том же сервере.
- Дополнительно поднимем и настроим Nginx.
Доступна версия 9.0.2 64bit.
https://www.seafile.com/en/download/
Ссылки
Ранее я уже публиковал статью про установку Seafile на Ubuntu:
Seafile 7.1.1 — установка на Ubuntu 18.04 LTS
В новой статье будет несколько отличий.
- Ранее я устанавливал Seafile 7.1.1, теперь установим более новую версию Seafile 9.0.2.
- Ранее была операционная система Ubuntu 18.04, сейчас Debian 11.
https://www.seafile.com
Мануал:
https://manual.seafile.com/
База данных MySQL 8 для Seafile
Установка MySQL 8 на Debian 11 у меня уже есть в отдельной статье:
Debian 11 — установка MySQL 8
Точно так же устанавливаем и перемещаем базу в директорию /opt.
Создаём три базы:
- seafile-ccnet
- seafile-db
- seafile-seahub
и пользователя MySQL: seafile:
mysql -u root -p
CREATE SCHEMA `seafile-ccnet` DEFAULT CHARACTER SET utf8 ;
CREATE SCHEMA `seafile-db` DEFAULT CHARACTER SET utf8 ;
CREATE SCHEMA `seafile-seahub` DEFAULT CHARACTER SET utf8 ;
CREATE USER 'seafile'@'localhost' identified by 'ПАРОЛЬ';
GRANT ALL PRIVILEGES ON `seafile-ccnet`.* to `seafile`@localhost;
GRANT ALL PRIVILEGES ON `seafile-db`.* to `seafile`@localhost;
GRANT ALL PRIVILEGES ON `seafile-seahub`.* to `seafile`@localhost;
Меняем настройки безопасности пользователю:
ALTER USER 'seafile'@'localhost' IDENTIFIED WITH mysql_native_password BY 'ПАРОЛЬ';
Установка пакетов
Устанавливаем пакеты, хочу обратить внимание на пакет python3-dev, который в официальном мануале не указан (работаем под ROOT):
apt-get update
apt-get install -y python3 python3-dev python3-setuptools python3-pip libmysqlclient-dev
apt-get install -y memcached libmemcached-dev
pip3 install --timeout=3600 django==3.2.* Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3
django-pylibmc django-simple-captcha python3-ldap mysqlclient pycryptodome==3.12.0 cffi==1.14.0
Создание директории и пользователя
Для Seafile создадим директорию /opt/seafile:
mkdir /opt/seafile
cd /opt/seafile
Создаём пользователя, под которым будет работать seafile (я назвал его sf) и назначаем права:
useradd -m -s /bin/bash sf
cd /
chown -R sf: ./opt/seafile/
cd /opt
ls -fla | grep seafile
Установка Seafile Server
Работаем под пользователем sf:
su - sf
Скачиваем и распаковываем дистрибутив:
cd /opt/seafile
wget https://download.seadrive.org/seafile-server_9.0.2_x86-64.tar.gz
tar -xf seafile-server_9.0.2_x86-64.tar.gz
ls -Fla
Устанавливаем Seafile:
cd /opt/seafile/seafile-server-9.0.2/
./setup-seafile-mysql.sh
Запускается мастер установки. В процессе установки нам зададут вопросы, отвечаем на них, у вас будут собственные ответы:
- What is the name of the server? It will be displayed on the client. Пишу — seafile.
- What is the ip or domain of the server? Домена пока нет, пишу прямой IP — 46.39.246.23.
- Which port do you want to use for the seafile fileserver? Порт по умолчанию 8082 — устраивает.
- Please choose a way to initialize seafile databases:
[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases
Я уже создал все БД, указываю 2. - What is the host of mysql server? По умолчанию сервер БД localhost — localhost.
- What is the port of mysql server? Порт по умолчанию 3306, меня устраивает.
- Which mysql user to use for seafile? Указываем имя пользователя MySQL. Я пишу — seafile.
- What is the password for mysql user «seafile»? Указываем пароль от пользователя MySQL.
- Enter the existing database name for ccnet: Пишу — seafile-ccnet.
- Enter the existing database name for seafile: Пишу — seafile-db.
- Enter the existing database name for seahub: Пишу — seafile-seahub.
Проверяем настройки. Нажимаем Enter. Устанавливается Seafile Server.
Пробуем запустить seafile:
cd /opt/seafile/seafile-server-latest/
./seafile.sh start
Пробуем запустить seahub:
./seahub.sh start
При первом запуске нас попросят создать админа для seafile, укажите email и пароль.
Проверим, что сервисы seafile и seahub работают и используют порты 8000 и 8082:
netstat -plntu
Останавливаем службы для дальнейшей настройки:
./seahub.sh stop
./seafile.sh stop
Настройка автозапуска Seafile в качестве сервисов
Работаем под рутом. Создаём сервис seafile:
cd /etc/systemd/system/
vim seafile.service
Содержимое:
[Unit] Description=Seafile After=network.target [Service] Type=forking ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop LimitNOFILE=infinity User=sf Group=sf [Install] WantedBy=multi-user.target
Создаём сервис seahub:
vim seahub.service
Содержимое:
[Unit] Description=Seafile hub After=network.target seafile.service [Service] Type=forking ExecStart=/opt/seafile/seafile-server-latest/seahub.sh start ExecStop=/opt/seafile/seafile-server-latest/seahub.sh stop User=sf Group=sf [Install] WantedBy=multi-user.target
Запускаем сервисы и настраиваем автозагрузку:
systemctl daemon-reload
systemctl start seafile
systemctl start seahub
systemctl enable seafile
systemctl enable seahub
Проверяем:
systemctl status seafile
systemctl status seahub
Службы настроены.
Установка и настройка Nginx
Выполним установку Nginx и первоначальную настройку Seafile.
Установим nginx:
apt-get install nginx -y
Проверим что настроен автозапуск:
systemctl is-enabled nginx
Если автозапуск не настроен, то можно включить:
systemctl enable nginx
Проверим:
systemctl status nginx
Создаём конфигурационный файл для Seafile:
cd /etc/nginx/
vim sites-available/seafile
Содержимое:
server { listen 80; server_name _; server_tokens off; proxy_set_header X-Forwarded-For $remote_addr; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_read_timeout 1200s; # used for view/edit office file via Office Online Server client_max_body_size 0; access_log /var/log/nginx/seahub.access.log; error_log /var/log/nginx/seahub.error.log; } location /seafhttp { rewrite ^/seafhttp(.*)$ $1 break; proxy_pass http://127.0.0.1:8082; client_max_body_size 0; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 36000s; proxy_read_timeout 36000s; proxy_send_timeout 36000s; send_timeout 36000s; } location /media { root /opt/seafile/seafile-server-latest/seahub; } }
Применяем конфигурацию:
rm -f /etc/nginx/sites-enabled/default
ln -s /etc/nginx/sites-available/seafile /etc/nginx/sites-enabled/
nginx -t
systemctl restart nginx
Начальная настройка Seafile Server
Работаем под пользователем sf:
su - sf
Переходим в директорию с файлами конфигурации:
cd /opt/seafile/conf/
ccnet.conf
Настраиваем ccnet.conf, указываем SERVICE_URL:
vim scnet.conf
Содержимое:
[General] SERVICE_URL = http://46.39.246.23 [Database] ENGINE = mysql HOST = 127.0.0.1 PORT = 3306 USER = seafile PASSWD = ПАРОЛЬ DB = seafile-ccnet CONNECTION_CHARSET = utf8
seafile.conf
Настраиваем seafile.conf, указываем host и keep_days:
vim seafile.conf
Содержимое:
[fileserver] host = 0.0.0.0 port = 8082 [database] type = mysql host = 127.0.0.1 port = 3306 user = seafile password = ПАРОЛЬ db_name = seafile-db connection_charset = utf8 [history] keep_days = 30
seahub_settings.py
Настраиваем seahub_settings.py:
mkdir /opt/seafile/seahub-data/thumbnail/
mkdir /opt/seafile/seahub-data/thumbnail/thumb/
vim seahub_settings.py
Содержимое:
# -*- coding: utf-8 -*- SECRET_KEY = "СОЛЬ" FILE_SERVER_ROOT = 'http://46.39.246.23/seafhttp' # For security consideration, please set to match the host/domain of your site, e.g., ALLOWED_HOSTS = ['.example.com']. # Please refer https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts for details. ALLOWED_HOSTS = ['46.39.246.23'] # Enalbe or disalbe registration on web. Default is `False`. ENABLE_SIGNUP = False DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'seafile-seahub', 'USER': 'seafile', 'PASSWORD': 'ПАРОЛЬ', 'HOST': '127.0.0.1', 'PORT': '3306', 'OPTIONS': {'charset': 'utf8mb4'}, } } ENABLE_SETTINGS_VIA_WEB = False TIME_ZONE = 'Europe/Moscow' LANGUAGE_CODE = 'ru' LANGUAGES = ( ('en', 'English'), ('ru', 'Русский'), ) SITE_NAME = 'Seafile' # Absolute filesystem path to the directory that will hold thumbnail files. THUMBNAIL_ROOT = '/opt/seafile/seahub-data/thumbnail/thumb/' SERVICE_URL = 'http://46.39.246.23'
Первый запуск
Проверяем что сайт заработал на HTTP протоколе.
http://46.39.246.23
Проверяем, что выполняется вход под созданным e-mail и паролем админа.
Настройка HTTPS и сертификата SSL
Правим конфигурационный файл для Seafile:
vim sites-available/seafile
В «server_name _;» указываем домен:
server_name internet-lab.ru;
Перезапускаем Nginx:
service nginx restart
Переходим в директорию с файлами конфигурации:
cd /opt/seafile/conf/
Правим ccnet.conf:
vim scnet.conf
В «SERVICE_URL» указываем домен и HTTPS:
SERVICE_URL = https://internet-lab.ru
Правим seahub_settings.py:
vim seahub_settings.py
В «SERVICE_URL» указываем домен и HTTPS. В «FILE_SERVER_ROOT» указываем домен и HTTPS. В «ALLOWED_HOSTS» добавляем домен.
SERVICE_URL = https://internet-lab.ru FILE_SERVER_ROOT = 'https://internet-lab.ru/seafhttp ALLOWED_HOSTS = ['46.39.246.23','internet-lab.ru']
Перезапускаем Seafile:
service seafile restart
service seahub restart
Устанавливаем certbot:
Let’s Encrypt — настройка certbot в Debian
Проверяем работу сайта по HTTPS:
Сайт работает.
Конфигурация Seafile
Переходим в директорию с файлами конфигурации:
cd /opt/seafile/conf/
Настраиваем seahub_settings.py согласно своим потребностям:
Это не все настройки, больше смотрите в документации.