[SOLVED] "Requested page is unavailable" on docker install using mounted NAS as seafile-data drive

I’m very new to Docker, so I’m probably messing up the permissions here…

Issue
When I try to use a mounted drive as the data directory, after logging in with the default admin details on the web page, I’m sent to a blank “Sorry, but the requested page is unavailable due to a server hiccup” page, and cannot use the server.

Docker Compose
I’m using the default docker-compose.yml (added at the bottom of the post) - with only modifications to the port, passwords and data directory (which is the issue I explain below).

Local Data Directory
If I leave the data volume as /opt/seafile-data, I get a fully functioning instance of Seafile! It’s fast, simple and perfect for my use.

Only I would like my data directory to be stored on my mounted NAS drive.

Mounted Data Directory
When pointing the data volume to my mounted SMB drive in the docker-compose.yml, after deployment I can log into the Seafile interface, but I am presented with a page stating “Sorry, but the requested page is unavailable due to a server hiccup” and cannot use the server.

If I “docker exec -it seafile bash” into the container and type “id -u” and “id -g” they both return 0. So I’m assuming that by mounting my NAS drive in fstab with (uid=0,gid=0) the Seafile Docker container would have access.

When I look in the /media/nas/seafile directory I can see that the installation has created the correct file structure (with logs, nginx and seafile directories). So that got me confused… since it’s clear the container can access the drive.

To make double-sure, back inside the Docker container I navigate to the share data directory and create a test file:
root@1238aeafd074:/shared/seafile/seafile-data# touch testingDATA

Then when I exit the container and navigate back to the mounted drive:
root@nuc:/media/nas/seafile/seafile/seafile-data#
The file “testingDATA” is there!

That’s where my understanding of Docker ends, unfortunately.

Logs
I did check the seafile container log file which might provide further clues to the problem - but I’m not sure if this is a critical issue that’s not resolved or not:

waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'db' ([Errno 111] Connection refused)")
[07/09/2020 05:21:24][upgrade]: The container was recreated, running minor-upgrade.sh to fix the media symlinks
[07/09/2020 05:21:24][upgrade]: Running script /opt/seafile/seafile-server-7.1.4/upgrade/minor-upgrade.sh

Any assistance would be massively appreciated!

Thanks,
Chris.

Edit: here’s my fstab and docker-compose.yml in case that helps:

//192. 168.1.21/seafile /media/nas/seafile cifs credentials=/.smbcredentials,uid=0,gid=0,dir_mode=0770,file_mode=0770 0 0

version: ‘2.0’
services:
db:
image: mariadb:10.1
container_name: seafile-mysql
environment:
- MYSQL_ROOT_PASSWORD=******* # Requested, set the root’s password of MySQL service.
- MYSQL_LOG_CONSOLE=true
volumes:
- /opt/seafile-mysql/db:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.
networks:
- seafile-net

  memcached:
    image: memcached:1.5.6
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net

  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "7006:80"
#     - "443:443"  # If https is enabled, cancel the comment.
    volumes:
      - /media/nas/seafile:/shared   # Requested, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=*********  # Requested, the value shuold be root's password of MySQL service.
#      - TIME_ZONE=Etc/UTC  # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - SEAFILE_ADMIN_EMAIL=******@******* # Specifies Seafile admin user, default is 'me@example.com'.
      - SEAFILE_ADMIN_PASSWORD=*******     # Specifies Seafile admin password, default is 'asecret'.
      - SEAFILE_SERVER_LETSENCRYPT=false   # Whether to use https or not.
      - SEAFILE_SERVER_HOSTNAME=*****.******** # Specifies your host name if https is enabled.
    depends_on:
      - db
      - memcached
    networks:
      - seafile-net

networks:
  seafile-net:

I’ve done some more testing, messing around with volume directories to see where the problem is.

If I change my docker-compose.yml so that both the MySQL and Shared volumes point to my /media/nas drive, the seafile-mysql container exists straight after running docker-compose up and produces the following log:

2020-07-09 23:50:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.1.45+maria-1~bionic started.
2020-07-09 23:50:21+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-07-09 23:50:21+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.1.45+maria-1~bionic started.
2020-07-09 23:50:21+00:00 [Note] [Entrypoint]: Initializing database files
2020-07-09 23:50:21 140272627894272 [Note] /usr/sbin/mysqld (mysqld 10.1.45-MariaDB-1~bionic) starting as process 90 ...
2020-07-09 23:50:21 140272627894272 [Warning] Can't create test file /var/lib/mysql/ae8a438ad88f.lower-test
/usr/sbin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 "Permission denied")
2020-07-09 23:50:21 140272627894272 [ERROR] Aborting


Installation of system tables failed!  Examine the logs in
/var/lib/mysql/ for more information.

Does this indicate that the mysql container is running as a different user than the standard seafile container (since the later has no problem accessing the 0:0 mounted NAS drive) and causing communication problems between the two containers?

When I change docker-compose.yml back so that the seafile-mysql container volume is mounted to /opt/seafile-mysql, the mysql container appears to start up without issues.

Finally, I noticed that the seafile container log has the follow messages at the end, which I missed in my previous post:

[07/10/20 00:02:41] ../common/session.c(148): using config file /opt/seafile/conf/ccnet.conf
[07/10/20 00:02:41] SQL error: 5 - database is locked
:       CREATE TABLE IF NOT EXISTS Config (key TEXT PRIMARY KEY, value TEXT);
Starting seafile server, please wait ...
** Message: 00:02:41.922: seafile-controller.c(541): No seafevents.

Seafile server started

Done.

Starting seahub at port 8000 ...

Error happened during creating seafile admin.


Seahub is started

Done.

Is this “database is locked” message the critical component to my installation running into the “requested page is unavailable” issue?

I’ve been trying to get both Nextcloud (which I gave up on) and now Seafile Dockers working for almost 2 weeks now, and I’m really struggling to persevere. I’m sure it’s just some simple Docker concept that hasn’t clicked with me yet.

Any chance anyone’s got a suggestion on this?

All I’m doing is setting my data volume to a mounted drive. I would have thought this type of configuration was quite common.

I’ve made some progress, but still am unable to upload files to the seafile server.

Using this forum post from Feb 2020, I gained some insight into using a mounted drive as a data directory:

Following advice from that post, instead of attempting a symlink on the entire seafile-data directory, I focused on /seafile-data/storage instead. This allowed me to finally log into the web interface.

Here’s a snip of my docker-compose.yml that made this possible:

  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "7006:80"
    volumes:
      - /opt/seafile-data:/shared   # Requested, specifies the path to Seafile data persistent store.
      - /media/nas/seafile:/media/nas/seafile

The notable addition is the bind volume /media/nas/seafile:/media/nas/seafile. From my understanding this allowed me to create a symlink to /media/nas/seafile on my host computer from within the container’s “shared” volume, replacing the /seafile-data/storage directory.

From within the container, I can perform a “touch test” from the syslink’d storage folder, and when navigating to /media/nas/seafile on my host, the “touch” file is there - so I know the syslink is pointing to the right spot on the host.

The issue that still remains is that I cannot upload files either via the web interface nor the Windows client. The Windows client returns a “! Server error” immediately - whereas the web interface allows me to drag and drop folders into a library, but after the upload gets to 100%, returns an “internal error” message.

Any insights would be most helpful.

This took way too long for me to find a solution for, but it’s all good now. Apparently Seafile doesn’t like symlinks!

Instead of symlinking the my mounted /media/nas/seafile directory to /opt/seafile-data/seafile/seafile-data, I just mounted the drive directly onto the seafile-data directory itself!

Such a painful journey for such a simple solution.

I discovered this method from a previous topic on the forum:

2 Likes

Thank you for posting your solution. It should be a help to someone down the road. I had no idea that symlinks were a bad idea either.

1 Like