SeaTable docker: superuser creation script exits with errors

Hello everyone,

I am trying to get SeaTable docker (seafileltd/seatable:latest) to run on a Synology NAS, which will only be accessed locally.

The NAS’ ip address is 10.0.0.10.
The ports 80 and 443 are already in use and can’t be used for SeaTable, so I want to map 9080 and 9443 to the respective internal ports of the SeaTable docker.
The folder should be /volume1/docker/seatable/.

My docker-compose.yml looks as follows:

version: "2.0"
services:
  db:
    image: mariadb:10.4
    container_name: seatable-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=mypassword
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /volume1/docker/seatable/mysql-data:/var/lib/mysql
    networks:
      - seatable-net

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

  redis:
    image: redis:5.0.7
    container_name: seatable-redis
    networks:
      - seatable-net

  seatable:
    image: seatable/seatable:latest
    container_name: seatable
    ports:
      - "9080:80"
      - "9443:443"
    volumes:
      - /volume1/docker/seatable/seatable-data:/shared
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=mypassword 
      - SEATABLE_SERVER_LETSENCRYPT=False
      - SEATABLE_SERVER_HOSTNAME=10.0.0.10
      - TIME_ZONE=UTC
    depends_on:
      - db
      - memcached
      - redis
    networks:
      - seatable-net

networks:
  seatable-net:

Running dock-compose up -d will spin up the docker files seemingly without any issues:

Starting seatable-mysql     ... done
Starting seatable-memcached ... done
Starting seatable-redis     ... done
Starting seatable           ... done

Following this guide I ran the start script:
docker exec -d seatable /shared/seatable/scripts/seatable.sh start
…which executes without errors.

Then I ran:
docker exec -it seatable /shared/seatable/scripts/seatable.sh superuser
… which at first asked for my mail address and password. After repeating the password it stops and displays the following traceback / errors:

E-mail address: user@domain.com
Password:
Password (again):
Traceback (most recent call last):
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py", line 517, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py", line 732, in _read_query_result
    result.read()
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py", line 1075, in read
    first_packet = self.connection._read_packet()
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py", line 684, in _read_packet
    packet.check_error()
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, "Table 'dtable_db.profile_profile' doesn't exist")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/opt/seatable/seatable-server-1.3.0/dtable-web/seahub/base/management/commands/createsuperuser.py", line 150, in handle
    User.objects.create_superuser(email, password)
  File "/opt/seatable/seatable-server-1.3.0/dtable-web/seahub/base/accounts.py", line 138, in create_superuser
    u = self.create_user(email, password, is_staff=True, is_active=True)
  File "/opt/seatable/seatable-server-1.3.0/dtable-web/seahub/base/accounts.py", line 69, in create_user
    Profile.objects.add_or_update(username=virtual_id, contact_email=email)
  File "/opt/seatable/seatable-server-1.3.0/dtable-web/seahub/profile/models.py", line 29, in add_or_update
    profile = self.get(user=username)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/query.py", line 374, in get
    num = len(clone)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/query.py", line 232, in __len__
    self._fetch_all()
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/query.py", line 1121, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/models/sql/compiler.py", line 889, in execute_sql
    cursor.execute(sql, params)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/django/db/backends/mysql/base.py", line 101, in execute
    return self.cursor.execute(query, args)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py", line 517, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py", line 732, in _read_query_result
    result.read()
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py", line 1075, in read
    first_packet = self.connection._read_packet()
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/connections.py", line 684, in _read_packet
    packet.check_error()
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/protocol.py", line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/opt/seatable/seatable-server-latest/dtable-web/thirdpart/pymysql/err.py", line 109, in raise_mysql_exception
    raise errorclass(errno, errval)
django.db.utils.ProgrammingError: (1146, "Table 'dtable_db.profile_profile' doesn't exist")

I am not sure what is causing the issue with dtable or the database setup.

I also tried to run the other commands of the seatable.sh script.
docker exec -it seatable /shared/seatable/scripts/seatable.sh init-sql
… results in:

mysql server is ready
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1007 (HY000) at line 1: Can't create database 'ccnet_db'; database exists
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1007 (HY000) at line 1: Can't create database 'seafile_db'; database exists
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1007 (HY000) at line 1: Can't create database 'dtable_db'; database exists
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1050 (42S01) at line 15: Table 'activities' already exists
Init sql success

And running docker exec -it seatable /shared/seatable/scripts/seatable.sh init
… will just return:

Init config success

I’m very thankful for every helpful hint.
Thanks a lot in advance!

Can you login into the MySQL and check the tables inside database dtable_db?

1 Like

Within the seatable-mysql docker container, yes:

docker exec -it seatable-mysql mysql -h 127.0.0.1 -P 3306 -u root -p dtable_db
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.4.15-MariaDB-1:10.4.15+maria~focal mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [dtable_db]>

from within the seatable container it can’t establish a connection:

docker exec -it seatable mysql -h 127.0.0.1 -P 3306 -u root -p dtable_db
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

Am I assuming correctly that it should? All containers share the virtual network seatable-net as per the docker-compose.yml.

Thanks a lot for looking into this!

In the seatable container, you should use the command:

docker exec -it seatable mysql -h db -P 3306 -u root -p dtable_db

The hostname should be changed to db.

Can you run show tables to list tables in dtable_db?

1 Like

Accessing from within the seatable container works fine as well.
The database dtable_db exists with the following tables:

mysql> show tables;
+--------------------------+
| Tables_in_dtable_db      |
+--------------------------+
| activities               |
| user_activities          |
| user_activity_statistics |
+--------------------------+
3 rows in set (0.00 sec)

Thanks a lot for your help!

Seems only very few tables are created in dtable_db. Can you try to delete the SeaTable folder and start from initialization phase again?

Thanks again for your help!

It turned out that I had to add …

logging:
  driver: "json-file"

… to each created service and run docker-compose down to also remove the network “seatable-net” to really start fresh.
Without this logging settings the init scripts wouldn’t get far enough.

Running docker-compose up afresh after adding this did the trick … partially.
I can create new bases, but when I try to access them a loading spinner will be displayed endlessly.

Furthermore, oddly the avatars are not loading. Is there still an issue with the database connection?
avatar

Your problem looks familiar to a problem I know from Seafile. Proceed as follows: Check via the browser console if the avatar can be loaded. If it can, it is a caching problem. (And I am sure it is.)

I don’t have a SeaTable systems to play round with, but in Seafile I would do this:

  • Delete the seahub_cache folder in /tmp
  • Restart memcached.
1 Like

Thank you for your reply!
Actually even if I open the avatar in a dedicated new tab the image doesn’t load. It tries to get it from http://10.0.0.1/media/avatars/default.png.
However, it does load, if I add the modified port 9080 to the address: http://10.0.0.1:9080/media/avatars/default.png.

It seems to me that all installation scripts are tailored to be used with the default ports 80/443.
Is there a central place to change it or do I need to edit all scripts, incl. those that exist by default inside the container?