blacklabelops / volumerize

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

Adding `remove-all-but-n-full`, `remove-all-inc-of-but-n-full` scripts #7

Closed darron1217 closed 7 years ago

darron1217 commented 7 years ago

@blacklabelops Maybe this issue is related with issue #5 . This request is simply adding 2 removing method to the plugin, so that most issues dealing with removing method will be solved :)

I don't know much about shell scripting.. but I just made an example to explain the request

e.g. at /imagescripts/create_scripts.sh

cat > ${VOLUMERIZE_SCRIPT_DIR}/remove-all-but-n-full <<_EOF_
#!/bin/bash
set -o errexit
exec ${DUPLICITY_COMMAND} remove-all-but-n-full ${PARAMETER_PROXY} ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_TARGET}
_EOF_

cat > ${VOLUMERIZE_SCRIPT_DIR}/remove-all-inc-of-but-n-full <<_EOF_
#!/bin/bash
set -o errexit
exec ${DUPLICITY_COMMAND} remove-all-inc-of-but-n-full ${PARAMETER_PROXY} ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_TARGET}
_EOF_

e.g. Removing all except for 1 full backup set on every 3 a.m.

$ docker run -d \
    --name volumerize \
    -v jenkins_volume:/source:ro \
    -v backup_volume:/backup \
    -e "VOLUMERIZE_SOURCE=/source" \
    -e "VOLUMERIZE_TARGET=file:///backup" \
    -e "JOB_NAME2=RemoveOldFullBackups" \
    -e "JOB_COMMAND2=/etc/volumerize/remove-all-but-n-full 1" \
    -e "JOB_TIME2=0 0 3 * * *" \
    blacklabelops/volumerize

It was just my imagination :) Can it be implemented?

darron1217 commented 7 years ago

Actually, I found workaround with this problem.. haha

e.g.

       JOB_NAME2: RemoveOldFullBackups
       JOB_COMMAND2: duplicity remove-all-but-n-full 1 $${VOLUMERIZE_TARGET} --force
       JOB_TIME2: 0 0 * * * *

But anyway, it can be clearer if those methods are implemented as a script :)

blacklabelops commented 7 years ago

Scripts are added, please wait till image is build and check.

darron1217 commented 7 years ago

@blacklabelops You are the best 👍 I'll check this as soon as image updated :)

darron1217 commented 7 years ago

It's working perfectly!

Really appreciate for the feedbacks :)