Seafile docker with Traefik2 fails

Hello together,

want to migrate from Raspi-version to docker.
I created a compose file:

# MariaDB - MySQL Database
# After starting container for first time dexec and mysqladmin -u root password <password>
#    image: linuxserver/mariadb:latest
  image: mariadb:10.5
  container_name: seafile-mariadb
  restart: always
    - seafile_net
    - no-new-privileges:true
      #    ports:
      #      - "3306:3306"
      #- $DOCKERDIR/mariadb/data:/config
    - $DOCKERDIR/mariadb:/var/lib/mysql
    - PUID=$PUID
    - PGID=$PGID
    - TZ=$TZ
    - FILE__MYSQL_ROOT_PASSWORD=/run/secrets/mysql_root_password # Note FILE__ (double underscore) - Issue #127
    - mysql_root_password

  image: memcached:latest
  container_name: seafile-memcached
  restart: unless-stopped
  entrypoint: memcached -m 256
    - seafile_net

  image: seafileltd/seafile-mc:latest
  container_name: seafile
  restart: unless-stopped
    - $DOCKERDIR/seafile:/shared # Requested, specifies the path to Seafile data persistent store.
    - DB_HOST=seafile-mariadb
    - TIME_ZONE=Europe/Berlin
    - "traefik.enable=true"
    ## HTTP Routers
    - "traefik.http.routers.seafile.entrypoints=https"
    - "traefik.http.routers.seafile.rule=Host(`seafile.$DOMAINNAME`)"
    - "traefik.http.routers.seafile-secure.tls=true"
    - "traefik.http.routers.seafile.service=seafile"
    ## Middlewares
    - "traefik.http.routers.seafile.middlewares=chain-no-auth@file"
   # - "traefik.http.routers.jellyfin-rtr.middlewares=chain-authelia@file"
    ## HTTP Services
    - ""
    - ""
    - seafile-mariadb
    - seafile-memcached
    - seafile_net
    - t2_proxy

I get after the start this error:

2021-06-28T19:07:13.048615680Z *** Booting runit daemon...
2021-06-28T19:07:13.055355992Z *** Runit started as PID 16
2021-06-28T19:07:13.055421402Z *** Running /scripts/
2021-06-28T19:09:23.345693829Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile-mariadb' ([Errno 111] Connection refused)")
2021-06-28T19:09:23.345761639Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile-mariadb' (timed out)")
2021-06-28T19:09:23.345820960Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile-mariadb' ([Errno -2] Name or service not known)")
2021-06-28T19:09:23.345834460Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile-mariadb' ([Errno -2] Name or service not known)")
2021-06-28T19:09:23.345865420Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile-mariadb' ([Errno -2] Name or service not known)")
2021-06-28T19:09:23.345878130Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile-mariadb' ([Errno -2] Name or service not known)")

Is anybody out there, can help me with this plz?

