Skip to content

feat: automate nightly database backups - #124

Open
emirykl wants to merge 1 commit into
Hamplard-Hub:mainfrom
emirykl:drips/issue-58-backend-create-database-backup-automation-servic
Open

feat: automate nightly database backups#124
emirykl wants to merge 1 commit into
Hamplard-Hub:mainfrom
emirykl:drips/issue-58-backend-create-database-backup-automation-servic

Conversation

@emirykl

@emirykl emirykl commented Jul 30, 2026

Copy link
Copy Markdown

Summary

  • add an opt-in nightly PostgreSQL backup service scheduled for 02:00 UTC
  • validate custom-format dumps with pg_restore and upload them to S3-compatible storage with SHA-256 checksums
  • track backup size, dump duration, total duration, object key, and run outcome in structured logs
  • rotate expired backup objects using configurable retention and paginated S3 listing
  • prevent overlapping runs and clean up temporary dump files
  • document placeholder backup configuration and add focused service tests

Test evidence

  • npm test -- --runInBand --no-watchman src/modules/backups/db-backup.service.spec.ts — passed, 4 tests
  • focused TypeScript no-emit compilation — passed
  • Prettier check — passed
  • git diff --check — passed
  • broad Jest run: the backup suite passed; 12 existing suites could not compile because the generated Prisma client is absent
  • full build encountered the same missing Prisma client; generation requires access to a sandbox-denied user cache
  • ESLint could not run because the repository contains no ESLint configuration

Fixes #58

Verification

  • PASS: focused Jest suite (4 tests)
  • PASS: focused TypeScript no-emit compilation
  • PASS: Prettier check
  • PASS: git diff --check
  • Broad Jest: backup suite passed; 12 existing suites failed because the Prisma client is not generated
  • Build: could not complete because Prisma generation requires writing to a sandbox-denied user cache
  • Lint: repository has no ESLint configuration

Diagnostics

Recovered command failures: /bin/zsh -lc 'npm run build && npx eslint "src/modules/backups/**/*.ts" src/app.module.ts' (1), /bin/zsh -lc 'npx prisma generate && npm run build && npx eslint "src/modules/backups/**/*.ts" src/app.module.ts' (1), /bin/zsh -lc 'mkdir -p /tmp/hamplard-prisma-cache && XDG_CACHE_HOME=/tmp/hamplard-prisma-cache npx prisma generate && npm run build && npx eslint "src/modules/backups/**/*.ts" src/app.module.ts' (1), /bin/zsh -lc 'mkdir -p /tmp/hamplard-prisma-cache && CACHE_DIR=/tmp/hamplard-prisma-cache npx prisma generate && npm run build && npx eslint "src/modules/backups/**/*.ts" src/app.module.ts' (1), /bin/zsh -lc 'npm test -- --runInBand --no-watchman' (1)

@SYLVIANNORUKA

Copy link
Copy Markdown
Contributor

@emirykl Pls resolve conflict

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.

[Backend] Create database backup automation service

2 participants