feat(backend): Implement database backup and restore cron system (#738)#865
Open
Musab1258 wants to merge 1 commit into
Open
feat(backend): Implement database backup and restore cron system (#738)#865Musab1258 wants to merge 1 commit into
Musab1258 wants to merge 1 commit into
Conversation
- Added BullMQ queue (`backup.queue.ts`) for scheduling backups. - Created worker (`backup.worker.ts`) to handle pg_dump, gzip compression, S3 uploads, and retention cleanup. - Implemented restore logic (`backup.restore.ts`) to handle recovery from S3 or local storage. - Updated `env.config.ts` with backup configuration and secret masking. - Added 11 new environment variables to `.env.example` for S3, cron, and retention settings. - Integrated worker startup and graceful shutdown into `index.ts`. - Added AWS SDK dependencies (`@aws-sdk/client-s3`, `@aws-sdk/lib-storage`) to `package.json`. Closes StellarDevHub#738
|
@Musab1258 is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Musab1258 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR implements an MVP-critical database backup and restore cron system to safely preserve user progress and certificate records. It automates nightly backups using
pg_dump, compresses the output, and securely uploads the assets to AWS S3. It also includes automated retention cleanup and a script for restoring databases from S3 or local files.Closes #738
Changes Made
backup.queue.ts) and a robust worker (backup.worker.ts) to handle the extraction (pg_dump), compression (gzip), S3 uploading, and retention management.backup.restore.tsto seamlessly restore backups from S3 or local storage.env.config.ts(with secret masking for logs)..env.examplewith 11 new variables to support cron scheduling, S3 credentials, and retention policies.index.ts.@aws-sdk/client-s3and@aws-sdk/lib-storagetopackage.jsonfor multipart S3 uploads.Acceptance Criteria Met
Setup & Testing Instructions
To test this feature locally, you must provide AWS S3 credentials. Add the following variables to your
.envfile to enable backups: