Documentation
¶
Overview ¶
Package backup creates and restores a complete snapshot of a Docker Commander installation: the SQLite database plus the on-disk project and template files.
Everything the app needs lives under the data dir, and — importantly — that includes BOTH secrets keys (the JWT signing secret and the at-rest encryption key are rows in the database itself). That makes a backup self-contained: it can be restored onto a fresh machine and simply works.
It also means the archive is, in practice, equivalent to the plaintext of every stored secret — host TLS keys, the SMTP and LDAP passwords, registry credentials — because the key sits next to the ciphertext. So the archive is written 0600, and a passphrase can be supplied to encrypt it (AES-256-GCM with an Argon2id-derived key). Without one, Create still works but the caller is expected to warn.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotABackup = errors.New("backup: not a Docker Commander backup archive")
ErrNotABackup is returned when the file isn't a Docker Commander backup.
var ErrPassphraseRequired = errors.New("backup: this archive is encrypted; a passphrase is required")
ErrPassphraseRequired is returned when restoring an encrypted archive without one (or with the wrong one — the two are indistinguishable by design).
Functions ¶
Types ¶
type Report ¶
type Report struct {
// Bytes is the uncompressed size of everything that went in, so an
// unexpectedly large data dir is visible rather than discovered later.
Bytes int64
// SkippedLinks are paths inside the data dir that are symbolic links. Their
// CONTENTS are not in the backup, and never were — filepath.Walk does not
// follow links, so the old code stored the link and silently left the data
// behind. Now they are skipped outright and named here, because a backup that
// quietly omits a directory is worse than one that refuses to.
SkippedLinks []string
}
Report describes what a backup did and, more importantly, what it left out.
func Create ¶
func Create(dataDir, out string, db SQLiteBackuper, passphrase string) (*Report, error)
Create writes a backup of dataDir to out. When passphrase is non-empty the payload is encrypted. db may be nil, in which case the database file is copied as-is — only safe when the app is not running.
type SQLiteBackuper ¶
SQLiteBackuper snapshots the live database. The store implements it with `VACUUM INTO`, which is the only safe way to copy a WAL-mode database that is in use: a plain file copy can miss committed data still in the -wal file, or catch a write in progress.