Upgrade seafile docker from v6 to v8 + MariaDB

Hello,
I’ve got a problem updating an old seafile-pro docker (version 6.3) to the actual version 8. This is the docker-compose.yaml I’m using right now and it works fine with this 6.3 image

Harbor

version: '2'

networks:
  seafile-net:
	name: seafile-net

services:
  db:
	image: mariadb:10.5
	container_name: seafile-mysql
	restart: "no"
	environment:
	  - MYSQL_ROOT_PASSWORD=SOMEPASSWORD
	  - MYSQL_LOG_CONSOLE=true
	volumes:
	  - /mnt/storage/seafile/mysql/db:/var/lib/mysql
	networks:
	  - seafile-net

  memcached:
	image: memcached:1.5.6
	container_name: seafile-memcached
	restart: "no"
	entrypoint: memcached -m 256
	networks:
	  - seafile-net

#### just for seafile-pro:
  elasticsearch:
	image: seafileltd/elasticsearch-with-ik:5.6.16
	container_name: seafile-elasticsearch
	environment:
	  - discovery.type=single-node
	  - bootstrap.memory_lock=true
	  - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
	ulimits:
	  memlock:
		soft: -1
		hard: -1
	mem_limit: 2g
	volumes:
	  - /mnt/storage/seafile/elasticsearch/data:/usr/share/elasticsearch/data
	networks:
	  - seafile-net
#### just for seafile-pro EOM        
		  
  seafile:
	image: docker.seadrive.org/seafileltd/seafile-pro:latest
	container_name: seafile
	restart: "no"
	expose:
	  - "80"
	  - "8000" #webUI
	  - "8082" #Sync with app
	  - "8080" #webdav
	volumes:
	  - /mnt/storage/seafile/shared:/shared
	environment:
	  - DB_HOST=db
	  - DB_ROOT_PASSWD=SOMEPASSWORD
	  - TIME_ZONE=Europe/Berlin
	  - SEAFILE_ADMIN_PASSWORD=SOMEPASSWORD
	  - SEAFILE_SERVER_HOSTNAME=MYHOSTNAME
	depends_on:
	  - db
	  - memcached
	  - elasticsearch
	networks:
	  - seafile-net

If I try to follow the upgrade guide Upgrade Seafile Docker Professional Edition to 7.0 - Seafile Admin Manual it won’t work. If I use the latest image of the newest seafile version

Harbor

the seafile docker container logs the following error on startup:

[root@serv1 seafile]# docker logs -f seafile
*** Running /etc/my_init.d/01_create_data_links.sh...
*** Booting runit daemon...
*** Runit started as PID 27
*** Running /scripts/enterpoint.sh...
2021-12-15 20:53:37 Nginx ready
2021-12-15 20:53:37 This is a idle script (infinite loop) to keep container running.
[12/15/2021 20:53:37][upgrade]: Running script /opt/seafile/seafile-pro-server-8.0.14/upgrade/upgrade_6.3_7.0.sh

-------------------------------------------------------------
This script would upgrade your seafile server from 6.3 to 7.0
Press [ENTER] to contiune
-------------------------------------------------------------


Can't find a python executable of version 2.7 or above in PATH
Install python 2.7+ before continue.
Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it

[2021-12-15 20:53:37] Skip running setup-seafile-mysql.py because there is existing seafile-data folder.
[2021-12-15 20:53:37] Running scripts /opt/seafile/seafile-pro-server-8.0.14/upgrade/upgrade_6.3_7.0.sh
Traceback (most recent call last):
  File "/scripts/start.py", line 86, in <module>
	main()
  File "/scripts/start.py", line 58, in main
	check_upgrade()
  File "/scripts/upgrade.py", line 182, in check_upgrade
	run_script_and_update_version_stamp(script, new_version)
  File "/scripts/upgrade.py", line 61, in run_script_and_update_version_stamp
	call(script)
  File "/scripts/utils.py", line 70, in call
	return subprocess.check_call(*a, **kw)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
	raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/opt/seafile/seafile-pro-server-8.0.14/upgrade/upgrade_6.3_7.0.sh' returned non-zero exit status 1.

I switched into the running docker container and modified the upgrade_6.3_7.0.sh script to use python 3. If I do that it runs a little bit further but still complains:

root@38914d982cdd:/opt/seafile# /opt/seafile/seafile-pro-server-8.0.14/upgrade/upgrade_6.3_7.0.sh

-------------------------------------------------------------
This script would upgrade your seafile server from 6.3 to 7.0
Press [ENTER] to contiune
-------------------------------------------------------------


Updating seafile/seahub database ...

[INFO] You are using MySQL
[INFO] updating ccnet database...
[ERROR] Failed to connect to mysql database ccnet_db: Access denied for user 'seafile'@'%.%.%.%' to database 'ccnet_db'

Failed to upgrade your database

It seems like it searches for a ccnet database because it thinks I use MySQL, but as you can see in my docker-compose.yaml I use MariaDB instead. Can anyone help me to understand how to update my seafile docker deployment to the actual version. Is there a special update script to use with MariaDB?

Thanks a lot in advance for your help!
Best regards,
Tobias

There are two ways to bypass the problem

  1. Comment out the database upgrade in the upgrade scripts and manual connect to MySQL and run the SQL statements
  2. Run version 7.0 image first and then run 7.1 image, then run version 8.0 image.

Hello Daniel,

thanks a lot for your reply! Can you tell me which SQL commands I have to run for the first solution you suggested? Thanks!

You can find SQL upgrade statements for each version here: https://github.com/haiwen/seahub/tree/master/scripts/upgrade/sql

They are also available inside the docker image (/opt/seafile)

Thank you very much! It worked like a charm.