Skip to content

Upgrade Seafile Docker Community Edition to 7.0

Starting with 7.0, we have adjusted seafile-docker image to use multiple containers. The old image runs MariaDB-Server and Memcached in the same container with Seafile server. Now, we strip the MariaDB-Server and Memcached services from the Seafile image and run them in their respective containers. In order to be compatible with the data of the old container, you need to follow the process below to upgrade to the new version.

To prevent accidental old-fashioned upgrades, the new docker image has a new name called seafile-mc (Seafile Multiple Container). The new image is configured and run using docker-compose.

Check the current container data

Suppose the current Seafile container's volumes directory is:/opt/seafile-data

So the data structure of the Seafile container should look like this:

├── db                <----------->     the data directory of MySQL
├── logs
   ├── seafile       <----------->     the logs directory of Seafile
   └── var-log
└── seafile
    ├── ccnet
    ├── conf          <----------->     the configuration directoy of Seafile
    ├── pro-data
    ├── seafile-data
    └── seahub-data

Modify MariaDB permissions

In the old container, the MariaDB user is only allowed to access through the '' address. This permission is not enough in the new container, so you must first modify the permissions of MariaDB.

Allow root remote access

The root needs to be allowed to access the MySQL remotely by specifying a password. E.g:

  • Suppose the current Seafile container name is:seafile
  • Specify the access password of the root as:db_dev

Refer to the following command to allow root to remotely access MariaDB:

sudo docker exec -it seafile /usr/bin/mysql -e "grant all on *.* to 'root'@'%.%.%.%' identified by 'db_dev';"

Allow seafile remote access

Similarly, you need to allow seafile to access the MariaDB remotely with the specified password. E.g:

  • Suppose the current Seafile container name is:seafile
  • The seafile password needs to look at the PASSWD value in the current container's ccnet.conf configuration, assuming:467fa02f-bf9a-4afb-9300-c4683073162a
for database in {ccnet_db,seafile_db,seahub_db}; do sudo docker exec -it seafile /usr/bin/mysql -e "grant all on ${database}.* to 'seafile'@'%.%.%.%' identified by '467fa02f-bf9a-4afb-9300-c4683073162a';"; done

Modify the configuration file of Seafile

You also need to modify the MariaDB service address and Memcached service address in the configuration file of Seafile.

  • Suppose the current Seafile container name is:seafile

Stop the current Seafile container

First you need to stop the old container that is currently running.

sudo docker stop seafile

Backup configuration file

Back up the original configuration file of Seafile.

cd /opt/seafile-data/seafile
sudo tar -cf conf.bak.tar conf
cd conf

Modify the configuration file of Seafile

  • ccnet.conf:Change the HOST value to db in the [Database] configuration section ;
  • seafile.conf:Change the host value to db in the [database] configuration section ;
  • the 'HOST' value to 'db' in the DATABASES dict,and change the 'LOCATION' value to 'memcached:11211' in the CACHES dict .

Migrate MariaDB data

Backup the data of MariaDB

cd /opt/seafile-data
sudo tar -cf db.bak.tar db

Migrate the data's directory of MariaDB

Migrate the db directory out of the volume directory of the old container, so that the new MariaDB container can be used to mount the original data. If the directory is migrated to the /opt/seafile-mysql directory:

sudo mkdir -p /opt/seafile-mysql
sudo mv db /opt/seafile-mysql/

Modify the docker-compose.yml

Community Edition:Download docker-compose.yml sample file to the host.

According to the actual situation, modify the docker-compose.yml, mainly the following:

  • The password of MySQL root ( MYSQL_ROOT_PASSWORD and DB_ROOT_PASSWD ), should be set to the root password above,such as:db_dev ;
  • The volume directory of MySQL data ( volumes ), should be set to the directory after the migration above, such as:/opt/seafile-mysql/db:/var/lib/mysql ;
  • The volume directory of Seafile data ( volumes ),should be set to the directory of the old container's volume, such as:/opt/seafile-data:/shared .

Run new container

Delete the old container

sudo docker rm seafile

Run the new container

Go to the directory where has the docker-compose.yml file and run the following command to start the new container:

sudo docker-compose up
# You may need to install the docker-compose beforehand, plus the -d to run the command in the background.

Tip: In addition to setting the correct TIME_ZONE in the docker-compose.yml , you also need to set TIME_ZONE = 'your-timezone' in the