blacklabelops / volumerize

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

Restore with overwriting files #66

Closed maksymsereda closed 4 years ago

maksymsereda commented 5 years ago

My goal is to make restore with overwriting files? I mean I made backup, change file inside container and restore. But file is not overwriting, just if I delete file it will be restored. I use volumerize with docker-compose with such config.

  backups:
    container_name: volumerize
    image: myvolumerize
    restart: unless-stopped
    environment:
        - TZ=Europe/Warsaw
        - VOLUMERIZE_SOURCE=/source
        - VOLUMERIZE_TARGET=file:///backups
        - VOLUMERIZE_JOBBER_TIME=0 40 12 * * *
        - VOLUMERIZE_CONTAINERS=backend frontend postgres redis solr
        - DOCKER_API_VERSION=1.39
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - ~/data/backup-cache:/volumerize-cache
        ...
        - env:/source/src/.env
        - _gunicorn_access:/source/src/._gunicorn_access.txt
        - gunicorn_log:/source/src/gunicorn_log.txt

Checked and if I'm backuping one file it is not possible (maybe I mistake), but if it will be a folder it is overwriting a file after changing

blacklabelops commented 5 years ago

Use the internal restore skript: https://github.com/blacklabelops/volumerize#container-scripts

Example:

$ docker exec volumerize restore

Or the simulation without overwriting:

$ docker exec volumerize restore --dry-run
maksymsereda commented 5 years ago

Use the internal restore skript: https://github.com/blacklabelops/volumerize#container-scripts

Example:

$ docker exec volumerize restore

Or the simulation without overwriting:

$ docker exec volumerize restore --dry-run

I want to overwrite but this command is not overwriting my file $ docker exec volumerize restore I want to restore this file in my docker-compose.yml.

backups:
    container_name: volumerize
    image: myvolumerize
    restart: unless-stopped
    environment:
        - TZ=Europe/Warsaw
        - VOLUMERIZE_SOURCE=/source
        - VOLUMERIZE_TARGET=file:///backups
        - VOLUMERIZE_JOBBER_TIME=0 40 12 * * *
        - VOLUMERIZE_CONTAINERS=backend frontend postgres redis solr
        - DOCKER_API_VERSION=1.39
    volumes:
        ...
        - celery_log:/source/celery_smtp.log
        ...

Do i need to add any ro/rw ?

blacklabelops commented 5 years ago

I think the problem is the definition of the volumes.

Docker expects directories not folders. You should check your backups. Are the listed files are even in the backups?

You should use directories and then define includes and excludes: https://unix.stackexchange.com/questions/117761/how-to-include-exclude-directories-in-duplicity

maksymsereda commented 5 years ago

Are the listed files are even in the backups?

Please tell me how to check this? As i understand volumerize can backup directories but not files?

  backend:
    image: backend
    volumes:
      - ~/data/media-data:/src/media
   solr:
    image: solr
    volumes:
      - ~/data/solr-data:/opt/solr/server/solr/mycores
  ...
  backups:
    image: myvolumerize
    environment:
        - VOLUMERIZE_SOURCE=/source
        - VOLUMERIZE_TARGET=file:///backup
        - VOLUMERIZE_CONTAINERS=backend frontend postgres redis solr
        - DOCKER_API_VERSION=1.39
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - ~/data/backup-cache:/volumerize-cache
        - ~/data/media-data:/source/src/media                                     #container backend
        - ~/data/psql-data:/source/var/lib/postgresql/data                     #container postgres
        - ~/data/redis-data:/source/data                                               #container redis
        - ~/data/solr-data:/source/opt/solr/server/solr/mycores           #container solr
        - celery_log:/source/src/celery_smtp.log                                 #this is a file located in backend
        - gunicorn_log:/source/src/gunicorn_log.txt                             #this is a file located in backend
        - gunicorn_error:/source/src/gunicorn_error.txt                        #this is a file located in backend
        - gunicorn_access:/source/src/gunicorn_access.txt                 #this is a file located in backend

Could you tell me what I am doing wrong? All files above celery_smtp.log was backuped but not those files. Thanks in advance

blacklabelops commented 4 years ago

Duplicity does not restore, when there is the chance of data loss. The parameter --force will override this. You can also restore single files.

Please consult Duplicity for appropriate parameters. Duplicity parameters can easily be added to each command.