Files
stalwart-migrator/cmd/stalwart-migrate/main.go
T
jcoffey-dev 5566eed1c8 Fix module path and restore cmd/ omitted by gitignore
Rename module github.com/johnellis/stalwart-migrator ->
github.com/LINUXexpert-org/stalwart-migrator to match the repository
location, so the module resolves under `go get`.

The initial commit's .gitignore listed the compiled binary as a bare
`stalwart-migrate` pattern, which Git matches at any depth -- so it also
excluded the cmd/stalwart-migrate/ source directory, and the initial
commit shipped without the CLI entrypoint. Anchor the pattern to the
repo root as /stalwart-migrate and add the four missing files.

go build, go vet, and go test ./... all pass.
2026-08-22 18:23:48 -07:00

54 lines
1.4 KiB
Go

// Command stalwart-migrate drives an in-place Stalwart Mail Server upgrade
// (0.15.5 -> latest) through preflight checks, a defense-in-depth backup,
// a checkpointed migration, and post-migration validation, with rollback
// available at every step. See ARCHITECTURE.md for the full design.
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) < 2 {
usage()
os.Exit(1)
}
var err error
switch os.Args[1] {
case "preflight":
err = runPreflight(os.Args[2:])
case "run":
err = runRun(os.Args[2:])
case "status":
err = runStatus(os.Args[2:])
case "rollback":
err = fmt.Errorf("not implemented yet: see internal/rollback")
case "confirm":
err = fmt.Errorf("not implemented yet: see internal/checkpoint")
case "report":
err = fmt.Errorf("not implemented yet: see internal/validate")
default:
usage()
os.Exit(1)
}
if err != nil {
fmt.Fprintln(os.Stderr, "stalwart-migrate:", err)
os.Exit(1)
}
}
func usage() {
fmt.Fprintln(os.Stderr, `usage: stalwart-migrate <command> [flags]
commands:
preflight run read-only checks and print the migration plan
run --dry-run: simulate and validate against a sandbox (real cutover isn't implemented yet)
status show the state of an in-progress or completed run
rollback restore the pre-migration backup for a given run
confirm close the rollback window for a completed run
report print the validation report for a run`)
}