Backup and restore

Questions, comments, discussions. Over time certain topics might be moved to their own category.
Post Reply
Crayiii
Posts: 9
Joined: Fri Aug 24, 2018 12:25 am

Backup and restore

Post by Crayiii » Fri Aug 24, 2018 3:43 pm

I have the latest version of Mayan-EDMS version running in docker with MySQL.

Our business now has close to 10,000 PDF files stored and indexed and we love how easy it is to search and find things.

Right now I'm just running rsync nightly to copy the Mayan data folder to another server so we have a backup of the PDF files.

I'm looking for help with a backup/restore procedure. What should I be doing to make it as easy as possible to get Mayan back up and running with our data in case if a disaster? What would the restore process look like?

Also, what if I want to move these containers and the data to another server running docker? Is there a way to move everything?

mrflippy
Posts: 3
Joined: Fri Aug 24, 2018 4:42 am

Re: Backup and restore

Post by mrflippy » Fri Aug 24, 2018 4:45 pm

I need to look into this as well.

The documentation has this page: http://docs.mayan-edms.com/en/stable/to ... ckups.html

I haven't actually tested this yet, but it looks fairly straight forward.

Edit: I *think* the only thing you'd need for a move to a different Docker server is the data -- copy the data somewhere and then set up new docker containers to point to the data/database locations.

User avatar
rosarior
Posts: 385
Joined: Tue Aug 21, 2018 3:28 am

Re: Backup and restore

Post by rosarior » Sun Aug 26, 2018 7:43 am

As @mrflippy mentions, you don't need to move the Docker container. The important bits are the database and the volume with the document files. The backup process is a a two step process: 1-Copy the files, 2-Dump the database into an SQL text file. After that the containers don't matter.

In the sample Docker installation provided here: http://docs.mayan-edms.com/en/stable/to ... tml#docker
The docker container is called mayan-edms-postgres and you would dump the database using pg_dump. The second container runs the Mayan code and stores the document in the hosts /docker-volumes/mayan-edms/media folder. This is determined by this line:

Code: Select all

-v /docker-volumes/mayan-edms/media:/var/lib/mayan
Volumes are persistent. So you can delete the Mayan container. Create a new one and as long as you mount the volume you will still have all your document files. This example is using a host folder as a volume. You can also create "named" volumes and remote volumes. I've read about installs that mount a NAS' share as a folder and use that as a volume. This way the data is automatically backed up. Then just runs an SQL dump script using a cron job to backup the database.

I would recommend you stop the Mayan image before doing the backups to make sure there are no database updates that will render the dump invalid.

To restore from a backup: 1-Copy the files into a new Docker volume (host folder). 2-Create a new database container. 3-Rebuild the database from the SQL text file. 4-Create a new Mayan container with credentials to the database container and with the volume mounted.

radumza
Posts: 1
Joined: Mon Jul 08, 2019 9:51 am

Re: Backup and restore

Post by radumza » Mon Jul 08, 2019 9:54 am

To backup up the docker volume as above mentioned I normally use this:

Code: Select all

docker run --rm -it -v {put here the absolute path of your local folder}:/backup -v /var/lib/docker:/docker alpine:edge tar cfz /backup/mayan-edms_app.tgz /docker/volumes/mayan-edms_app/
This will create a tgz archive if the `mayan-edms_app` volume.

Post Reply