mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 15:51:26 +00:00
Phase D3. Managed databases can ship backup archives to a configured S3-compatible destination (AWS S3, MinIO, Garage, …) while the local copy remains intact. - backup_targets table: owner-scoped endpoint/bucket/region/prefix + encrypted access/secret keys (enc:v1:, never returned, has_credentials) - create/update probe bucket access before storing; empty keys on update keep stored credentials; delete refused (409) while referenced - databases.backup_target_id assigns a target; external DBs rejected - backup pipeline uploads via a holder container over docker cp streams; remote failure keeps the local archive (logged), row gets remote:true - restore prefers the local archive; on a missing local copy it downloads the remote object into the backup volume first - holder containers must be started before archive ops — docker cp does not resolve volume mounts on never-started (Created) containers, and removing the source mid-stream stalls the reader without EOF - CLI: backup-targets list|add|update|remove|test + databases update --backup-target; MCP: 5 new tools; Settings UI card + per-database target picker + offsite badge on backups; OpenAPI + llms.txt + CLI.md Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
35 lines
1021 B
SQL
35 lines
1021 B
SQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
CREATE TABLE IF NOT EXISTS backup_targets (
|
|
id VARCHAR(255) PRIMARY KEY,
|
|
user_id VARCHAR(255) NOT NULL,
|
|
name VARCHAR(255) NOT NULL,
|
|
endpoint VARCHAR(512) NOT NULL,
|
|
bucket VARCHAR(255) NOT NULL,
|
|
region VARCHAR(100) NOT NULL DEFAULT '',
|
|
prefix VARCHAR(255) NOT NULL DEFAULT '',
|
|
access_key TEXT NOT NULL DEFAULT '',
|
|
secret_key TEXT NOT NULL DEFAULT '',
|
|
use_tls BOOLEAN NOT NULL DEFAULT true,
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
|
);
|
|
|
|
ALTER TABLE database_services
|
|
ADD COLUMN IF NOT EXISTS backup_target_id VARCHAR(255);
|
|
|
|
ALTER TABLE database_backups
|
|
ADD COLUMN IF NOT EXISTS remote_key VARCHAR(512);
|
|
-- +goose StatementEnd
|
|
|
|
-- +goose Down
|
|
-- +goose StatementBegin
|
|
ALTER TABLE database_backups
|
|
DROP COLUMN IF EXISTS remote_key;
|
|
|
|
ALTER TABLE database_services
|
|
DROP COLUMN IF EXISTS backup_target_id;
|
|
|
|
DROP TABLE IF EXISTS backup_targets;
|
|
-- +goose StatementEnd
|