mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 16:12:11 +00:00
Merge the release into the backup health work and read the real dump health
The readiness model now takes the database dump's state from getDatabaseBackupHealth, and the dump test reaches the off-host key id where it moved.
This commit is contained in:
commit
e88dcd2c53
99 files changed
+6106
-492
No files matched your search
@@ -48,6 +48,7 @@ function dump(
|
||||
return {
|
||||
enabled: true,
|
||||
directory: "/data/db-backups",
|
||||
keepNightly: 7,
|
||||
localDirWritable: true,
|
||||
offhostConfigured: false,
|
||||
lastGood: lastGoodAt
|
||||
|
||||
@@ -7,44 +7,22 @@
|
||||
* model, read through a provider so the model does not reach into the dump's
|
||||
* module and a test can hand in any state it wants.
|
||||
*
|
||||
* A provider that answers `null` means "this build does not schedule a dump",
|
||||
* which the model reports as not available rather than as healthy or broken.
|
||||
* A provider that answers `null` means "no dump is scheduled", which the model
|
||||
* reports as not available rather than as healthy or broken; the default
|
||||
* provider is the dump module's own health read.
|
||||
*/
|
||||
|
||||
/**
|
||||
* What the dump module reports about its own schedule. Mirrors
|
||||
* `DatabaseBackupHealth` in `src/lib/database-backup/health.ts` field for
|
||||
* field, so the provider below becomes that module's
|
||||
* `getDatabaseBackupHealth` without a translation.
|
||||
*/
|
||||
export interface DatabaseBackupHealth {
|
||||
/** `DB_BACKUP_ENABLED` is not off. */
|
||||
enabled: boolean;
|
||||
/** The directory dumps are kept in (`DB_BACKUP_DIR`). */
|
||||
directory: string;
|
||||
/** This process can write there. False means dumps only go off-host. */
|
||||
localDirWritable: boolean;
|
||||
/** The off-host bucket is configured, or a dump has been uploaded to it. */
|
||||
offhostConfigured: boolean;
|
||||
/** The newest dump that was kept on the server or reached the bucket. */
|
||||
lastGood: {
|
||||
at: string;
|
||||
fileName: string;
|
||||
sizeBytes: number | null;
|
||||
local: boolean;
|
||||
offhost: boolean;
|
||||
} | null;
|
||||
/** The newest run that failed, or that a dying process left unfinished. */
|
||||
lastFailure: { at: string; error: string } | null;
|
||||
}
|
||||
import {
|
||||
getDatabaseBackupHealth,
|
||||
type DatabaseBackupHealth,
|
||||
} from "@/lib/database-backup/health";
|
||||
|
||||
export type { DatabaseBackupHealth };
|
||||
|
||||
export type DatabaseBackupHealthProvider = (
|
||||
now?: Date,
|
||||
) => Promise<DatabaseBackupHealth | null>;
|
||||
|
||||
/**
|
||||
* The provider every caller uses unless it passes its own: the dump's health,
|
||||
* or `null` while no dump is scheduled by this build.
|
||||
*/
|
||||
export const readDatabaseBackupHealth: DatabaseBackupHealthProvider =
|
||||
async () => null;
|
||||
/** The provider every caller uses unless it passes its own. */
|
||||
export const readDatabaseBackupHealth: DatabaseBackupHealthProvider = (now) =>
|
||||
getDatabaseBackupHealth(now);
|
||||
Reference in new issue
Block a user