Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre/Post backup routine scripts #45

Closed
1 of 3 tasks
danielmbrown603 opened this issue Dec 30, 2021 · 3 comments · Fixed by #73
Closed
1 of 3 tasks

Pre/Post backup routine scripts #45

danielmbrown603 opened this issue Dec 30, 2021 · 3 comments · Fixed by #73
Labels
enhancement New feature or request

Comments

@danielmbrown603
Copy link

  • I'm submitting a ...

    • bug report
    • feature request
    • support request
  • What is the current behavior?

  • No ability to reference pre and post backup scripts

  • If the current behavior is a bug, please provide the configuration and steps to reproduce and if possible a minimal demo of the problem.

  • What is the expected behavior?

  • What is the motivation / use case for changing the behavior?
    Ability to reference scripts as part of the backup routine. For example, I could reference a database script to create a backup and then have docker-volume-backup tool backup the flat file, and all while leaving the database running. Or pihole is also the current use case I have as I don't want to take it down if I don't have too. Referencing a simple custom pre-backup script could solve this.

#!/bin/sh
# This script will create a Teleport backup to a directory that it is run in.

# Change to mapped directory
cd /backup

# Run Backup
pihole -a -t &

# Record the process id and wait
process_id=$!
wait $process_id
echo "Backup complete with status $?"
  • Please tell us about your environment:

    • Image version:latest
    • Docker version: 20.10.12
    • docker-compose version: 1.29.2
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc)

@m90 m90 added enhancement New feature or request help wanted Extra attention is needed labels Dec 30, 2021
@m90
Copy link
Member

m90 commented Dec 30, 2021

This is a good idea, but also pretty tricky to implement.

Mounting a script into the backup container and running it on certain occasions would be very simple, but won't be of much help as you likely want to run these scripts inside the application containers. This could be done using labels containing a command on the application containers, but that creates a few other obstacles:

  • replicating the behavior of docker exec using the Docker client is ridiculously hard, I failed to get it working once (it should be possible though)
  • this setup also gets tricky once you have multiple backup containers running in a setup: which backup container is supposed to trigger which commands? This probably could work like the stop-label mechanism, but I haven't thought it through entirely.

Considering this feature would take quite some time to implement and I don't need it myself I probably won't implement it too soon (there are other missing features like #29 that I would be using myself). If anyone wants to work on this though I am happy to give advice and merge PRs.

@m90 m90 removed the help wanted Extra attention is needed label Feb 20, 2022
@m90
Copy link
Member

m90 commented Feb 20, 2022

I started working on this here https://github.com/offen/docker-volume-backup/tree/exec-commands

@m90
Copy link
Member

m90 commented Feb 22, 2022

This is now supported as of v2.13.0.

@m90 m90 closed this as completed Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants