feat: add managed database capture and operator restore
PostgreSQL and MySQL backups run through paired outposts, with operator sign-in, off-site copies, and legacy import. Retention stays on each orbit, so the unused retention console is removed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
mod http;
|
||||
mod legacy_import;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
@@ -50,6 +51,13 @@ enum Commands {
|
||||
orbit: Option<String>,
|
||||
},
|
||||
List,
|
||||
/// Reconcile and import immutable legacy SQL archives from an S3 prefix.
|
||||
LegacyImport(legacy_import::ImportArgs),
|
||||
/// Export the private legacy operator-history SQLite archive.
|
||||
LegacyHistory {
|
||||
snapshot_id: Uuid,
|
||||
output: String,
|
||||
},
|
||||
Reconstitute {
|
||||
snapshot_id: Uuid,
|
||||
target: String,
|
||||
@@ -163,6 +171,25 @@ fn main() -> Result<()> {
|
||||
}
|
||||
Commands::Snap { orbit } => cmd_snap(&cli, orbit)?,
|
||||
Commands::List => cmd_list(&cli)?,
|
||||
Commands::LegacyImport(args) => {
|
||||
let vault = Vault::open(vault_path(&cli.data_dir), require_passphrase(&cli)?)?;
|
||||
legacy_import::run(&vault, args)?;
|
||||
}
|
||||
Commands::LegacyHistory {
|
||||
snapshot_id,
|
||||
output,
|
||||
} => {
|
||||
let vault = Vault::open(vault_path(&cli.data_dir), require_passphrase(&cli)?)?;
|
||||
let snapshot = vault
|
||||
.get_snapshot(snapshot_id)?
|
||||
.context("legacy history archive not found")?;
|
||||
anyhow::ensure!(
|
||||
snapshot.manifest.provider == "legacy-history",
|
||||
"snapshot is not a legacy history archive"
|
||||
);
|
||||
vault.restore_snapshot(snapshot_id, std::path::Path::new(&output))?;
|
||||
println!("Exported legacy history {snapshot_id}");
|
||||
}
|
||||
Commands::Reconstitute {
|
||||
snapshot_id,
|
||||
target,
|
||||
@@ -257,8 +284,10 @@ fn cmd_orbit(
|
||||
serde_json::json!({ "connection_url": path.context("--path or connection url required")? })
|
||||
}
|
||||
"wormhole" => {
|
||||
anyhow::ensure!(path.is_none() && schedule.is_none() && !dry_run,
|
||||
"Wormhole paths and scheduling are set on the outpost");
|
||||
anyhow::ensure!(
|
||||
path.is_none() && schedule.is_none() && !dry_run,
|
||||
"Wormhole paths and scheduling are set on the outpost"
|
||||
);
|
||||
serde_json::json!({})
|
||||
}
|
||||
_ => anyhow::bail!("unknown provider"),
|
||||
|
||||
Reference in New Issue
Block a user