This repository has been archived by the owner on Apr 27, 2024. It is now read-only.
Update MySQL Database Backup Script for Improved Functionality and Cleanup #58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request updates the existing MySQL database backup script to enhance its functionality and introduce file cleanup capabilities. The changes aim to make the backup process more efficient and organized.
Key Changes:
Backup Directory Structure: The script now creates a base directory (/tmp/full_database_backups/) for storing individual database backups. This change ensures a more organized approach to manage backups.
Cleanup Old Backups: The script introduces a new feature to cleanup old backups based on the MAX_FILES_TO_KEEP variable. If MAX_FILES_TO_KEEP is set to a positive value, the script will delete older backup files to maintain a specified number of recent backups.
Tarball Compression: Before uploading to the cloud provider, the script now compresses the individual database backups into a tarball (tar.gz). This reduces the size of backups and makes the upload process more efficient.
Encryption with age: If an AGE_PUBLIC_KEY is provided, the script will encrypt the tarball using age before uploading to the cloud provider. This adds an extra layer of security to the backups.
AWS S3 Endpoint Support: The script now supports custom AWS S3-compatible endpoints if AWS_S3_ENDPOINT is provided. This allows using alternative S3-compatible storage services.
How to Test:
Additional Notes:
Please update any environment-specific variables (e.g., GCP_GCLOUD_AUTH, TARGET_DATABASE_USER, etc.) according to your setup.
If you have any custom requirements or use cases not covered by this update, please provide feedback so that we can consider further improvements.
Why This Change is Beneficial:
The updated script improves the backup process by organizing backups in a separate directory, introducing tarball compression, and providing options for encryption and custom S3 endpoints. The addition of cleanup functionality also ensures that old backups do not clutter the storage space. Overall, these enhancements make the database backup process more efficient, secure, and maintainable.
Kindly review this pull request and let me know if any further modifications are required. I'm happy to address any feedback or suggestions you may have. Thank you!