Page:
0. Overview
Pages
0. Overview
1.0 Quick start
2.0 Installation
2.1 Configuration notes
2.2 Run as root
3.0 Script parameters
4.0 Configuration details file
4.1 Extra backup locations
4.2 Excluded backup locations
4.3 Prune timeframe examples
4.4 Configuration examples
5.0 503 functionality
6.0 Scheduling via cron
7.0 Logs
7.1 Using logwatch
7.1.1 Logfile Group file
7.1.2 Service definition file
7.1.3 Service script
7.1.4 Timestamp processing
7.1.5 Testing
8.0 Restore overview
8.1 Restore extract
8.2 Restore install mailcow
8.3 Restore restoring data
8.3.1 Restore manual restore
9.0 Final notes
2
0. Overview
Asif Bacchus edited this page 2020-05-07 04:51:41 -06:00
Table of Contents
mailcow backup using borgbackup
This script automates backing up your Mailcow installation using borgbackup and a remote ssh-capable storage system. I suggest using rsync.net since they have great speeds and a special pricing structure for borgbackup/attic users (details here).
This script automates the following tasks:
- Optionally copies a 503 error page to your webserver so users know when your server is unavailable due to backups being performed. The 503 file is removed when the backup is completed so users can login again
- implementation of this feature is dependant on your particular webserver, this script only copies the file for your webserver to find
- Dumps the Mailcow mySQL database and adds it to the backup
- Handles stopping and re-starting mail-flow containers (postfix and dovecot) so everything is in a consistent state during the backup
- Allows you to specify additional files you want backed up
- Allows you to specify files/directories to exclude from your backups
- Runs 'borg prune' to make sure you are trimming old backups on your schedule
- Creates a clear, easy to parse log file so you can keep an eye on your backups and any errors/warnings
The script will backup the following items:
- the entirety (including subdirectories) of whatever directory contains mailcow.conf
- mailcow SQL database (standard SQL dump file will be generated)
- the following mailcow volumes:
- vmail (email)
- rspamd (Rspamd settings including custom maps)
- postfix
- redis
- crypt (your encryption keys!!!)
- any directories/files listed in the plain-text file as specified by borgXtraListPath in backup.details
I've tried to explain all features as clearly as I can in this wiki but, if you have any questions or suggestions for improvements, please file an issue!
Hope this script helps you manage your backups a little easier :-)