From b0db38a691e8675215f683ae10ebc519303ce7f8 Mon Sep 17 00:00:00 2001 From: VetheonGames <76892542+VetheonGames@users.noreply.github.com> Date: Thu, 23 Feb 2023 17:53:55 -0700 Subject: [PATCH] Create the readme --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0e1d76c --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# B2 Ru(by)sql Backups + +This Ruby program is designed to perform regular backups of a MySQL database to a local directory, and optionally to a Backblaze B2 cloud storage bucket. + + +## Installation + +To use this program, you'll need to run the following: + +``` +wget https://rusql.pixelatedstudios.net/installers/rusql/db-backup.sh && bash ./db-backup.sh +``` + + +## Configuration + +When you run the program for the first time, it will prompt you for configuration details. These include the following: + +- MySQL host, username, and password +- Backup directory (optional, defaults to the current directory) +- Backblaze B2 credentials (optional, enables cloud storage backups) + +(make sure you also run `b2 authorize-account` to authorize the B2 CLI Tool) + + +## Usage + +To run the program, simply execute the `starter.rb` file using the following command from inside the cloned directory: + +``` +ruby starter.rb +``` + +You can also run this program via Cron. For example, this Crontab would run the program every 6 hours: + +``` +0 */6 * * * /path/to/starter.rb +``` + + +This will perform a backup of the MySQL database according to the configuration settings. If Backblaze B2 backups are enabled, the program will upload the backup file to the cloud storage bucket. + + +## Maintenance + +To update the program, simply pull the latest changes from the Git repository and re-run `bundle install` to ensure that any new gems are installed. + +If you need to change the configuration settings, simply delete the `config.json` file and run the program again to be prompted for new configuration details. + +To delete old backups, the program will check for backups that are older than 48 hours and delete them. To modify this time window, edit the `max_age_hours` variable in the `delete_old_backups` method of the `MysqlDatabaseBackup` class. + + +## Compatibility + +This program is compatible with Debian and RHEL based systems, but could be made to work with any systems compatible with Ruby, Python3, and Bash. + + +## Backblaze B2 + +Optionally, this program can update (and maintain) your Backblaze B2 bucket. It does this by removing the previous backup from the B2 bucket when it uploads a new one.