Migrate from Seafile deployment to Seafile Docker | SQL-data issues

Hey!
I’m trying to migrate from Seafile deployment to Seafile Docker and having issues with getting the database data into the volume. I’m getting following connection error:

seafile    | verifying password of user root ...  done
seafile    |
seafile    | verifying password of user seafile ...
seafile    | Failed to connect to mysql server using user "seafile" and password "***": Access denied for user 'seafile'@'localhost' (using password: YES)
seafile    |
seafile    | Traceback (most recent call last):
seafile    |   File "/scripts/start.py", line 86, in <module>
seafile    |     main()
seafile    |   File "/scripts/start.py", line 56, in main
seafile    |     init_seafile_server()
seafile    |   File "/scripts/bootstrap.py", line 126, in init_seafile_server
seafile    |     call('{} auto -n seafile'.format(setup_script), env=env)
seafile    |   File "/scripts/utils/__init__.py", line 68, in call
seafile    |     return subprocess.check_call(*a, **kw)
seafile    |   File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
seafile    |     raise CalledProcessError(retcode, cmd)
seafile    | subprocess.CalledProcessError: Command '/opt/seafile/seafile-server-6.3.4/setup-seafile-mysql.sh auto -n seafile' returned non-zero exit status 255
seafile    | *** /scripts/start.py exited with status 1.
seafile    | *** Shutting down runit daemon (PID 32)...
seafile    | *** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown...
seafile    | Mar 10 20:24:11 313fa3993ac8 syslog-ng[25]: syslog-ng shutting down; version='3.13.2'
seafile    | *** Killing all processes...

Before I imported the sql-dump-data via:

docker exec -i seafile mysql -h127.0.0.1 -useafile -p<my_password> seahub_db  < /path_to/seahub-database.sql
docker exec -i seafile mysql -h127.0.0.1 -useafile -p<my_password> seafile_db < /path_to/seafile-database.sql
docker exec -i seafile mysql -h127.0.0.1 -useafile -p<my_password> ccnet_db   < /path_to/ccnet-database.sql

I already added privileges to seafile@localhost to all three databases

select user,host from mysql.user;
+---------+--------------+
| user    | host         |
+---------+--------------+
| seafile | 127.0.0.1    |
| seafile | localhost    |
+---------+--------------+

Do somebody has some hints for me regarding the migration process?

Thanks, Dominik

I’m receiving an identical error message when trying to move from one docker host to another using the documented backup and restore process. I’m very interested to see if anyone has any suggestions.

1 Like

Hey Dominik,
what password did you use to import the database?
In the Seafile container there is a mysql server running, which gets its own password at startup.

To check the password you can look at the ccnet.conf in the seafile directory. If the Docker container was started with the following parameter
-v /opt/seafile-data:/shared
you can find the ccnet.conf under
/opt/seafile-data/seafile/conf/ccnet.conf

there you will find two lines under [database].
USER = seafile
PASSWD = 4a5sf6fef-4676-4e18-96ce-52w7fb8gdh06

Hi Dennis, I had initialized the /shared folder structure and then used the password mentioned in ccnet.conf as far as I remember. But after a while I gave up and set up an ownCloud server.

I’m sorry to say. But the Docker support is not very advisable.

1 Like

Sorry for raising this zombie, but I have the same issue with my seafile installation running on docker.

As my volume ran full, I had to move the seafile persistence volume to a new location.
After this, seafile was no longer able to connect with the original mysql credentials for user ‘seafile’@’%.%.%.%’

It looks like seafile uses the value from str(uuid.uuid(4)) for the password of the mariadb user “seafile”.
Running docker restart seafile && docker exec -it seafile /usr/bin/python3 -c 'import uuid; print(str(uuid.uuid4()))' resulted in a value that is different from the password set in the ccnet.conf.

I updated the password for the seafile mariadb user via SET PASSWORD FOR 'seafile'@'%.%.%.%' = PASSWORD(.... uuid(4) ...) and verified that i can access the database using uuid(4).

The i updated the password entries in ccnet.conf, seafile.conf and seahub_settings.py
and restarted the seafile instance.

Still the seafile instance is killed directly after start due to the message

verifying password of user seafile …
Failed to connect to mysql server using user “seafile” and password “***”: Access denied for user ‘seafile’@‘192.168.176.3’ (using password: YES)

Traceback (most recent call last):
File “/scripts/start.py”, line 86, in
main()
File “/scripts/start.py”, line 56, in main
init_seafile_server()
File “/scripts/bootstrap.py”, line 145, in init_seafile_server
call(’{} auto -n seafile’.format(setup_script), env=env)
File “/scripts/utils/init.py”, line 70, in call
return subprocess.check_call(*a, **kw)
File “/usr/lib/python3.6/subprocess.py”, line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘/opt/seafile/seafile-server-7.1.4/setup-seafile-mysql.sh auto -n seafile’ returned non-zero exit status 255.

Is there some mechanism that I can use to either define the password for mariadb user ‘seafile’ in a config/environment file or find out, what uuid.uuid(4) value seafile uses for the mariadb user so I can change it to the required value?

Thanks and best,
jst

For what it’s worth (probably not much), i had A LOT of errors like yours when running the container not detached (using docker-compose up ).

As soon as i started using docker-compose up -d, all my errors went away, and everything worked fine.

Being a docker newbie, do not ask me why.