Backup Integrity Drift Watch
Backup Integrity Drift Watch checks your backup files every day for missing, late, undersized, changed and corrupt copies, and alerts you the moment a result changes — so a restore emergency never discovers a broken backup first.
It is self-hosted on purpose: it reads your backup folder read-only and stores only metadata, hashes and findings on your own server. Backup contents are never uploaded to a monitoring service.
Install in 2 minutes
./setup.sh
It checks Docker, asks a few questions (Enter = default), starts the app and prints its URL. Never used Docker? Open INSTALL_WITH_AI.md, paste the prompt into any AI chat and it will walk you through it. AI agents (Claude Code, Codex, Cursor...): follow AGENTS.md.
Already know Docker: point BDW_HOST_DIR at your backups in .env, then docker compose up -d — the included override mounts that folder read-only.
Open the Home page and you already see a real scan of the mounted folder (or a clear "no files found" message with the exact setting to change). Click Run check to see status pills for each backup. The same result is available from a shell with python -m app.main check --json or from GET /api/backups.
What it does
| Check | Flags a backup when |
|---|---|
| Missing | A file that had a baseline is no longer in the folder |
| Late | Its modification time is older than BDW_MAX_AGE_HOURS |
| Undersized | Its size is below BDW_MIN_SIZE_BYTES |
| Changed | Its SHA-256 or size differs from the baseline |
| Corrupt | Its zip, gzip/tar or database archive structure test fails |
| OK | It matches its baseline and passes all other checks |
| Established | The first clean check accepted it as the baseline |
Only file metadata is read: size, modification time, a streamed SHA-256 and a read-only archive structure probe (CRC test for .zip, streaming decompression for .gz, .tgz and .tar.gz, and a header/page sanity check for .sqlite, .sqlite3 and .db). Other file types are listed with an informational "no archive test" note. Unsupported extensions never fail a check. A file is never opened for writing, moved or deleted.
Checks run once on startup, then every 24 hours by default, and on every Run check click. Alerts go to your webhook only when a status changes — unchanged runs are silent. History older than 90 days is pruned automatically; the current snapshot is always kept.
Baselines
With BDW_BASELINE_MODE=auto (the default), the first clean check establishes a baseline of size and SHA-256 for each file. Change a file or remove it and the next check reports changed or missing. Use Refresh baselines on the Home page, or python -m app.main baseline, to accept the current folder as the new normal explicitly. BDW_BASELINE_MODE=manual waits for that explicit refresh before any baseline is stored.
What it sends out
- Webhook: file path, old and new status, and the short finding. No file contents, no
secrets.
- API:
GET /api/backupsreturns the current items and the last check run as JSON for
another tool to poll.
- AI (optional, off by default): Explain this finding turns structured fields into a
short plain-words plan. Exactly these fields are sent to your own AI provider: relative path, status, reason, size_bytes, age_hours, archive_test and matches_baseline. No raw file contents, host paths, passwords or API keys are sent. Answers are cached and no AI call is made by the background job. The fixes shown on the page work without AI. Connect a provider with ./setup.sh --ai api.
From a shell
| Command | What it does |
|---|---|
python -m app.main check | scan the watched folder now, with findings and fixes |
python -m app.main check --json | the same scan as JSON for automation |
python -m app.main baseline | accept the current files as the new baseline |
python -m app.main doctor | folder, archive, database and AI checks, with FIX hints |
python -m app.main prune --days 90 | delete old history manually |
python -m app.main --help | all commands and options |
Inside Docker, prefix these with docker compose exec app. The health endpoint is GET /healthz.
Options
| Want | How |
|---|---|
| Point it at your real backups | ./setup.sh --yes --set BDW_HOST_DIR=/absolute/backups --set BDW_GLOB='**/*' |
| Watch only certain files | BDW_GLOB, BDW_EXCLUDE_GLOB in .env |
| Tune freshness or size | BDW_MAX_AGE_HOURS, BDW_MIN_SIZE_BYTES in .env |
| Choose how baselines are accepted | BDW_BASELINE_MODE (auto or manual) in .env |
| Skip archive tests or limit hashing | BDW_ARCHIVE_TESTS, BDW_MAX_HASH_BYTES in .env |
| Change the rescan interval or history window | BDW_SCAN_SECONDS, BDW_RETENTION_DAYS in .env |
| Alerts to Slack/Discord/ntfy | ALERT_WEBHOOK_URL in .env |
| AI explanations with your own AI provider | ./setup.sh --ai api |
| PostgreSQL or MySQL instead of SQLite | Settings in the app, or ./setup.sh --postgres |
| Open it from other devices | ./setup.sh --bind 0.0.0.0 --password <pw> |
| Check everything is fine | ./setup.sh doctor |
Every setting has a comment and an example in the last section of .env.example.
Update, backup, remove
- Update: unzip the new version over this folder (your
.envand data are kept), then
docker compose up -d --build. Existing tables and data are preserved; new tables are created automatically. Your version is in the page footer; what changed is in CHANGELOG.md.
- Backup (SQLite):
docker compose cp app:/data ./backup-$(date +%F) - Stop:
docker compose down(data is kept). Remove everything:docker compose down -v
License
For use by the buyer's own organization, on as many of its servers as it likes. Modify it freely for your own use. Do not resell or redistribute the code or the package.