blacklabelops / volumerize

Docker Volume Backups Multiple Backends
https://hub.docker.com/r/blacklabelops/volumerize/
MIT License
558 stars 77 forks source link

[enhancement] Container restart #29

Closed tomtom30 closed 6 years ago

tomtom30 commented 6 years ago

Hi, I have try volumerize and it's very useful for save my volumes. I'am using container restart option and i saw a little problem for me. When it save multi containers, it begin to stop it and save all containers, and at the end restart all containers. It takes so much time to save all containers and during this, they are all stopped. Is it possible to saving all container one by one ( stop -> save -> start , stop -> save -> start, etc ) ?

Sorry for bad english i'am french you know :)

Thomas

blacklabelops commented 6 years ago

How do you now which volumes belong to which container?

In your case you would need to know that when I stop container A you will have to backup volumes Z and Y. Then your starting container A and stop container B where you will have to know that you need to backup volume X.

tomtom30 commented 6 years ago

I understand. A solution could be in container declaration? exemple: "VOLUMERIZE_CONTAINERS=application@jenkins_volume application_database@jenkins_volume" Or something like that? It can be with "docker container inspect " too.

blacklabelops commented 6 years ago

Currently, everything is written inside one backup. When you change stop and startup procedure like that then you will get a different backup for each volume. This means, you will need for each backup:

Example:

$ docker run -it --rm \
    --name volumerize \
    -v yourvolume1:/source1:ro \
    -v yourvolume2:/source2:ro \
    -v backup_volume1:/backup1 \
    -v backup_volume2:/backup2 \
    -v cache_volume:/volumerize-cache \
    -e "VOLUMERIZE_SOURCE1=/source1" \
    -e "VOLUMERIZE_TARGET1=file:///backup1" \
    -e "VOLUMERIZE_SOURCE2=/source2" \
    -e "VOLUMERIZE_TARGET2=file:///backup2" \
    blacklabelops/volumerize backup

In order to simplify this I advice people to just start multitple instances of volumerize. Same effect like in the example.

tomtom30 commented 6 years ago

Ok I will create one instance of volumerize per container. Really thanks Nice Job Thomas

dicastro commented 6 years ago

I don't think creating one instance of volumerize per container is correct.

When you have depending containers (application server and database) and both with data. Both should be stopped, backuped up and restarted together.

If there is one instance of volumerize per container, there could be inconsistences between the data of the database and the data of the application server.

The example above (the one with VOLUMERIZE_SOURCE1, VOLUMERIZE_SOURCE2, VOLUMERIZE_TARGET1, VOLUMERIZE_TARGET2), was just an hipothetical example or it is possible to create an instance of volumerize like that?

I think that example is the best approach to make a backup of a composition of multiple containers. (By using the variable VOLUMERIZE_CONTAINERS, to stop containers before the backup and restart them after the backup)