Skip to content

feat: database backup/restore automation and read replica routing (#8… - #889

Merged
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
Benalex8797:feature/880-881-backup-restore-read-replica-routing
Sep 23, 2026
Merged

Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
Benalex8797:feature/880-881-backup-restore-read-replica-routing

Conversation

@Benalex8797

Copy link
Copy Markdown
Contributor

closes #880
closes #881
closes #882
closes #883

#880 — Database backup and restore automation

  • Add BackupAutomationService with full/incremental pg_dump, SHA-256 checksum verification, S3 upload (AWS SDK + local-copy fallback), dry-run restore, PITR lookup, and retention cleanup
  • Add three scheduled tasks: daily full backup (02:00 UTC), 6-hour incremental backup, weekly retention cleanup
  • Extend backup router with new endpoints: POST /backup/trigger, GET /backup/restore-points, GET /backup/restore-points/:id, POST /backup/restore/:id, POST /backup/restore/:id/dry-run, GET /backup/pitr, GET /backup/pitr/at, GET /backup/records
  • Update .env.example with all BACKUP_* and S3_* env vars
  • Add BackupAutomationService unit tests (dryRunMode, full/incremental, restore, dry-run restore, PITR, retention, job handlers)

#881 — Read replica routing

  • Extend ReadReplicaRouter with background health checks, lag-aware failover cooldown, session stickiness, disableReplica/enableReplica
  • Add PrismaReplicaClient: transparent Proxy routes Prisma read ops (findUnique, findFirst, findMany, count, aggregate, groupBy) to healthy replicas with automatic primary fallback on error
  • Add monitoring endpoints: GET /database/replicas, POST /database/replicas/:url/disable, POST /database/replicas/:url/enable
  • Mount databaseRouter in index.ts; start/stop health checks on server lifecycle
  • Add 51 tests (all passing), pre-existing 4-test suite unaffected

What this PR does

Changes

  • List of notable files and modules touched (monorepo wiring, Sentry integration, dashboards, etc.)
  • Notes about the Turborepo configuration, shared packages, and ESLint/TS config

Why

  • Rationale for the changes and how they solve the Acceptance Criteria

How to test

  • Steps to reproduce locally, including commands to run build/test
  • Any environment variables needed (e.g., SENTRY_DSN)
  • How to verify the dashboards/alerts configuration (stubs or real)

…artdevs17#880, Smartdevs17#881)

Smartdevs17#880 — Database backup and restore automation
- Add BackupAutomationService with full/incremental pg_dump, SHA-256
  checksum verification, S3 upload (AWS SDK + local-copy fallback),
  dry-run restore, PITR lookup, and retention cleanup
- Add three scheduled tasks: daily full backup (02:00 UTC), 6-hour
  incremental backup, weekly retention cleanup
- Extend backup router with new endpoints: POST /backup/trigger,
  GET /backup/restore-points, GET /backup/restore-points/:id,
  POST /backup/restore/:id, POST /backup/restore/:id/dry-run,
  GET /backup/pitr, GET /backup/pitr/at, GET /backup/records
- Update .env.example with all BACKUP_* and S3_* env vars
- Add BackupAutomationService unit tests (dryRunMode, full/incremental,
  restore, dry-run restore, PITR, retention, job handlers)

Smartdevs17#881 — Read replica routing
- Extend ReadReplicaRouter with background health checks, lag-aware
  failover cooldown, session stickiness, disableReplica/enableReplica
- Add PrismaReplicaClient: transparent Proxy routes Prisma read ops
  (findUnique, findFirst, findMany, count, aggregate, groupBy) to
  healthy replicas with automatic primary fallback on error
- Add monitoring endpoints: GET /database/replicas,
  POST /database/replicas/:url/disable,
  POST /database/replicas/:url/enable
- Mount databaseRouter in index.ts; start/stop health checks on
  server lifecycle
- Add 51 tests (all passing), pre-existing 4-test suite unaffected
@vercel

vercel Bot commented Sep 23, 2026

Copy link
Copy Markdown

@Benalex8797 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Sep 23, 2026

Copy link
Copy Markdown

@Benalex8797 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! 🚀

Learn more about application limits

@Smartdevs17
Smartdevs17 merged commit d2899c2 into Smartdevs17:main Sep 23, 2026
2 of 3 checks passed
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.

Build schema drift detection Add database migration versioning Implement read replica routing Build database backup and restore automation

2 participants