autorestic
autorestic copied to clipboard
Add restore hooks feature
Hi! This PR attempts to add the feature requested in #173 fix #173
You can configure these hooks in a new restore
node in the location
object, for example:
locations:
home:
from:
- /home/user/Desktop
to:
- hdd
hooks:
backup:
before:
- echo this is before backuping
restore:
before:
- echo this is before restoring
- echo this is a second message before restoring
after:
- echo this is after restoring
success:
- echo restore successed
failure:
- echo restore failed
The workflow is the same as backup hooks.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
autorestic | ✅ Ready (Inspect) | Visit Preview | Sep 14, 2022 at 11:09AM (UTC) |
Thanks for the PR!
I'm not 100% on board with the config file. I think it is a bit messy and confusing if we have 2 sections for hooks. one called hooks
and one restore
.
Probably something better would be to move the hooks
object one layer deeper for backup
and restore
locations:
home:
from:
- /home/user/Desktop
to:
- hdd
hooks:
backup:
before:
- echo this is before backuping
restore:
after:
- echo this is after restoring
This would habe breaking changes to the config though.
Thoughts? And sorry for the long wait!
Yes, I didn't want to introduce a breaking change but it would be definitely better.
I'm ok to introduce this breaking change but how to handle the old config ?
One could simply warn users about the change and those who have not changed the file might encounter problems (this would not be great for a backup tool). We could also check the version number of the configuration file and warn the user about the change or even migrate the configuration file but this requires the development of a migration feature (another PR)
I just saw how to handle it in internal/config.go
. Since it is a breaking change I will just bump the version of the config file to 3 and write the doc for the website
@cupcakearmy The configuration file has been changed, I wrote a little piece of docs to explain the new feature and to explain how to migrate the old configuration file. Can you give me feedback ?
Hi @cupcakearmy, any news on this PR ? Is the new config file ok for you ?
Hey @cupcakearmy I am sorry to ping you again ;). Do you have suggestion to get this PR merged ?
Hey, yes! No worries :)
Thanks for all the work, I know it's frustrating when prs don't get merged. The reason I was waiting is because I'm rewriting the whole logging stuff and touching a lot of files. However I won't be finished anytime soon so I guess we could merge this. Im not home rn, I'll check later. Make sure that there is good usability and clear instructions when the new version drops and that docs are clear enough
Before merging this PR I had an idea in this comment in #257 https://github.com/cupcakearmy/autorestic/issues/257#issuecomment-1314063341. I think it can help to build snapshot more easily (A location is more of a snapshot/group than actually a location/path) for example when you want to backup a service deployed with docker compose you might want to backup a database dump, a volume containing data and the deployment files in the same snapshot.
Please, this is so much needed ! :pray: