Small backup utility for pulling:
- MySQL databases via
mysqldump - Filesystems via
rsync - InfluxDB backups via the Influx CLI
- FTP content via
ftplib(FTPBackupManageris still incomplete / experimental)
The entrypoint is sync.py, which reads configuration from backup_details.json in the repository root.
- Daily, weekly, and monthly backup rotation
- Optional table whitelist for database backups
- Optional SSH tunnel support for database backups
.tgzarchive output- Compression via Python's built-in
tarfile,gzip, orpigz
- Python 3
- Python packages from
requirements.txt:mysql-connector-pythonsshtunnel
Install into a local virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txtOn bash shells:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txtSome backup modes also require external executables. These are not installed by pip.
- Database backups:
mysqldump - Rsync backups:
rsyncandssh - InfluxDB backups:
influx - Optional compression modes:
compression = "python"uses only Pythoncompression = "gzip"requirestarcompression = "pigz"requirestarandpigz
If a tool is not on PATH, point the corresponding config value at its full executable path.
- Copy
backup_details_example.jsontobackup_details.json. - Fill in the sections you need.
- Run the sync script.
Example:
Copy-Item backup_details_example.json backup_details.json
python sync.pyThe config file has four top-level sections:
settings: shared settings such asmysqldump,tmp_folder,compression, andinflux_clidbs: MySQL backup definitionsftp: FTP backup definitionsrsync: rsync backup definitionsinflux: InfluxDB backup definitions
Useful config fields:
store_location: destination root for that backup setbackup_file_format: currentlytgzdaily_backups,weekly_backups,monthly_backups:0disables that cadence- positive integer keeps that many archives
-1keeps unlimited archives for that cadence
Each backup target writes into its store_location using subfolders such as:
day/week/month/tmp/current/for rsync backups