After I used the linuxserver/mariadb:latest image. It creates DBs but stop
2021-06-28T20:06:45.555846640Z *** Running /etc/my_init.d/ 2021-06-28T20:06:45.603777223Z *** Booting runit daemon... 2021-06-28T20:06:45.604074714Z *** Runit started as PID 16 2021-06-28T20:06:45.604186215Z *** Running /scripts/ 2021-06-28T20:06:48.116543937Z Checking python on this machine ... 2021-06-28T20:06:48.121605426Z 2021-06-28T20:06:49.402162200Z 2021-06-28T20:06:49.402189430Z verifying password of user root ... done 2021-06-28T20:06:49.402194520Z 2021-06-28T20:06:49.402198310Z --------------------------------- 2021-06-28T20:06:49.402201870Z This is your configuration 2021-06-28T20:06:49.402205240Z --------------------------------- 2021-06-28T20:06:49.402361661Z 2021-06-28T20:06:49.402377751Z server name: seafile 2021-06-28T20:06:49.402435481Z server ip/domain: 2021-06-28T20:06:49.402450831Z 2021-06-28T20:06:49.402477341Z seafile data dir: /opt/seafile/seafile-data 2021-06-28T20:06:49.402490171Z fileserver port: 8082 2021-06-28T20:06:49.402518151Z 2021-06-28T20:06:49.402529841Z database: create new 2021-06-28T20:06:49.402554422Z ccnet database: ccnet_db 2021-06-28T20:06:49.402566602Z seafile database: seafile_db 2021-06-28T20:06:49.402599002Z seahub database: seahub_db 2021-06-28T20:06:49.402611662Z database user: seafile 2021-06-28T20:06:49.402637042Z 2021-06-28T20:06:49.402649772Z 2021-06-28T20:06:49.402674872Z Generating ccnet configuration ... 2021-06-28T20:06:49.402686412Z 2021-06-28T20:06:49.402710732Z Generating seafile configuration ... 2021-06-28T20:06:49.402722312Z 2021-06-28T20:06:49.402747104Z done 2021-06-28T20:06:49.402758674Z Generating seahub configuration ... 2021-06-28T20:06:49.402783394Z 2021-06-28T20:06:49.402794734Z ---------------------------------------- 2021-06-28T20:06:49.402820164Z Now creating ccnet database tables ... 2021-06-28T20:06:49.402831884Z 2021-06-28T20:06:49.402856394Z ---------------------------------------- 2021-06-28T20:06:49.402868164Z ---------------------------------------- 2021-06-28T20:06:49.402893934Z Now creating seafile database tables ... 2021-06-28T20:06:49.402905694Z 2021-06-28T20:06:49.402929804Z ---------------------------------------- 2021-06-28T20:06:49.402943424Z ---------------------------------------- 2021-06-28T20:06:49.402971875Z Now creating seahub database tables ... 2021-06-28T20:06:49.402994105Z 2021-06-28T20:06:49.403020135Z ---------------------------------------- 2021-06-28T20:06:49.403031445Z 2021-06-28T20:06:49.403059055Z Error: Failed to init seahub database: Lost connection to MySQL server during query ([Errno 104] Connection reset by peer) 2021-06-28T20:06:49.414737078Z [2021-06-28 22:06:48] Now running in auto mode. 2021-06-28T20:06:49.414773869Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile-mariadb' ([Errno 111] Connection refused)") 2021-06-28T20:06:49.416121786Z Traceback (most recent call last): 2021-06-28T20:06:49.416137996Z File "/scripts/", line 86, in <module> 2021-06-28T20:06:49.416142186Z main() 2021-06-28T20:06:49.416145176Z File "/scripts/", line 56, in main 2021-06-28T20:06:49.416148226Z init_seafile_server() 2021-06-28T20:06:49.416151056Z File "/scripts/", line 145, in init_seafile_server 2021-06-28T20:06:49.416154006Z call('{} auto -n seafile'.format(setup_script), env=env) 2021-06-28T20:06:49.416156806Z File "/scripts/utils/", line 70, in call 2021-06-28T20:06:49.416159726Z return subprocess.check_call(*a, **kw) 2021-06-28T20:06:49.416163626Z File "/usr/lib/python3.6/", line 311, in check_call 2021-06-28T20:06:49.416166606Z raise CalledProcessError(retcode, cmd) 2021-06-28T20:06:49.416169516Z subprocess.CalledProcessError: Command '/opt/seafile/seafile-server-8.0.5/ auto -n seafile' returned non-zero exit status 1. 2021-06-28T20:06:49.442122589Z *** /scripts/ exited with status 1. 2021-06-28T20:06:49.448137102Z *** Shutting down runit daemon (PID 16)... 2021-06-28T20:06:49.451260119Z *** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown... 2021-06-28T20:06:49.465768028Z *** Killing all processes...

All databases seems to be created, maybe not all tables or maybe the permissions are not correct?!

MariaDB [(none)]> show databases;
| Database           |
| ccnet_db           |
| information_schema |
| mysql              |
| performance_schema |
| seafile_db         |
| seahub_db          |
6 rows in set (0.000 sec)

i hit the same issue with a fresh deployment like you did.

the fun thing i figured out after a while that Seafile seems to change database permissions in a way that it can’t connect to further.

if you are migrating with a database dump, just make sure that you populated the database with it before startintg Seafile.

for fresh (test) deployments i added an sql script to the database container that created the databases and set permissions instead of Seafile. i could dig that out.

1 Like

actually, i ended up with this broader rule in /docker-entrypoint-initdb.d/seafile.sql (within the database container):

GRANT ALL ON *.* TO 'root'@'%';

whether the permissions are dysfunctional can be inspected with select user, host from mysql.user;

1 Like

Hey @funkyfuture,

I compared my momentary already working docker-compose.yml with the entry I did here. So yes finally I got it to work, already some weeks before, but to answer to myself was still open in my task list :smiley:
Thanks a lot for your hints! I think the second message with the SQL fix seems very promising! I didn’t test it because I have to migrate from hardware (Cubietruck - single-board computer) to Docker. Your hint was exactly what I did, first do the db migration (db dump and restore), then just start Seafile!
It runs a while with mariadb 10.5, which slowed for any reason the system down after a while (also after GC and restarting everything). Now with latest It’s running fine and I’m happy :slight_smile:

I did use a little bit modified documentation from this anchored step on: Seafile Server

Großartig! :100: :rocket:

The problem was that I wanted first start Seafile and check if it works and then just do the migration, but yes in my opinion its still a bug, if you cant start initially without your adjustment :man_shrugging: Would be great if this will find a place in the officially provided docker image :slight_smile: