Add an inbuxa backup command for a single-machine install #62

Merged
jcoffey-dev merged 1 commits from feat/backup into main 2026-11-13 15:42:40 +00:00
Owner

Adds inbuxa backup for a single-machine install.## What it doesinbuxa backup [--yes] archives this machine's mail server — its configuration and its data — to <dir>/backups, whether the server runs in a container or on the host.- It stops the server for a consistent archive and starts it again. That is a brief outage (other servers retry their mail), so without --yes it only prints what it would do and stops.- The container path reuses the existing read-only volume archiver (archiveVolumes); the host path tars the server directory while the unit is stopped and restarts it whatever happens.- Every archive is verified as a readable, non-empty gzip tar before the command reports success.## What it refuses, and whyBackupKind, a pure classifier over state.State (unit-tested), decides whether there is anything here to back up:- clustered node — the real store is the cluster's PostgreSQL and S3, backed up there; a local archive would hold only configuration, so it refuses rather than write a misleading half-backup- front ends only (server on another machine) — backed up where it runs- no server here / server skipped / uninstalled — nothing to archive## ScopeRestore/rollback is deliberately left for later: restoring overwrites a live store, so it needs its own design and VM testing.## Checksgofmt clean; go vet and go build green on amd64 and arm64; go test ./... green (new TestBackupKind covers every branch). Smoke-tested on a machine with nothing installed (refuses cleanly, exit 1) and the usage/--help entry renders.

Adds `inbuxa backup` for a single-machine install.## What it does`inbuxa backup [--yes]` archives this machine's mail server — its configuration and its data — to `<dir>/backups`, whether the server runs in a container or on the host.- It stops the server for a consistent archive and starts it again. That is a brief outage (other servers retry their mail), so **without `--yes` it only prints what it would do and stops**.- The container path reuses the existing read-only volume archiver (`archiveVolumes`); the host path tars the server directory while the unit is stopped and restarts it whatever happens.- Every archive is verified as a readable, non-empty gzip tar before the command reports success.## What it refuses, and why`BackupKind`, a pure classifier over `state.State` (unit-tested), decides whether there is anything here to back up:- **clustered node** — the real store is the cluster's PostgreSQL and S3, backed up there; a local archive would hold only configuration, so it refuses rather than write a misleading half-backup- **front ends only** (server on another machine) — backed up where it runs- **no server here / server skipped / uninstalled** — nothing to archive## ScopeRestore/rollback is deliberately left for later: restoring overwrites a live store, so it needs its own design and VM testing.## Checks`gofmt` clean; `go vet` and `go build` green on amd64 and arm64; `go test ./...` green (new `TestBackupKind` covers every branch). Smoke-tested on a machine with nothing installed (refuses cleanly, exit 1) and the usage/`--help` entry renders.
jcoffey-dev added 1 commit 2026-11-13 15:40:36 +00:00
backup archives this machine's mail server -- its configuration and its
data -- to <dir>/backups, whether the server runs in a container or on
the host. It stops the server for a consistent archive and starts it
again, a brief outage, so without --yes it only says what it would do.

BackupKind, a pure classifier over the state, decides whether there is
anything here to back up and refuses on a clustered node, whose real
store lives in the cluster's PostgreSQL and S3 and is backed up there; a
local archive would hold only its configuration. The container path
reuses the existing read-only volume archiver; the host path tars the
server directory. Each archive is verified as a readable, non-empty
gzip tar before the command reports success.

Restoring from a backup is deliberately left for later: it overwrites a
live store, so it needs its own careful design and testing.
jcoffey-dev merged commit fcf06599d9 into main 2026-11-13 15:42:40 +00:00
jcoffey-dev deleted branch feat/backup 2026-11-13 15:42:40 +00:00
Sign in to join this conversation.