PostgreSQL backup tool with Point-In-Time-Recovery and restore verification
TypeScript backupbackupsdatabasedatabase-backupdevopsdockergolangkubernetesmariadbmongodbmysqlpgpostgrespostgresqls3self-hostedsystem-administrationtoolsweb-ui
1. Latest restorable moment in the API
- 1.1 Split
ResolveRestoreSetincore/physical/chain_view/restore_set.gointo a private latest-reach resolution and the existing target checks, and addChainViewService.GetLatestRestorableAtreturning the reachable time or nil without a chain (design D1). Verify withjust test-package ./internal/features/backups/backups/core/physical/chain_view/...inbackend/. - 1.2 Add
latestRestorableAttoGetWalStreamStatisticsResponseand fill it inservices/physical_wal_stream_statistics.go, with controller tests for no gaps, a gap in the newest chain, an incremental backup completed after the gap, a full backup without WAL and no full backup. Verify withjust test-package ./internal/features/backups/backups/controllers/physical/...inbackend/. - 1.3 Describe the field in the endpoint's Swagger annotation and regenerate the docs with
swag init -d . -g cmd/main.go -o swaggerinbackend/. Verify thatgrep -c latestRestorableAt backend/swagger/swagger.yamlis above zero and thatjust lintinbackend/passes.
2. Frontend rules and strings
- 2.1 Add
latestRestorableAtto theWalStreamStatisticsmodel inentity/backups/physical/model, and add the new keys of design D8 to all six interface dictionaries. Verify withpnpm --dir frontend typecheckandpnpm --dir frontend test src/shared/i18n. - 2.2 Map
WAL_CHAIN_BROKENto no stage inREASON_STAGESand skip it ingetStageTones(design D7), with a test that a broken chain alone leaves every stage healthy. Verify withpnpm --dir frontend test src/features/backups/physical/monitoring/lib/pathStages.test.ts. - 2.3 Add the pure full backup action function of design D3, with tests for available on a broken chain, available on a missing slot, available on a healthy verdict without a completed full backup, hidden without manage permission, hidden without a reason, hidden for not streaming, hidden for collecting data, hidden while unconfirmed, hidden while a full backup is pending, requesting while the flag is set, and available again once the flag clears after a failed request. Verify with
pnpm --dir frontend test src/features/backups/physical/monitoring/lib. - 2.4 Extend
getVerdictBannerto compose the headline, the headline reason, the other reasons and the restore sentence (design D2), with tests for the healthy headline, a reason title as headline, broken reasons before needs-attention ones, all four restore sentence cases, a broken chain whose moment already reaches the newest archived segment getting the plain sentence, the restore sentence during collecting data without a full backup, a moment from today and from an earlier day, and the unconfirmed state keeping the last known moment. Verify withpnpm --dir frontend test src/features/backups/physical/monitoring/lib/verdictBanner.test.ts. - 2.5 Add
hasEnoughChartPoints,getChartTimeDomainandgetAmountAxisMaximumtochartRows.tsand removehasAnyChartValues(design D6), with tests for three and four points, data starting inside the period, data covering the whole period and the minimum top. Verify withpnpm --dir frontend test src/features/backups/physical/monitoring/lib/chartRows.test.ts. - 2.6 Add
getMonitoringFigures(design D4), with tests for the busy healthy case (15 seconds ago, 20 MB, 10 MB/s against 10 MB/s), null rates when no sample in the window holds a write value, and null for the collecting data and not streaming verdicts. Verify withpnpm --dir frontend test src/features/backups/physical/monitoring/lib/monitoringFigures.test.ts.
3. Frontend layout
- 3.1 Rebuild
VerdictBannerComponentaround the composed banner: headline, headline reason, compact other reasons, restore sentence and the full backup button wired tophysicalBackupsApi.triggerPhysicalBackup(database.id, 'full'), withWalStreamRefreshController.retry()after success and errors throughtranslateApiError. PassisCanManageDBsfromDatabaseComponentto the tab, and deleteMonitoringReasonsComponent. Verify withpnpm --dir frontend typecheckandpnpm --dir frontend test src/features/backups/physical/monitoring. - 3.2 Add the figures row from
getMonitoringFigures, rendering unknown values as "not measured", with the keeping-up sentence and its consequences as its caption (design D4), and drop the unknown sentence fromgetKeepingUpSentences. Verify withpnpm --dir frontend test src/features/backups/physical/monitoring/lib/monitoringFigures.test.ts src/features/backups/physical/monitoring/lib/keepingUpSentences.test.tsandpnpm --dir frontend typecheck. - 3.3 Show one main chart with the new time domain, amount axis minimum and empty state, and add the collapsed tips and technical details sections holding the notices, the path of changes, the two secondary charts and the raw values (design D5, D6). Put the arrow classes on wrapper elements (design D7). Verify with
pnpm --dir frontend typecheckandpnpm --dir frontend lint. - 3.4 Update
WalStreamMonitoringSections.test.tsxfor the healthy banner, the broken chain banner with its restore sentence and button, no button for a read-only user, the figures row with "not measured", the collapsed tips header with its count, the technical details body showing the path of changes, both secondary charts' titles and the raw values, the "not enough data" and "data since" chart captions, and each arrow icon inside a wrapper carrying its breakpoint class. Verify withpnpm --dir frontend test src/features/backups/physical/monitoring/ui. - 3.5 Remove the dictionary keys and helpers only the deleted blocks used from all six dictionaries and the slice, then run the frontend checks. Verify with
pnpm --dir frontend lint,pnpm --dir frontend typecheck,pnpm --dir frontend testandpnpm --dir frontend build.
4. Restore coverage and the broken chain verdict
- 4.1 Add
ChainViewService.GetRestoreCoveragewith the latest restorable moment, the merged restorable ranges and the gaps the latest restore cannot cross, and removeGetLatestRestorableAt(design D1). Cover it withchain_viewtests for no full backup, contiguous WAL, a gap without an incremental, a gap bridged by a completed incremental, an incremental before the gap, a failed, chain-broken or running incremental after the gap, two gaps with only the first bridged, an incremental stopping inside a missing segment, a segment still uploading and a newer full backup, each checking that the last range ends at the latest restorable moment. Verify withjust test-package ./internal/features/backups/backups/core/physical/chain_view/...inbackend/. - 4.2 Write the controller test for a bridged gap with a streamer and samples, and see it fail with
WAL_CHAIN_BROKENon the current code. Then pass the blocking gaps to the verdict, renameNewestChainGapstoRestoreBlockingGaps, and addrestorableRangesto the response and its Swagger description. Add controller tests for a gap after the newest incremental, a failed incremental after the gap and no full backup, and coverrestorableRangesin the response format check. Verify withjust test-package ./internal/features/backups/backups/controllers/physical/... ./internal/features/backups/backups/core/physical/wal_health/...andjust lintinbackend/.
5. Restore timeline, figure cards, chart and banner
- 5.1 Add
restorableRangesto theWalStreamStatisticsmodel and the test fixture, addgetRestoreTimelinewith tests for one range, a gap between two ranges, the minimum width of a short gap and the not saved yet tail, and renderRestoreTimelineComponentbetween the figures and the main chart (design D10). SimplifyisRestoreLimitedByBrokenChainto the reason alone (design D2). Verify withpnpm --dir frontend test src/features/backups/physical/monitoring/lib. - 5.2 Turn the figures into four cards with the chart's rate labels and colors, and remove
figures.speedandfigures.speedValue(design D4). Verify withpnpm --dir frontend typecheck. - 5.3 Add
getBinaryAxisTicksandgetMissingDataRangeswith tests, replacegetAmountAxisMaximum, and rebuild the chart header, legend, height, saved-to-storage band and missing data shading and caption (design D6). Verify withpnpm --dir frontend test src/features/backups/physical/monitoring/lib/chartRows.test.ts. - 5.4 Limit the banner's text width, move the measured label into the headline row, leave out the headline reason's "what to do" sentence while the full backup button shows, and rewrite the broken chain's "what happened" sentence in all six dictionaries (design D2, D11). Return null from the duration helpers for non-finite input and use the restore sentence without an age then, with tests (design D12). Verify with
pnpm --dir frontend test src/features/backups/physical/monitoring src/shared/i18n. - 5.5 Update
WalStreamMonitoringSections.test.tsxfor the four figure cards, the timeline's lost-stretch sentence, and the "what to do" sentence hidden next to the button and shown without it. Run the frontend checks, and check the tab in a browser at 1240, 1440 and 2560 px. Verify withpnpm --dir frontend lint,pnpm --dir frontend typecheck,pnpm --dir frontend testandpnpm --dir frontend build.
6. Current values every second and the pipeline
- 6.1 Remember the newest slot probe in
WalStreamSupervisor, addGetLiveState, keep each running supervisor onrunningStreamerwithPhysicalWalStreamSupervisor.GetLiveState(databaseID), and addGET /backups/physical/database/:id/wal-stream/livewith its Swagger description (design D13). Cover it with controller tests for a viewer reading a streamer's values, a database without a running streamer, a user without access and a logical database. Verify withjust test-package ./internal/features/backups/backups/controllers/physical/... ./internal/features/backups/backups/backuping/physical/...,just test-package -run Test_GetLiveState ./internal/features/backups/backups/usecases/physical/postgresql/andjust lintinbackend/. - 6.2 Add
WalStreamLiveControllerreading the current values every second while visible, with tests for the schedule, a hidden tab, a failed reading and stop, and overlay newer live values onto the statistics for the figures, the restore timeline and the path of changes (design D13). Verify withpnpm --dir frontend test src/features/backups/physical/monitoring/lib. - 6.3 Rebuild
ChangesPathComponentas the pipeline of design D14, return neutral fromgetStageTonesfor a stage without a reason, and update its static-markup test. Verify withpnpm --dir frontend lint,pnpm --dir frontend typecheck,pnpm --dir frontend testandpnpm --dir frontend build, and check it in a browser at 1240, 1440 and 2560 px.
7. Width, open sections and a consistent restore moment
- 7.1 Write the
Test_GetLiveStatecase for an archive progress point past the probed position and see it fail with an unknown amount, then report zero (design D13). Verify withjust test-package ./internal/features/backups/backups/usecases/physical/postgresql/ -run Test_GetLiveStateandjust lintinbackend/. - 7.2 Move the restore point and the end of the newest restorable range with the live save while the statistics' restore point equals their newest save, and name the newest restorable stretch's start in the restore sentence when an earlier stretch cannot be restored, with tests and the two new keys in all six dictionaries (design D2, D13). Verify with
pnpm --dir frontend test src/features/backups/physical/monitoring/lib src/shared/i18n. - 7.3 Cap the tab at
max-w-6xl, use fixed chart heights, a 64 KiB/s rate axis minimum andtext-xlvalues, lay out the path of changes by a container query, and show the technical details and the tips without aCollapse, removing the tips title from all six dictionaries (design D5, D6, D11). Update the static-markup tests and check the tab in a browser at 1240, 1440 and 2560 px. Verify withpnpm --dir frontend lint,pnpm --dir frontend typecheck,pnpm --dir frontend testandpnpm --dir frontend build. - 7.4 Rebuild
ChangesPathComponentas the flow strip of design D14: one frame, a subgrid row of icons, titles and lines with the rates on the lines, "nothing waiting" for an empty queue, limit sentences only above zero, and the averages caption; mark the two rate cards as 10-minute averages; addpath.nothingWaiting,path.ratesCaptionandfigures.averageHintand removepath.noAllowanceLimitin all six dictionaries. Update the static-markup tests and check the strip in a browser at 900, 1240 and 1440 px. Verify withpnpm --dir frontend lint,pnpm --dir frontend typecheck,pnpm --dir frontend testandpnpm --dir frontend build.
Change verification
just test-package ./internal/features/backups/backups/core/physical/chain_view/... ./internal/features/backups/backups/core/physical/wal_health/... ./internal/features/backups/backups/controllers/physical/...
just test-package ./internal/features/backups/backups/usecases/physical/postgresql/...
pnpm --dir frontend test src/features/backups/physical/monitoring src/shared/i18n