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
add borg backup #1727
add borg backup #1727
Conversation
In my fork of the playbook I use m3nu.ansible_role_borgbackup. For the DB dump to work I needed to also install a psql-client that matches the container and make the container accessible from the host. In my experience, trying to back up all of I have added in mine the ability to post info about running backups and logs to matrix, and - in case they fail - also to email via the email proxy already included with the playbook via apprise. borgmatic_failure_command:
- "\"{{ apprise_docker_call }} --title '[{{ hostname }}] Borgmatic Backup Error' --body '{% raw %}{{app_title}}{% endraw %}<br>@room: there was an error creating a backup!' --tag=error\""
borgmatic_before_backup_command:
- "\"{{ apprise_docker_call }} --title '[{{ hostname }}] Borgmatic Backup' --body '{% raw %}{{app_title}}{% endraw %}<br>starting...' --tag=backup\""
borgmatic_after_backup_command:
- "\"{{ apprise_docker_call }} --title '[{{ hostname }}] Borgmatic Backup Complete' --tag=backup\"" My cron jobs are roughly borgmatic_command: "borgmatic -c /etc/borgmatic/config.yaml --no-color"
borgmatic_log: "--log-file {{ borgmatic_log_file }}"
apprise_send_borgmatic_log: "{{ apprise_docker_call }} -e --body \"<pre><code>$(cat /borgmatic.log)\\n</code></pre>\\n\" --tag=backup"
# backup job
{{ borgmatic_command }} --create --stats > {{ borgmatic_log_file }} 2>&1; {{ apprise_send_borgmatic_log }}
# check job
rm {{ borgmatic_log_file }}; {{ borgmatic_command }} --check --log-file-verbosity 1 {{ borgmatic_log }}; {{ apprise_send_borgmatic_log }} There are some more paths that are not necessary to include in a backup since they are just cached remote files, here are all I set: borg_exclude_patterns:
- /matrix/synapse/storage/media-store/remote_content
- /matrix/synapse/storage/media-store/remote_thumbnail
- /matrix/synapse/storage/media-store/url_cache
- /matrix/synapse/storage/media-store/url_cache_thumbnails
- /matrix/postgres/data (note that one ends in |
Here is the actual log output of that PR without the #1726 fix:
As it was mentioned in https://matrix.to/#/!cNSQwPqhHKkIZdBnvt:devture.com/$hXtfV8Y7oYav2VW6tH3jsBVV9hodtUHakssKGq0T75M?via=devture.com&via=matrix.org&via=tu-dresden.de the problem you mentioned may be caused by the user mismatch. Please, keep in mind that it's "mvp" version and it should be enhanced further. |
From your log it looks like it, the matrix user wouldn't have access to some of these files. In my case the job is simply running as root (idk how much worse this is over your solution, but that isn't relevant to the issue at hand) and should not have any user mismatch trouble, instead I believe it is cased by the flow of
I should mention that this error did not happen immediately, but only after some months of operation. I only caught it thanks to reading the daily logs (being posted to matrix).
I understand. Some of my hints were given towards later improvements, but the error I experienced certainly shouldn't happen in an mvp. My current solution achieves these stats with daily backups, started in October 2021
|
I'm prepairing a new commit with exclude patterns |
now you can add anything to the ignore patterns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding another backup option! We can never have enough of those ;)
I've submitted some comments - mostly about variables that could be named in a more consistent manner. We can merge this as it is, but if we'd like to rename them later, it'd be more trouble (adding deprecation notices in valdiate_config.yml
), so it's better if we do it earlier.
Will apply the suggestions a bit later today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a few other potential issues. Sorry for the back and forth!
Thanks a lot for adding this and for your patience fixing it up! 🙇 |
Related to: - spantaleev#1727 - spantaleev#1754 - spantaleev#1755 - spantaleev#467
This might be a stupid question, but I couldn't find it obviously explained in any documentation: what timezone is the |
@axiopaladin your server's (host OS) timezone |
Note: the used docker image supports multiple architectures and builds weekly
Another note: we use rsync.net borg and that PR was developed and tested on it, but other vendors (eg: hetzner storage box) work in the same way, so there is no vendor-lock