This commit is contained in:
Mateusz Gruszczyński committed 2026-10-03 18:10:20 +02:00
1 parent 1297ea2920
commit dc0fcabf51
49 files changed
+2632 -252

No files matched your search

+9 -11
View File
@@ -1,9 +1,11 @@
#!/usr/bin/env python3
"""Create a private, consistent SQLite backup, including a live database in WAL mode.
This does not copy source code or accept arbitrary SQL. Restore instructions are in docs/MIGRATION.md.
"""Legacy SQLite snapshot helper retained for offline release tests.
Operator backups must use `rust-proxy backup create`, which includes the encrypted
Secret Store key material and all durable data. This script is not a supported
backup/restore interface after the Secret Store migration.
"""
from __future__ import annotations
import argparse
import hashlib
import json
import os
@@ -85,14 +87,10 @@ def backup(data_dir: Path, destination: Path) -> Path:
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--data-dir", type=Path, default=Path("data"))
parser.add_argument("destination", type=Path, help="new directory; existing destinations are never overwritten")
args = parser.parse_args()
try:
print(f"Private SQLite and certificate backup created: {backup(args.data_dir, args.destination)}")
except (OSError, ValueError, sqlite3.Error, RuntimeError) as error:
parser.exit(1, f"Backup failed: {error}\nA partially-created destination must be inspected before reuse.\n")
raise SystemExit(
"scripts/backup.py is retired for operator backups. "
"Use: rust-proxy --data-dir <data-dir> backup create --output <backup.rpb>"
)
if __name__ == "__main__":