Community v11, seafevents.main: No section: 'DATABASE'

Since upgrade to v11 (community edition, docker), the seafile-monitor.log file is flooded with following:

[2024-01-07 09:35:33] Start Monitor 
[2024-01-07 09:35:33] Start seafevents.main                                              
No section: 'DATABASE'
ERROR:root:Failed create tables, error: create db engine error: No section: 'DATABASE'   
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-11.0.3/pro/python/seafevents/db.py", line 113, in create_db_tables
    engine = create_engine_from_conf(config)                                             
  File "/opt/seafile/seafile-server-11.0.3/pro/python/seafevents/db.py", line 40, in create_engine_from_conf
    backend = config.get(db_sec, 'type')
  File "/usr/lib/python3.10/configparser.py", line 783, in get                           
    d = self._unify_values(section, vars)
  File "/usr/lib/python3.10/configparser.py", line 1154, in _unify_values                
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'DATABASE'                                      

During handling of the above exception, another exception occurred:                      

Traceback (most recent call last):
  File "/opt/seafile/seafile-server-11.0.3/pro/python/seafevents/main.py", line 43, in main
    create_db_tables(config)
  File "/opt/seafile/seafile-server-11.0.3/pro/python/seafevents/db.py", line 116, in create_db_tables
    raise RuntimeError("create db engine error: %s" % e)                                 
RuntimeError: create db engine error: No section: 'DATABASE'                             

During handling of the above exception, another exception occurred:                      

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main                  
    return _run_code(code, main_globals, None,                                           
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code                             
    exec(code, run_globals)
  File "/opt/seafile/seafile-server-11.0.3/pro/python/seafevents/main.py", line 75, in <module>
    main()                                  
  File "/opt/seafile/seafile-server-11.0.3/pro/python/seafevents/main.py", line 47, in main
    raise RuntimeError('Failed create tables, error: %s' % e)                            
RuntimeError: Failed create tables, error: create db engine error: No section: 'DATABASE'

Seafile seems to work normally. What am I missing? Do we need to update the docs?

I solved it by creating the file “seafevents.conf” in the conf folder and creating the seafevents database:

  • Copy the template from here: events.conf.template
  • Remove the “DATABASE” section that doesn’t apply (I’m using mysql so I removed the sqlite section)
  • update the fields as needed (I updated usernames, password and host to match the seafile.conf file)
  • In mysql create the database “seafevents” and grant permissions to the user like:

GRANT ALL PRIVILEGES ON seafevents.* to seafile@localhost;

Hi,

I’ve got the same messages in my seafile server community edition docker version 11.0.5.
Thanks for the tips to solve the issue.

I’d like to share a little more, since a spend some time to fix it. Here is a quick way to go procedure.

Enter the database container, create the seafevents database and give privileges to seafile user:

# docker exec -it <seafile-db-container> bash                                                                                  
root@9d791eb302b8:/# mysql -h db -p                                                                                   
Enter password:                                                                                                       Welcome to the MariaDB monitor.  Commands end with ; or \g.                
Your MariaDB connection id is 7                                                                                       
Server version: 10.11.7-MariaDB-1:10.11.7+maria~ubu2204 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 [(none)]> create database seafevents ;                                                                        
Query OK, 1 row affected (0.006 sec)                                                                                  
                                         
MariaDB [(none)]> grant all privileges on seafevents.* to 'seafile'@'%' identified by '<seafile db passord>';
Query OK, 0 rows affected (0.020 sec)

MariaDB [(none)]> bye;

create seafevents.conf file in conf directory, and fill it with something like this :

# cat /shared/seafile/conf/seafevents.conf
[DATABASE]
type = mysql
username = seafile
password = <PassWord>
name = seafevents
host = db

[INDEX FILES]
interval = 5m
seafesdir = /data/github/seafes/

[STATISTICS]
enabled = true

And finally, restart your seafile.

Now you can use the new “activites” entry in the web interface.

PS: It would be great to add this in an upgrade script.

The seafevents configuration file should be generate automatically when upgrading from v10 to v11. If it is not, you can create it manually.

It is also recommended to use seahub_db to store the tables needed for seafevents component instead of creating a separate database.

Ok,
My bad, I performed a direct upgrade from 9.0.10 to 11.0.5, that why I’ve got troubles…