SQL Backups Made Easy
Go to file
2023-07-27 19:47:37 -06:00
.bundle Apply RuboCop auto-correct 2023-07-28 01:43:49 +00:00
.github/workflows Merge pull request #3 from PixelRidge-Softworks/development 2023-07-27 19:47:37 -06:00
.gitignore Add .bundle dir for Github tests to work proper 2023-05-03 13:55:04 -06:00
Gemfile Apply RuboCop auto-correct 2023-07-28 01:43:49 +00:00
Gemfile.lock Bring bundle up to date with upstream depends 2023-07-27 16:17:44 -06:00
LICENSE Initial commit 2023-02-23 15:41:42 -07:00
loggman.rb Apply RuboCop auto-correct 2023-07-28 01:43:49 +00:00
mysql_database_backup.rb fix line too long, update gitignore 2023-03-19 17:45:01 -06:00
mysql_database_config.rb Apply RuboCop auto-correct 2023-07-28 01:43:49 +00:00
README.md Update README.md 2023-07-27 15:35:10 -06:00
starter.rb Refactored code to use a new Loggman class for 2023-03-19 17:10:48 -06:00

Ru(b2)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.

Please put any feature suggestions into Issues and we will implement them if we can!
If you'd like to help with the development of Ru(b2)SQL Backups, you can clone this repository and then create a Pull Request. If we don't find any issues, we will merge the PR.

Installation

To use this program, you'll need to run the following: (this is fixed now!)
Source

wget https://raw.githubusercontent.com/PixelRidge-Softworks/Installers/main/install.sh && bash ./install.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)

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 * * * /usr/bin/PixelatedStudios/Ruby/Ru-B2-SQL-Backups/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 local_retention_days days (default 30) and delete them. To modify this time window, edit the max_age_days variable in the delete_old_backups method of the MysqlDatabaseBackup class.

^^ This is no longer applicable, you can now set the retention time in the config.json

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.

This program was also built on Arch Linux, so it should also run fine on Manjaro, Arch, and any other Arch based distro.

Backblaze B2

Optionally, this program can update (and maintain) your Backblaze B2 bucket. It does this by removing the previous backups from the B2 bucket on a configurable timer