Skip to content

Migrate from non-docker Seafile deployment to docker

Note

  • This document is written to about the single node, you have to do the following opeartions (except migtating database) in all nodes if you are using Seafile Cluster
  • Normally, we only recommend that you perform the migration operation on two different machines according to the solution in this document. If you decide to perform the operation on the same machine, please pay attention to the corresponding tips in the document.

The recommended steps to migrate from non-docker deployment to docker deployment on two different machines are:

  1. Upgrade your Seafile server to the latest version.
  2. Shutdown the Seafile, Nginx and Memcached according to your situations.
  3. Backup MySQL databse and Seafile libraries data.
  4. Deploy the Seafile Docker in the new machine.
  5. Recover the Seafile libraries and MySQL database in the new machine.
  6. Start Seafile Docker and shutdown the old MySQL (or Mariadb) according to your situations.

Upgrade your Seafile server

You have to upgrade the version of the binary package to latest version before the migration, and ensure that the system is running normally.

Tip

If you running a very old version of Seafile, you can following the FAQ item to migrate to the latest version

Stop basic Services (except MySQL)

Stop Seafile server

Run the following commands in /opt/seafile/seafile-server-latest:

Note

For installations using python virtual environment, activate it if it isn't already active:

source python-venv/bin/activate

Tip

If you have integrated some components (e.g., SeaDoc) in your Seafile server, please shutdown them to avoid losting unsaved data

su seafile
./seafile.sh stop
./seahub.sh stop

Stop Nginx, cache server (e.g., Memcached), ElasticSearch

You have to stop the above services to avoid losing data before migrating.

systemctl stop nginx &&  systemctl disable nginx
systemctl stop memcached &&  systemctl disable memcached
docker stop es && docker remove es

Backup MySQL database and Seafile server

Please follow here to backup:

  • Backing up MySQL databases
  • Backing up Seafile library data

Deploy the Seafile Docker

You can follow here to deploy Seafile with Docker, please use your old configurations when modifying .env, and make sure the Seafile server is running normally after deployment.

Use external MySQL service or the old MySQL service

This document is written to migrate from non-Docker version to Docker version Seafile between two different machines. We suggest using the Docker-compose Mariadb service (version 10.11 by default) as the database service in after-migration Seafile. If you would like to use an existed MySQL service, always in which situation you try to do migrate operation on the same host or the old MySQL service is the dependency of other services, you have to follow here to deploy Seafile.

Recovery libraries data for Seafile Docker

Firstly, you should stop the Seafile server before recovering Seafile libraries data:

docker compose down

Then recover the data from backuped file:

cp /backup/data/* /opt/seafile-data/seafile

Recover the Database (only for the new MySQL service used in Seafile docker)

  1. Start the database service Only:

    docker compose up -d --no-deps db
    
  2. Follow here to recover the database data.

  3. Exit the container and stop the Mariadb service

    docker compose down
    

Restart the services

Finally, the migration is complete. You can restart the Seafile server of Docker-base by restarting the service:

docker compose up -d

By the way, you can shutdown the old MySQL service, if it is not a dependency of other services, .