Skip to content

Instantly share code, notes, and snippets.

@mrl22
Last active February 6, 2024 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrl22/579eb6263411a0a62acb2515278472c4 to your computer and use it in GitHub Desktop.
Save mrl22/579eb6263411a0a62acb2515278472c4 to your computer and use it in GitHub Desktop.
Borgmatic config /etc/borgmatic/config.yaml

apt update

apt install python3-pip borgbackup

pip3 install --user --upgrade borgmatic

pip3 install --upgrade requests

/root/.local/bin/generate-borgmatic-config

curl https://gist.githubusercontent.com/mrl22/579eb6263411a0a62acb2515278472c4/raw/config.yaml > /etc/borgmatic/config.yaml

nano /etc/borgmatic/config.yaml

borg init -e repokey-blake2 ssh://[CHANGEME1]@backup.webfwd.co.uk/./repo /root/.local/bin/borgmatic init -e repokey-blake2

#First Run

/root/.local/bin/borgmatic --verbosity 2 --syslog-verbosity 1

#setup cron

0 2 * * * /root/.local/bin/borgmatic --verbosity -1 --syslog-verbosity 1

location:
source_directories:
- /etc
- /home
- /var/www
- /root
repositories:
- ssh://[CHANGEME1]@backup.webfwd.co.uk/./repo
# one_file_system: true
storage:
compression: auto,zstd
encryption_passphrase: [CHANGEME2]
archive_name_format: '{hostname}-{now:%Y-%m-%d-%H%M%S}'
relocated_repo_access_is_ok: true
retries: 5
retry_wait: 5
retention:
keep_daily: 3
keep_weekly: 4
keep_monthly: 36
consistency:
checks:
- disabled
# Uncomment to regularly read all repo data
# Needs recent Borgmatic version
# - name: repository
# frequency: 4 weeks
# - name: archives
# frequency: 8 weeks
check_last: 3
hooks:
mysql_databases:
- name: all
format: sql
options: --single-transaction --skip-lock-tables
before_backup:
- echo "`date` - Starting backup"
after_backup:
- echo "`date` - Finished backup"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment