Open psyciknz opened 2 years ago
That is an interesting idea. Personally, I prevent this problem by just running those commands on a schedule way before the restic backup is scheduled. Then you can be quite sure that the latest version of the dumps will be backupped.
So I do not need to run any pre-commands. Of course this approach only works well if you only do backups daily or a few times a day, so you can have a sufficient period between dump and backup schedule.
That said, I am open for the different feature you propose. But I think no changes are really necessary to the resticker image for that to work. You only need to write that command file somewhere on your host, mount it into the resticker container and then set the path to the file as a pre-command in the environment.
So can i do it already?
If I have all my commands in a file exposed to the restic container. How does my restic container know about it to call it. As in what do I have to change in my compose file to get restiker to pull in it's commands from a file rather than env variable?
Just make the file executable and set PRE_COMMANDS=/path/to/file/in/the/container
. I think that should work.
hmm I shall give this a go and report back. Thanks for the prompt reply
I'm looking at bolstering my DB backups held in restic. At the moment I have a stack of pre-commands that are held in my restic backup client for all the docker containers on this host.
As I'm also tryign to move to ansible I'm now in the situation where I have the pre commands set in my host, which deploys restic well before these other services that willl come later.
So in thinking on that, I wondered if the pre-commands might not be read in from a file, so that as each of my other services deploy, they could infact update the pre-commands file with it's specific pre-command needs.
So in my traccar task deployment, that would add:
To the precommands for my restic backup file as when writing that task, or deploying it, it makes sense the command is though about at the traccar task level not at my restic service.
Of course I could just make more restic-containers. And have then do specific tasks. That was another thought, but then ideally I want short run containers that end when completed.