Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create database backup on server shutdown #3069

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

dudantas
Copy link
Member

@dudantas dudantas commented Nov 7, 2024

Description

This update introduces a refined automatic database backup feature during the server shutdown process. The main improvements include:

  1. Automatic Compression: The database backup is now always compressed using gzip, reducing disk space usage.

  2. Backup Management: The system organizes backup files into folders named by date and automatically deletes backups older than 7 days. This ensures that the backup storage remains manageable over time without manual intervention.

The motivation behind these changes is to create a more efficient and reliable way of managing database backups, ensuring data safety while optimizing storage space usage. The feature can be highly useful for production servers, as it creates backups during shutdown and maintains them efficiently by automatically removing old backups.

Behaviour

Actual

On server shutdown, no database backup was created automatically, potentially putting the data at risk of loss. There was no effective mechanism for managing old backup files.

Expected

On server shutdown, a backup of the entire database is automatically created, including all tables and data types, ensuring data is always safeguarded. Backups are always compressed, and backups older than 7 days are automatically deleted.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested

The database backup feature has been tested by:

  • Running the server multiple times to ensure that backups are correctly created on each shutdown.
  • Verifying the integrity of the SQL files by restoring the database from compressed backup files.
  • Confirming that backups older than 7 days are properly deleted.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@dudantas dudantas changed the title feat: create database backup feat: create database backup on server startup Nov 7, 2024
@dudantas dudantas force-pushed the dudantas/create-database-backup-on-server-startup branch from f23e8a5 to 95a9d3e Compare November 7, 2024 06:26
@dudantas dudantas force-pushed the dudantas/create-database-backup-on-server-startup branch from 5c988af to b453b80 Compare November 12, 2024 19:12
@dudantas dudantas force-pushed the dudantas/create-database-backup-on-server-startup branch from 8967797 to c677f2e Compare December 13, 2024 18:01
@dudantas dudantas changed the title feat: create database backup on server startup feat: create database backup on server shutdown Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants