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

Trigger rotate backups on remote host #42

Conversation

jan-brinkmann
Copy link
Contributor

This enables us to trigger rotate-backups on the remote host if we upload backups by means of scp.

When using scp to upload backups, we already have extensive rights on the remote host. We use this rights to trigger rotate-backups directly ob the remote host. Thus, we do not need rotate-backups directly in the Docker container (unlike in pull request 36).

The schema to preserve to and remove backups can be customized as descriped in the documentation. We also can run a dry-run to test the schema. Additionaly, there is an example docker-compose file.

@jareware
Copy link
Owner

This functionality would be great to have!

Though I wonder if it would be even more flexible to simply allow specifying some SCP_POST_COMMAND..? If you want to use rotate-backups you can do:

SCP_POST_COMMAND="rotate-backups --hourly 1 --daily 7 --weekly 4 --monthly 12 --yearly always"

but if you want to use some other tool, you can use that just as well. Or something really simple like:

SCP_POST_COMMAND="rm -v $(date -d -'1 month')*"

to remove files that are from last month.

Would require just 1 config variable on our end, and not be tied to a specific tool.

Or maybe 2 variables, if you want to include SCP_PRE_COMMAND for symmetry. 😉

What do you think?

@jan-brinkmann
Copy link
Contributor Author

@jareware, thank you for the quick review!

You are absolutely right stating that the functionality implemented in this pull request can be realized in a more generalized way. I like the idea on allowing to execute arbitrary commands on the remote host. You can find the respective pull request here: #43. There is an example addressing rotate-backups.

If #43 makes in into the master branch, the present pull request becomes irrelevant to some extent. On the one hand side, the functionality on triggering rotate-backups will be available anyway. On the other hand side, the present pull request provides a default backup schema and, therefore, can be activated in a more simple way: ROTATE_BACKUPS: true. Further, if pull request #36 would also make it into the master, we could use ROTATE_BACKUPS, ROTATE_DAILY and so on for both scp and local (or nfs) backups. I.e., one interface for two implementations of rotate-backups.

Regards,
Jan

@jareware
Copy link
Owner

jareware commented Jan 3, 2022

Oh yeah, good point about local (or NFS) backup rotation not really being solved yet, as the pre/post commands are only for SCP backups.

Hmm.

Should we have a separate pair of PRE_COMMAND and POST_COMMAND which are ran locally if defined?

@jan-brinkmann jan-brinkmann mentioned this pull request Jan 3, 2022
@jan-brinkmann jan-brinkmann deleted the Trigger-rotate-backups-on-remote-host branch January 12, 2022 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants