Fresh docker install, admin user issue

Hi,

I’m trying to setup seafile through docker. After the first startup, I open the web login page, but when I try to signin with the admin credential (provided to SEAFILE_ADMIN_EMAIL and SEAFILE_ADMIN_PASSWORD), it fails with an error message Incorrect email or password. There is no network issue though (all 200 even /accounts/login/ request responds with 200). So it’s quite confusing.

Inspecting seafile container’s logs, this seems to be related

Error happened during creating seafile admin.

compose.yml:

services:
  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    restart: unless-stopped
    environment:
      SEAFILE_ADMIN_EMAIL: me@mail.com
      SEAFILE_ADMIN_PASSWORD: admin
      DB_HOST: seafile-db
      DB_ROOT_PASSWD: mysql
      SEAFILE_SERVER_LETSENCRYPT: false
    ports:
      - "12345:80"
    volumes:
      - /box/seafile:/shared
    depends_on:
      - seafile-db
      - memcached
    networks:
      - seafile

  memcached:
    image: memcached:alpine
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile

  seafile-db:
    image: mysql:latest
    container_name: seafile-db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: mysql
    volumes:
      - seafile-db:/var/lib/mysql
    networks:
      - seafile

volumes:
  seafile-db:

networks:
  seafile:

When I try to run myself reset-admin.sh script from inside the container it also fails

$ docker exec -it seafile /opt/seafile/seafile-server-latest/reset-admin.sh
E-mail address: test@test.io
Password:
Password (again):
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-10.0.1/seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/seafile/seafile-server-10.0.1/seahub/thirdpart/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/seafile/seafile-server-10.0.1/seahub/thirdpart/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/seafile/seafile-server-10.0.1/seahub/thirdpart/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/seafile/seafile-server-10.0.1/seahub/thirdpart/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/opt/seafile/seafile-server-10.0.1/seahub/seahub/base/management/commands/createsuperuser.py", line 150, in handle
    User.objects.create_superuser(email, password)
  File "/opt/seafile/seafile-server-10.0.1/seahub/seahub/base/accounts.py", line 71, in create_superuser
    u = self.create_user(email, password, is_staff=True, is_active=True)
  File "/opt/seafile/seafile-server-10.0.1/seahub/seahub/base/accounts.py", line 61, in create_user
    return self.get(email=email)
  File "/opt/seafile/seafile-server-10.0.1/seahub/seahub/base/accounts.py", line 99, in get
    raise User.DoesNotExist('User matching query does not exits.')
seahub.base.accounts.DoesNotExist: User matching query does not exits.

Am I missing something? Does anyone have a working seafile deployed using latest docker images?

inspecting the mysql database (inside the db container)

mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| root             | %         |
| seafile          | %.%.%.%   |    // what is this host ???
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
6 rows in set (0.00 sec)

This is related to Can't create admin user: Error happened during creating seafile admin

Just execute:

$ docker compose exec seafile-db mysql -u root -pmysql -e "ALTER USER 'seafile'@'%.%.%.%' IDENTIFIED WITH mysql_native_password BY 'seafile-user-password';"
$ docker compose exec seafile seafile-server-latest/reset-admin.sh

You can find the generated seafile user password for example in seafile.conf.

Any particular reason you didn’t used the compose file provided in the manual (which uses mariadb, preventing this issue)?

Hi,

The link to the docker-compose.yml file, in the official docs, is dead
Plus (if I haven’t missed it) there is no source of detailed documentation on how the container is expected to be run, using which database etc

thx I’ll try that

Where I’m suppose to find that file from inside the container?

Easiest way would be to use bind mounts and browse the config directory from the host. Here is the directory tree of the volume.

But this would work fine:

docker compose exec seafile cat conf/seafile.conf

You’ll find the password in the database section.

Seems to have been fixed. Most things aren’t documented in the context of docker though, the mysql issue is addressed here for example. This can be confusing.

Ok thx @Barolo, I just switched to mariadb and it works as expected. No reason for me to stick with mysql (especially since it requires more effort)