From c6930b12df7896bbab52222689a9e5bc39826c07 Mon Sep 17 00:00:00 2001 From: vvvomit Date: Tue, 27 Oct 2026 22:19:25 +0330 Subject: [PATCH] Maintenance from the playbook's docs: services, vacuum, upgrade, tags, uninstall just.md, playbook-tags.md, maintenance-postgres.md, maintenance-synapse.md and uninstalling.md describe runs interzone had no way to start. A new Maintenance screen (Manage's menu) has one tab each: - Services: start, stop or reinstall everything or one service group (start-all, stop-group, install-X,start-group); reinstalling everything is setup-all, which removes turned-off components that install-all leaves behind. - Vacuum with any of the five presets, Upgrade Postgres (the old data dir kept), Compress Synapse's state with its threshold. - Tags: any tags with key=value extra vars, as just run-tags. - Uninstall: the playbook's remove-all, after typing the domain. Manage lists each under its group and opens the tab, and its Database shell runs psql on the server in this terminal. Runs go through the new ActionTags (tags checked against a safe character set, vars as JSON) and ActionUninstall. Co-Authored-By: Claude Opus 5.5 --- README.md | 11 + internal/deploy/deploy.go | 17 ++ internal/deploy/tags.go | 97 ++++++++ internal/deploy/tags_test.go | 21 ++ internal/ui/app.go | 4 + internal/ui/layout_test.go | 1 + internal/ui/maintenance.go | 232 ++++++++++++++++++ internal/ui/maintenance_test.go | 75 ++++++ internal/ui/presets_test.go | 2 +- internal/ui/screens_deploy.go | 10 + internal/ui/screens_manage.go | 34 ++- internal/ui/sidebar.go | 1 + .../ui/testdata/layout/dashboard-120x36.txt | 16 +- .../ui/testdata/layout/dashboard-180x50.txt | 16 +- .../ui/testdata/layout/maintenance-120x36.txt | 36 +++ .../ui/testdata/layout/maintenance-46x40.txt | 40 +++ .../ui/testdata/layout/maintenance-48x20.txt | 20 ++ internal/ui/testdata/layout/manage-120x36.txt | 14 +- internal/ui/testdata/layout/manage-46x40.txt | 14 +- internal/ui/testdata/layout/manage-48x20.txt | 2 +- .../testdata/layout/manage-armed-120x36.txt | 12 +- .../ui/testdata/layout/manage-armed-46x40.txt | 14 +- .../ui/testdata/layout/manage-armed-48x20.txt | 2 +- internal/ui/testdata/layout/menu-120x36.txt | 14 +- internal/ui/testdata/layout/menu-46x40.txt | 8 +- internal/ui/testdata/layout/menu-48x20.txt | 2 +- internal/ui/testdata/layout/sheet-120x36.txt | 14 +- internal/ui/testdata/layout/tokens-120x36.txt | 10 +- internal/ui/testdata/layout/users-120x36.txt | 16 +- internal/ui/testdata/layout/users-180x50.txt | 16 +- .../testdata/layout/users-bridge-120x36.txt | 16 +- 31 files changed, 688 insertions(+), 99 deletions(-) create mode 100644 internal/deploy/tags.go create mode 100644 internal/deploy/tags_test.go create mode 100644 internal/ui/maintenance.go create mode 100644 internal/ui/maintenance_test.go create mode 100644 internal/ui/testdata/layout/maintenance-120x36.txt create mode 100644 internal/ui/testdata/layout/maintenance-46x40.txt create mode 100644 internal/ui/testdata/layout/maintenance-48x20.txt diff --git a/README.md b/README.md index d33264b..f2eac29 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,17 @@ or the [Telegram group](https://t.me/+6UwIu9F4gZQxNjM0). value the playbook's `group_vars` sets instead, and yours. The roles in your setup are listed first, and `/` searches every role at once. Changes are written into `vars.yml` and applied on the next update. + - **Maintenance:** the playbook's own maintenance, one tab each. + *Services* starts, stops or reinstalls every service or one group of + them (`start-all`, `stop-group`, `install-SERVICE`); reinstalling + everything runs `setup-all`, which also removes the components you've + turned off, where a normal update leaves them installed. *Vacuum* runs + one of the five Postgres `VACUUM` presets, *Upgrade* moves Postgres to + its newest major version (keeping the old data), *Compress* runs + rust-synapse-compress-state, *Tags* runs any playbook tags with extra + vars, and *Uninstall* runs the playbook's `remove-all` after you type + the domain. Manage's *Database shell* opens `psql` on the server right + in the terminal. - **Move to another server:** stops and disables the old server, streams `/matrix` to the new one through this computer, then installs there (following the playbook's migration guide). diff --git a/internal/deploy/deploy.go b/internal/deploy/deploy.go index fa60ea1..bb34f25 100644 --- a/internal/deploy/deploy.go +++ b/internal/deploy/deploy.go @@ -46,6 +46,8 @@ const ( StepFetchBackups StepStopOld StepCopyData + StepTags + StepUninstall ) var stepNames = map[Step]string{ @@ -70,6 +72,8 @@ var stepNames = map[Step]string{ StepFetchBackups: "Download the server's backups", StepStopOld: "Stop the old server", StepCopyData: "Copy /matrix to the new server", + StepTags: "Run the playbook", + StepUninstall: "Remove everything", } func (s Step) String() string { return stepNames[s] } @@ -93,6 +97,8 @@ const ( ActionSchedule ActionFetchBackups ActionMigrate + ActionTags // run Options.Tags (docs/playbook-tags.md) + ActionUninstall // the playbook's remove-all (docs/uninstalling.md) ) // Plan lists the steps an action runs, in order. @@ -124,6 +130,10 @@ func Plan(a Action) []Step { return []Step{StepAnsible, StepInventory, StepSchedule} case ActionFetchBackups: return []Step{StepAnsible, StepInventory, StepFetchBackups} + case ActionTags: + return []Step{StepAnsible, StepInventory, StepTags} + case ActionUninstall: + return []Step{StepAnsible, StepInventory, StepUninstall} case ActionMigrate: return []Step{StepAnsible, StepPlaybook, StepInventory, StepRoles, StepStopOld, StepCopyData, StepMirrors, StepInstall, StepSelfCheck} } @@ -174,6 +184,11 @@ type Options struct { // config; the caller switches its own Target when the Moved event comes. NewTarget config.Target Force bool // ActionSelfUpdate: reinstall even if up to date + // ActionTags: the playbook tags to run, comma-separated, their + // --extra-vars, and what the run does, for its title. + Tags string + Vars map[string]string + Title string } func dataDir() string { return config.DataDir() } @@ -288,6 +303,8 @@ func (r *Runner) run(ctx context.Context) error { StepFetchBackups: r.fetchBackups, StepStopOld: r.stopOld, StepCopyData: r.copyData, + StepTags: r.tags, + StepUninstall: r.uninstall, } plan := Plan(r.opts.Action) r.emit(Event{Plan: plan}) diff --git a/internal/deploy/tags.go b/internal/deploy/tags.go new file mode 100644 index 0000000..80d48d4 --- /dev/null +++ b/internal/deploy/tags.go @@ -0,0 +1,97 @@ +package deploy + +import ( + "context" + "encoding/json" + "fmt" + "os" + "os/exec" + "path/filepath" + "regexp" + "slices" + "strings" + + "interzone/internal/config" +) + +// tagsSafe are the characters playbook tags are made of. +var tagsSafe = regexp.MustCompile(`^[a-z0-9_,-]+$`) + +// tags runs playbook tags, as `just run-tags` does: maintenance from the +// playbook's docs (vacuum, Postgres upgrade, state compression), starting, +// stopping or reinstalling services, or any tags typed in. +func (r *Runner) tags(ctx context.Context) error { + t := strings.ReplaceAll(r.opts.Tags, " ", "") + if !tagsSafe.MatchString(t) { + return fmt.Errorf("%q aren't playbook tags (letters, digits, - and _, separated by commas)", r.opts.Tags) + } + args := []string{"--tags=" + t} + if len(r.opts.Vars) > 0 { + b, _ := json.Marshal(r.opts.Vars) + args = append(args, "--extra-vars", string(b)) + } + return r.playbookRun(ctx, StepTags, args...) +} + +const uninstallPlay = `- name: Remove everything the playbook installed + hosts: matrix_servers + become: true + gather_facts: false + tasks: + - name: Run remove-all + ansible.builtin.shell: printf '%s\n' 'Yes, I really want to remove everything!' | {{ matrix_base_data_path | default('/matrix') }}/bin/remove-all + args: + removes: "{{ matrix_base_data_path | default('/matrix') }}/bin/remove-all" +` + +// uninstall runs the remove-all script the playbook puts on the server +// (docs/uninstalling.md): every matrix-* service, the Docker images and +// /matrix go. Docker itself stays. +func (r *Runner) uninstall(ctx context.Context) error { + r.begin(StepUninstall) + play := filepath.Join(r.cfg.PlaybookDir, "inventory", "interzone-uninstall.yml") + if err := os.WriteFile(play, []byte(uninstallPlay), 0o644); err != nil { + return err + } + return r.exec(ctx, StepUninstall, r.cfg.PlaybookDir, "ansible-playbook", "-i", "inventory/hosts", play) +} + +// ServiceGroups are the service groups the playbook can start, stop or +// install on their own (`just start-group GROUP`), read from its +// group_vars, sorted, without the "matrix" group every service is in. +func ServiceGroups(playbookDir string) []string { + b, _ := os.ReadFile(filepath.Join(playbookDir, "group_vars", "matrix_servers")) + var out []string + for _, m := range regexp.MustCompile(`'groups':\s*\[([^\]]*)\]`).FindAllStringSubmatch(string(b), -1) { + for _, g := range strings.Split(m[1], ",") { + g = strings.TrimSpace(g) + if !strings.HasPrefix(g, "'") { // an expression, not a name + continue + } + g = strings.Trim(g, "'") + if g != "" && g != "matrix" && tagsSafe.MatchString(g) && !slices.Contains(out, g) { + out = append(out, g) + } + } + } + slices.Sort(out) + return out +} + +// DatabaseShell is psql on the bundled Postgres, through the playbook's +// /matrix/postgres/bin/cli (docs/maintenance-postgres.md), for running in +// this terminal. +func DatabaseShell(c *config.Config) *exec.Cmd { + const cli = "/matrix/postgres/bin/cli" + if c.Target.Mode != "ssh" { + if os.Geteuid() == 0 { + return exec.Command(cli) + } + return exec.Command("sudo", cli) + } + run := "sudo " + cli + if c.Target.User == "root" { + run = cli + } + return exec.Command("ssh", append(append([]string{"-t"}, sshArgs(c.Target)...), run)...) +} diff --git a/internal/deploy/tags_test.go b/internal/deploy/tags_test.go new file mode 100644 index 0000000..599ffdb --- /dev/null +++ b/internal/deploy/tags_test.go @@ -0,0 +1,21 @@ +package deploy + +import ( + "os" + "path/filepath" + "slices" + "testing" +) + +func TestServiceGroups(t *testing.T) { + pb := t.TempDir() + os.MkdirAll(filepath.Join(pb, "group_vars"), 0o755) + os.WriteFile(filepath.Join(pb, "group_vars", "matrix_servers"), []byte(` + 'groups': ['matrix', 'postgres'], + 'groups': ['matrix', 'bridges', 'mautrix-slack'], + 'groups': ['matrix', 'homeservers', matrix_homeserver_implementation], +`), 0o644) + if got, want := ServiceGroups(pb), []string{"bridges", "homeservers", "mautrix-slack", "postgres"}; !slices.Equal(got, want) { + t.Errorf("ServiceGroups = %v, want %v", got, want) + } +} diff --git a/internal/ui/app.go b/internal/ui/app.go index 891c1d2..5f30115 100644 --- a/internal/ui/app.go +++ b/internal/ui/app.go @@ -83,6 +83,7 @@ func New(cfg *config.Config, loaded bool) *App { newManageScreen(), // not a wizard step: reached from Welcome // Reached from Manage: newTuningScreen(), + newMaintenanceScreen(), newUpdatesScreen(), newHistoryScreen(), newRestoreScreen(), @@ -181,6 +182,9 @@ func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return a, a.onHealth(m) case gotoMsg: return a, a.jump(a.index(string(m))) + case maintainMsg: + a.screens[a.index("Maintenance")].(*maintenanceScreen).open(string(m)) + return a, a.jump(a.index("Maintenance")) case noteMsg: a.status = sGood.Render(string(m)) return a, nil diff --git a/internal/ui/layout_test.go b/internal/ui/layout_test.go index 57f60ee..b617639 100644 --- a/internal/ui/layout_test.go +++ b/internal/ui/layout_test.go @@ -98,6 +98,7 @@ func TestLayout(t *testing.T) { {"mirrors", openMirrors}, {"users", openUsers}, {"tokens", openTokens}, + {"maintenance", func(a *App) { deliver(a, maintainMsg("vacuum")) }}, {"users-bridge", func(a *App) { openUsers(a) us := a.cur().(*usersScreen) diff --git a/internal/ui/maintenance.go b/internal/ui/maintenance.go new file mode 100644 index 0000000..4863965 --- /dev/null +++ b/internal/ui/maintenance.go @@ -0,0 +1,232 @@ +package ui + +import ( + "slices" + "strconv" + "strings" + + tea "github.com/charmbracelet/bubbletea" + + "interzone/internal/config" + "interzone/internal/deploy" +) + +// ── Maintenance ──────────────────────────────────────────────────── +// +// The playbook's own maintenance, one tab each: starting, stopping and +// reinstalling services (docs/just.md, docs/playbook-tags.md), Postgres +// vacuum and upgrade (docs/maintenance-postgres.md), Synapse state +// compression (docs/maintenance-synapse.md), any playbook tags, and +// uninstalling (docs/uninstalling.md). The Postgres shell from the same doc +// needs no settings, so Manage opens it directly. + +type maintTask struct{ id, label, help string } + +var maintTasks = []maintTask{ + {"services", "Services", "Start, stop or reinstall every service or one group of them. Reinstalling everything also removes the components you've turned off (setup-all), which a normal update leaves in place."}, + {"vacuum", "Vacuum", "Give the disk space of deleted rows back (Postgres VACUUM). Do it after deleting a lot, e.g. after compressing Synapse's state."}, + {"pgupgrade", "Upgrade", "Move the database to the newest Postgres major version: it is dumped, a new empty server started and the dump restored. The old data directory is kept until you delete it."}, + {"compress", "Compress", "Shrink Synapse's _state tables with rust-synapse-compress-state; the most effective way to reduce the database of a server in large rooms. Safe while Synapse runs, but back up first."}, + {"tags", "Tags", "Run any of the playbook's tags, as `just run-tags` does: e.g. install-mautrix-slack,start-group or ensure-matrix-users-created."}, + {"uninstall", "Uninstall", "Remove everything the playbook installed: every Matrix service, the Docker images and /matrix with all its data. Leave federated rooms first. Re-running an update almost always fixes more than reinstalling does."}, +} + +var vacuumPresets = []string{"vacuum-complete", "vacuum-full", "vacuum", "vacuum-analyze", "analyze"} + +var vacuumLabels = []string{ + "Complete (FULL, ANALYZE; services stop)", "Full (services stop)", "Plain (services keep running)", + "Plain + ANALYZE (services keep running)", "ANALYZE only (fastest)", +} + +const pgUpgradeBackup = "/matrix/postgres/data-auto-upgrade-backup" + +// maintainMsg opens Maintenance on one task. +type maintainMsg string + +type maintenanceScreen struct { + cfg *config.Config + form *form + task string // the tab to open on + err string +} + +func newMaintenanceScreen() *maintenanceScreen { return &maintenanceScreen{task: "services"} } + +func (s *maintenanceScreen) tool() {} +func (s *maintenanceScreen) name() string { return "Maintenance" } +func (s *maintenanceScreen) title() string { return "Maintenance" } +func (s *maintenanceScreen) typing() bool { return s.form.typing() } +func (s *maintenanceScreen) leave(*config.Config) {} +func (s *maintenanceScreen) activeForm() *form { return s.form } +func (s *maintenanceScreen) keys() [][2]string { + return [][2]string{{"←→", "task"}, {"↑↓", "move"}, {"enter", "run"}} +} + +// available drops the tasks this server can't do. +func (s *maintenanceScreen) available() []maintTask { + ext := s.cfg.Components["external-postgres"] + return slices.DeleteFunc(slices.Clone(maintTasks), func(t maintTask) bool { + switch t.id { + case "vacuum", "pgupgrade": + return ext + case "compress": + return ext || s.cfg.Homeserver != "synapse" + } + return false + }) +} + +func (s *maintenanceScreen) enter(c *config.Config) tea.Cmd { + s.cfg, s.err = c, "" + var ids, labels []string + for _, t := range s.available() { + ids, labels = append(ids, t.id), append(labels, t.label) + } + if !slices.Contains(ids, s.task) { + s.task = ids[0] + } + f := newForm( + choiceField("task", "Task", ids, labels, s.task, ""), + textField("group", "Service group", "", "everything", + "Empty for every service, or one group: synapse, postgres, traefik, element, mautrix-telegram, bots, bridges…"), + choiceField("do", "Do", []string{"start", "stop", "reinstall"}, []string{"Start or restart", "Stop", "Reinstall"}, "start", ""), + choiceField("preset", "Kind of vacuum", vacuumPresets, vacuumLabels, vacuumPresets[0], + "The FULL kinds need about as much free disk space as the database takes, and stop every service while they run."), + textField("backup", "Keep the old data in", pgUpgradeBackup, pgUpgradeBackup, "Stays until you delete it."), + textField("min", "Compress rooms with more state groups than", "100000", "100000", ""), + textField("tags", "Tags", "", "install-mautrix-slack,start-group", "Comma-separated."), + textField("vars", "Extra vars", "", "group=mautrix-slack", "key=value pairs separated by spaces, passed as --extra-vars."), + textField("confirm", "Type "+c.Domain+" to confirm", "", c.Domain, ""), + ) + on := func(ids ...string) func() bool { + return func() bool { return !slices.Contains(ids, f.value("task")) } + } + f.get("group").hidden, f.get("do").hidden = on("services"), on("services") + f.get("preset").hidden = on("vacuum") + f.get("backup").hidden = on("pgupgrade") + f.get("min").hidden = on("compress") + f.get("tags").hidden, f.get("vars").hidden = on("tags"), on("tags") + f.get("confirm").hidden = on("uninstall") + s.form = f + s.explain() + return nil +} + +func (s *maintenanceScreen) explain() { + for _, t := range maintTasks { + if t.id == s.form.value("task") { + s.form.get("task").help = t.help + } + } +} + +// open shows task, from Manage's list; enter builds the form on it, or +// it switches the form already open. +func (s *maintenanceScreen) open(task string) { + s.task, s.err = task, "" + if s.form == nil { + return + } + f := s.form.get("task") + if i := slices.Index(f.choices, task); i >= 0 { + f.choice = i + s.explain() + } +} + +func (s *maintenanceScreen) update(msg tea.Msg) tea.Cmd { + if _, ok := msg.(formDoneMsg); ok { + return s.run() + } + cmd := s.form.Update(msg) + s.task = s.form.value("task") + s.explain() + if _, ok := msg.(tea.KeyMsg); ok { + s.err = "" + } + return cmd +} + +// options turns the form into the run it asks for. +func (s *maintenanceScreen) options() (deploy.Options, string) { + f := s.form + o := deploy.Options{Action: deploy.ActionTags} + switch f.value("task") { + case "services": + g, do := strings.TrimSpace(f.value("group")), f.value("do") + if g == "" || g == "everything" { + o.Tags = map[string]string{"start": "start-all", "stop": "stop-all", "reinstall": "setup-all,ensure-matrix-users-created,start"}[do] + o.Title = map[string]string{"start": "Restart every service", "stop": "Stop every service", "reinstall": "Reinstall everything"}[do] + return o, "" + } + if known := deploy.ServiceGroups(s.cfg.PlaybookDir); len(known) > 0 && !slices.Contains(known, g) { + return o, "The playbook has no service group " + strconv.Quote(g) + "." + } + o.Vars = map[string]string{"group": g} + o.Tags = map[string]string{"start": "start-group", "stop": "stop-group", "reinstall": "install-" + g + ",start-group"}[do] + o.Title = map[string]string{"start": "Restart ", "stop": "Stop ", "reinstall": "Reinstall "}[do] + g + case "vacuum": + o.Tags, o.Title = "run-postgres-vacuum", "Vacuum the database" + o.Vars = map[string]string{"postgres_vacuum_preset": f.value("preset")} + case "pgupgrade": + o.Tags, o.Title = "upgrade-postgres", "Upgrade Postgres" + o.Vars = map[string]string{"postgres_auto_upgrade_backup_data_path": f.value("backup")} + case "compress": + n, err := strconv.Atoi(f.value("min")) + if err != nil || n < 1 { + return o, "The number of state groups must be a whole number." + } + o.Tags, o.Title = "rust-synapse-compress-state", "Compress Synapse's state" + o.Vars = map[string]string{"matrix_synapse_rust_synapse_compress_state_min_state_groups_required": strconv.Itoa(n)} + case "tags": + o.Tags, o.Title = f.value("tags"), "Run "+f.value("tags") + if o.Tags == "" { + return o, "Enter the tags to run." + } + for _, kv := range strings.Fields(f.value("vars")) { + k, v, ok := strings.Cut(kv, "=") + if !ok || k == "" { + return o, strconv.Quote(kv) + " isn't key=value." + } + if o.Vars == nil { + o.Vars = map[string]string{} + } + o.Vars[k] = v + } + case "uninstall": + if f.value("confirm") != s.cfg.Domain { + return o, "Type " + s.cfg.Domain + " to confirm." + } + o.Action = deploy.ActionUninstall + } + return o, "" +} + +// databaseShell runs psql on the server in this terminal, the TUI paused. +func databaseShell(c *config.Config) tea.Cmd { + return tea.ExecProcess(deploy.DatabaseShell(c), func(err error) tea.Msg { + if err != nil { + return noteMsg("The database shell ended: " + err.Error()) + } + return nil + }) +} + +func (s *maintenanceScreen) run() tea.Cmd { + o, problem := s.options() + if s.err = problem; problem != "" { + return nil + } + if o.Action == deploy.ActionUninstall { + s.form.get("confirm").input.SetValue("") + } + return run(o) +} + +func (s *maintenanceScreen) view(w, h int) string { + out := s.form.View(w, h-2) + if s.err != "" { + out += "\n\n" + sBad.Render("✗ "+s.err) + } + return out +} diff --git a/internal/ui/maintenance_test.go b/internal/ui/maintenance_test.go new file mode 100644 index 0000000..c135758 --- /dev/null +++ b/internal/ui/maintenance_test.go @@ -0,0 +1,75 @@ +package ui + +import ( + "maps" + "testing" + + "interzone/internal/deploy" +) + +// Manage opens Maintenance on the chosen task, and each task asks for the +// playbook run its doc describes. +func TestMaintenance(t *testing.T) { + a := demoApp(t, 120, 36) + a.jump(a.index("Manage")) + press(a, runes("x")) // Run playbook tags + s, ok := a.cur().(*maintenanceScreen) + if !ok || s.form.value("task") != "tags" { + t.Fatalf("on %s", a.cur().name()) + } + + set := func(task string, values map[string]string) { + deliver(a, maintainMsg(task)) + for k, v := range values { + if k == "do" || k == "preset" { + f := s.form.get(k) + for i, c := range f.choices { + if c == v { + f.choice = i + } + } + continue + } + s.form.get(k).input.SetValue(v) + } + } + for _, tc := range []struct { + task string + values map[string]string + action deploy.Action + tags string + vars map[string]string + err bool + }{ + {"services", map[string]string{"do": "reinstall"}, deploy.ActionTags, "setup-all,ensure-matrix-users-created,start", nil, false}, + {"services", map[string]string{"group": "postgres", "do": "stop"}, deploy.ActionTags, "stop-group", map[string]string{"group": "postgres"}, false}, + {"services", map[string]string{"group": "mautrix-slack", "do": "reinstall"}, deploy.ActionTags, "install-mautrix-slack,start-group", map[string]string{"group": "mautrix-slack"}, false}, + {"vacuum", map[string]string{"preset": "analyze"}, deploy.ActionTags, "run-postgres-vacuum", map[string]string{"postgres_vacuum_preset": "analyze"}, false}, + {"pgupgrade", nil, deploy.ActionTags, "upgrade-postgres", map[string]string{"postgres_auto_upgrade_backup_data_path": pgUpgradeBackup}, false}, + {"compress", map[string]string{"min": "5000"}, deploy.ActionTags, "rust-synapse-compress-state", map[string]string{"matrix_synapse_rust_synapse_compress_state_min_state_groups_required": "5000"}, false}, + {"compress", map[string]string{"min": "lots"}, 0, "", nil, true}, + {"tags", map[string]string{"tags": "install-mautrix-slack,start-group", "vars": "group=mautrix-slack"}, deploy.ActionTags, "install-mautrix-slack,start-group", map[string]string{"group": "mautrix-slack"}, false}, + {"tags", map[string]string{"tags": "x", "vars": "oops"}, 0, "", nil, true}, + {"uninstall", map[string]string{"confirm": "wrong.org"}, 0, "", nil, true}, + {"uninstall", map[string]string{"confirm": a.cfg.Domain}, deploy.ActionUninstall, "", nil, false}, + } { + set(tc.task, tc.values) + o, problem := s.options() + if tc.err { + if problem == "" { + t.Errorf("%s %v: no problem reported", tc.task, tc.values) + } + continue + } + if problem != "" || o.Action != tc.action || o.Tags != tc.tags || !maps.Equal(o.Vars, tc.vars) { + t.Errorf("%s %v: got %v %q %v (%s)", tc.task, tc.values, o.Action, o.Tags, o.Vars, problem) + } + } + + // Enter with a problem stays on the screen and says so. + set("uninstall", map[string]string{"confirm": "nope"}) + deliver(a, formDoneMsg{}) + if a.cur() != s || s.err == "" { + t.Errorf("an unconfirmed uninstall ran") + } +} diff --git a/internal/ui/presets_test.go b/internal/ui/presets_test.go index 442667b..49873bb 100644 --- a/internal/ui/presets_test.go +++ b/internal/ui/presets_test.go @@ -38,7 +38,7 @@ func flatten(cmd tea.Cmd) []tea.Msg { out = append(out, flatten(c)...) } return out - case noteMsg, navMsg, formDoneMsg, gotoMsg: + case noteMsg, navMsg, formDoneMsg, gotoMsg, maintainMsg: return []tea.Msg{m} } return nil diff --git a/internal/ui/screens_deploy.go b/internal/ui/screens_deploy.go index a7096b2..229dfcc 100644 --- a/internal/ui/screens_deploy.go +++ b/internal/ui/screens_deploy.go @@ -497,11 +497,15 @@ var actionTitles = map[deploy.Action][3]string{ // running, done, failed deploy.ActionSchedule: {"Setting up scheduled backups…", "Scheduled backups set", "Couldn't set up scheduled backups"}, deploy.ActionFetchBackups: {"Downloading backups…", "Backups downloaded", "Couldn't download the backups"}, deploy.ActionMigrate: {"Moving the server…", "Moved to the new server ✨", "The move stopped"}, + deploy.ActionUninstall: {"Removing everything…", "Everything was removed", "The removal stopped"}, } func (s *deployScreen) name() string { return "Deploy" } func (s *deployScreen) title() string { t := actionTitles[s.opts.Action] + if s.opts.Action == deploy.ActionTags { + t = [3]string{s.opts.Title + "…", s.opts.Title + ": done", s.opts.Title + ": stopped"} + } switch { case s.running: return t[0] @@ -897,6 +901,12 @@ func (s *deployScreen) resultView(w int) string { sMuted.Render(fmt.Sprintf("%d backup(s) of %s on this computer now.", n, c.Domain))) case deploy.ActionLogs: return "" + case deploy.ActionTags: + return panel(cMint, sGood.Render("✓ Done in "+s.elapsed.Round(time.Second).String()+"."), + sMuted.Render("The full output is above and in ")+s.logPath()) + case deploy.ActionUninstall: + return panel(cMint, sGood.Render("✓ The Matrix services, their images and /matrix are gone from the server."), + sMuted.Render("Docker and the matrix-* Docker networks stay. interzone keeps your answers: Manage › Update the server installs it all again.")) } scheme := "https://" diff --git a/internal/ui/screens_manage.go b/internal/ui/screens_manage.go index 7dfa040..86a56f6 100644 --- a/internal/ui/screens_manage.go +++ b/internal/ui/screens_manage.go @@ -50,11 +50,11 @@ type manageAction struct { var manageGroups = []string{"Keep it running", "People", "Data", "Look closer", "Change things"} var actionGroup = map[string]int{ - "update": 0, "check": 0, "restart": 0, "changes": 0, "images": 0, "selfupdate": 0, + "update": 0, "check": 0, "restart": 0, "services": 0, "changes": 0, "images": 0, "selfupdate": 0, "user": 1, "registration": 1, "users": 1, "tokens": 1, - "backup": 2, "schedule": 2, "restore": 2, "rollback": 2, - "dashboard": 3, "logs": 3, "tuning": 3, - "setup": 4, "migrate": 4, "servers": 4, + "backup": 2, "schedule": 2, "restore": 2, "rollback": 2, "vacuum": 2, "pgupgrade": 2, "compress": 2, + "dashboard": 3, "logs": 3, "tuning": 3, "psql": 3, "tags": 3, + "setup": 4, "migrate": 4, "servers": 4, "uninstall": 4, } var actionIcons = map[string]string{ @@ -63,6 +63,7 @@ var actionIcons = map[string]string{ "backup": "⇩", "schedule": "◷", "restore": "↺", "rollback": "↶", "dashboard": "▦", "logs": "≡", "tuning": "✎", "setup": "◇", "migrate": "⇢", "servers": "▤", + "services": "⏻", "vacuum": "⌫", "pgupgrade": "⇡", "compress": "⇲", "psql": "$", "tags": "#", "uninstall": "✗", } // runsAtOnce are the Manage actions that start changing the server as @@ -74,7 +75,8 @@ var runsAtOnce = map[string]bool{"update": true, "check": true, "restart": true, // ones need it pressed twice. var hotkeys = map[string]string{"update": "u", "check": "c", "restart": "r", "user": "a", "registration": "g", "users": "m", "tokens": "t", "dashboard": "d", "changes": "n", "images": "i", "backup": "b", "schedule": "s", - "restore": "e", "rollback": "z", "logs": "l", "tuning": "f", "setup": "w", "migrate": "v", "servers": "o"} + "restore": "e", "rollback": "z", "logs": "l", "tuning": "f", "setup": "w", "migrate": "v", "servers": "o", + "services": "p", "tags": "x"} type manageScreen struct { cfg *config.Config @@ -196,6 +198,20 @@ func (s *manageScreen) actions() []manageAction { desc: "Copy everything in /matrix to a new machine and install there; the old one is stopped."}, manageAction{id: "servers", title: "Other servers", desc: "Switch between the servers interzone manages, or add another."}, + manageAction{id: "services", title: "Start, stop or reinstall services", + desc: "Every service or one group of them. Reinstalling everything also removes the components you've turned off."}, + manageAction{id: "vacuum", title: "Vacuum the database", + desc: "Give the disk space of deleted rows back to the server (Postgres VACUUM)."}, + manageAction{id: "pgupgrade", title: "Upgrade Postgres", + desc: "Move the database to the newest Postgres major version; the playbook never does it by itself."}, + manageAction{id: "compress", title: "Compress Synapse's state", + desc: "Shrink Synapse's largest tables with rust-synapse-compress-state."}, + manageAction{id: "psql", title: "Database shell", + desc: "Open psql on the server's Postgres, right here in the terminal."}, + manageAction{id: "tags", title: "Run playbook tags", + desc: "Run any of the playbook's tags with extra vars, as just run-tags does."}, + manageAction{id: "uninstall", title: "Uninstall everything", + desc: "Remove every Matrix service, the Docker images and /matrix with all its data from the server."}, manageAction{id: "selfupdate", title: "Update interzone", desc: "Download the newest interzone release and replace this program with it."}, ) @@ -211,6 +227,10 @@ func (s *manageScreen) actions() []manageAction { acts[i].disabled = "Needs Synapse's admin API; " + homeserverName(c.Homeserver) + " doesn't have one." case acts[i].id == "tokens" && c.Components["external-postgres"]: acts[i].disabled = "MAS's tokens are read from the bundled Postgres; you use an external one." + case acts[i].id == "compress" && c.Homeserver != "synapse": + acts[i].disabled = "Only Synapse has state to compress." + case c.Components["external-postgres"] && (acts[i].id == "vacuum" || acts[i].id == "pgupgrade" || acts[i].id == "compress" || acts[i].id == "psql"): + acts[i].disabled = "You use an external Postgres server; maintain it where it runs." case c.Components["external-postgres"] && (acts[i].id == "backup" || acts[i].id == "schedule" || acts[i].id == "restore"): acts[i].disabled = "You use an external Postgres server; back it up where it runs." } @@ -343,6 +363,10 @@ func (s *manageScreen) choose(id string) tea.Cmd { screen := map[string]string{"users": "Users", "tokens": "Tokens", "dashboard": "Dashboard", "changes": "Updates", "schedule": "Backups", "restore": "Restore", "rollback": "Rollback", "tuning": "Tuning", "servers": "Servers", "migrate": "Move"}[id] return func() tea.Msg { return gotoMsg(screen) } + case "psql": + return databaseShell(s.cfg) + case "services", "vacuum", "pgupgrade", "compress", "tags", "uninstall": + return func() tea.Msg { return maintainMsg(id) } case "user": u := textField("name", "Username", "", "alice", "Just the name, not @alice:"+s.cfg.Domain+".") u.required = true diff --git a/internal/ui/sidebar.go b/internal/ui/sidebar.go index 590c1ec..87fa880 100644 --- a/internal/ui/sidebar.go +++ b/internal/ui/sidebar.go @@ -95,6 +95,7 @@ var manageMenu = []struct{ screen, label, icon string }{ {"Restore", "Restore", "↺"}, {"Rollback", "Rollback", "↶"}, {"Tuning", "Fine-tune", "✎"}, + {"Maintenance", "Maintenance", "⚒"}, {"Move", "Move server", "⇢"}, {"Servers", "Servers", "▤"}, } diff --git a/internal/ui/testdata/layout/dashboard-120x36.txt b/internal/ui/testdata/layout/dashboard-120x36.txt index 672d5a7..a780e48 100644 --- a/internal/ui/testdata/layout/dashboard-120x36.txt +++ b/internal/ui/testdata/layout/dashboard-120x36.txt @@ -11,14 +11,14 @@ │ ↺ Restore ││ │ 30% load 1.20 on 4 cores │ │ 62% 5.0 GB of 8.0 GB │ │ │ ↶ Rollback ││ │ ███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ │ ████████████████████████░░░░░░░░░░░░░░░ │ │ │ ✎ Fine-tune ││ ╰────────────────────────────────────────╯ ╰─────────────────────────────────────────╯ │ -│ ⇢ Move server ││ ╭────────────────────────────────────────╮ ╭─────────────────────────────────────────╮ │ -│ ▤ Servers ││ │ Disk / │ │ Containers │ │ -│ ││ │ 78% 18.0 GB free │ │ 3/4 1 stopped, 1 unhealthy │ │ -│ ▸ Mirrors ││ │ █████████████████████████████░░░░░░░░░ │ │ ████████████████████░░░░░░░░░░░░░░░░░░░ │ │ -│ ││ ╰────────────────────────────────────────╯ ╰─────────────────────────────────────────╯ │ -│ ▾ Servers ││ ╭────────────────────────────────────────────────────────────────────────────────────╮ │ -│ ● example.org ││ │ System │ │ -│ ││ │ Load 1.20 0.90 0.70 1, 5, 15 min │ │ +│ ⚒ Maintenance ││ ╭────────────────────────────────────────╮ ╭─────────────────────────────────────────╮ │ +│ ⇢ Move server ││ │ Disk / │ │ Containers │ │ +│ ▤ Servers ││ │ 78% 18.0 GB free │ │ 3/4 1 stopped, 1 unhealthy │ │ +│ ││ │ █████████████████████████████░░░░░░░░░ │ │ ████████████████████░░░░░░░░░░░░░░░░░░░ │ │ +│ ▸ Mirrors ││ ╰────────────────────────────────────────╯ ╰─────────────────────────────────────────╯ │ +│ ││ ╭────────────────────────────────────────────────────────────────────────────────────╮ │ +│ ▾ Servers ││ │ System │ │ +│ ● example.org ││ │ Load 1.20 0.90 0.70 1, 5, 15 min │ │ │ ││ │ Memory ███████████████░░░░░░░░░ 5.0 GB / 8.0 GB │ │ │ ││ │ Swap ████████████░░░░░░░░░░░░ 1.0 GB / 2.0 GB │ │ │ ││ │ Disk / ███████████████████░░░░░ 18.0 GB free / 80.0 GB │ │ diff --git a/internal/ui/testdata/layout/dashboard-180x50.txt b/internal/ui/testdata/layout/dashboard-180x50.txt index 31217ed..2386ff8 100644 --- a/internal/ui/testdata/layout/dashboard-180x50.txt +++ b/internal/ui/testdata/layout/dashboard-180x50.txt @@ -11,14 +11,14 @@ │ ↺ Restore ││ │ █████████░░░░░░░░░░░░░░░░░░░░░░ │ │ ███████████████████░░░░░░░░░░░░ │ │ ████████████████████████░░░░░░░ │ │ █████████████████░░░░░░░░░░░░░░░░░ │ │ │ ↶ Rollback ││ ╰─────────────────────────────────╯ ╰─────────────────────────────────╯ ╰─────────────────────────────────╯ ╰────────────────────────────────────╯ │ │ ✎ Fine-tune ││ ╭──────────────────────────────────────────────────────────────────────╮ ╭───────────────────────────────────────────────────────────────────────╮ │ -│ ⇢ Move server ││ │ System │ │ Heaviest containers use 5% of 4 cores │ │ -│ ▤ Servers ││ │ Load 1.20 0.90 0.70 1, 5, 15 min │ │ mem cpu │ │ -│ ││ │ Memory ███████████████░░░░░░░░░ 5.0 GB / 8.0 GB │ │ synapse ██████████████ 7.6% 4.10% │ │ -│ ▸ Mirrors ││ │ Swap ████████████░░░░░░░░░░░░ 1.0 GB / 2.0 GB │ │ postgres █████░░░░░░░░░ 2.7% 0.80% │ │ -│ ││ │ Disk / ███████████████████░░░░░ 18.0 GB free / 80.0 GB │ │ traefik █░░░░░░░░░░░░░ 0.7% 0.20% │ │ -│ ▾ Servers ││ │ Next backup Tue 0000-00-00 00:00:00 UTC │ │ │ │ -│ ● example.org ││ ╰──────────────────────────────────────────────────────────────────────╯ ╰───────────────────────────────────────────────────────────────────────╯ │ -│ ││ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ ⚒ Maintenance ││ │ System │ │ Heaviest containers use 5% of 4 cores │ │ +│ ⇢ Move server ││ │ Load 1.20 0.90 0.70 1, 5, 15 min │ │ mem cpu │ │ +│ ▤ Servers ││ │ Memory ███████████████░░░░░░░░░ 5.0 GB / 8.0 GB │ │ synapse ██████████████ 7.6% 4.10% │ │ +│ ││ │ Swap ████████████░░░░░░░░░░░░ 1.0 GB / 2.0 GB │ │ postgres █████░░░░░░░░░ 2.7% 0.80% │ │ +│ ▸ Mirrors ││ │ Disk / ███████████████████░░░░░ 18.0 GB free / 80.0 GB │ │ traefik █░░░░░░░░░░░░░ 0.7% 0.20% │ │ +│ ││ │ Next backup Tue 0000-00-00 00:00:00 UTC │ │ │ │ +│ ▾ Servers ││ ╰──────────────────────────────────────────────────────────────────────╯ ╰───────────────────────────────────────────────────────────────────────╯ │ +│ ● example.org ││ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ ││ │ Certificates │ │ │ ││ │ ✓ Synapse matrix.example.org 60 days until 0000-00-00 · R11 │ │ │ ││ │ ! Element Web element.example.org 12 days until 0000-00-00 · R11 │ │ diff --git a/internal/ui/testdata/layout/maintenance-120x36.txt b/internal/ui/testdata/layout/maintenance-120x36.txt new file mode 100644 index 0000000..1bbd098 --- /dev/null +++ b/internal/ui/testdata/layout/maintenance-120x36.txt @@ -0,0 +1,36 @@ + ◢◤ interzone matrix, deployed anywhere ONLINE +╭────────────────────────╮╭────────────────────────────────────────────────────────────────────────────────────────────╮ +│ ▸ Setup ││ │ +│ ││ Maintenance │ +│ ▾ Manage example.org ││ │ +│ ⌂ Overview ││ ▌ Task │ +│ @ Users ││ ▌ Services Vacuum Upgrade Compress Tags Uninstall │ +│ ▦ Dashboard ││ ▌ Give the disk space of deleted rows back (Postgres VACUUM). Do it after deleting │ +│ ↻ Updates ││ ▌ a lot, e.g. after compressing Synapse's state. │ +│ ◷ Backups ││ │ +│ ↺ Restore ││ Kind of vacuum │ +│ ↶ Rollback ││ Complete (FULL, ANALYZE; services stop) │ +│ ✎ Fine-tune ││ Full (services stop) │ +│ ▌ ⚒ Maintenance ││ Plain (services keep running) │ +│ ⇢ Move server ││ Plain + ANALYZE (services keep running) │ +│ ▤ Servers ││ ANALYZE only (fastest) │ +│ ││ │ +│ ▸ Mirrors ││ │ +│ ││ │ +│ ▾ Servers ││ │ +│ ● example.org ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ◫ auto (wide) ctrl+l ││ │ +│ ◐ interzone ctrl+y ││ │ +│ ◂ fold ctrl+b menu ││ │ +╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯ + ←→ task · ↑↓ move · enter run · esc back · ctrl+c quit \ No newline at end of file diff --git a/internal/ui/testdata/layout/maintenance-46x40.txt b/internal/ui/testdata/layout/maintenance-46x40.txt new file mode 100644 index 0000000..18530be --- /dev/null +++ b/internal/ui/testdata/layout/maintenance-46x40.txt @@ -0,0 +1,40 @@ + ◢◤ ◆ Manage › Maintenance + Maintenance + + ▌ Task + ▌ Services + ▌ Vacuum + ▌ Upgrade + ▌ Compress + ▌ Tags + ▌ Uninstall + ▌ Give the disk space of deleted rows + ▌ back (Postgres VACUUM). Do it after + ▌ deleting a lot, e.g. after compressing + ▌ Synapse's state. + + Kind of vacuum + Complete (FULL, ANALYZE; services stop) + Full (services stop) + Plain (services keep running) + Plain + ANALYZE (services keep running) + ANALYZE only (fastest) + + + + + + + + + + + + + + + + + + + ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/maintenance-48x20.txt b/internal/ui/testdata/layout/maintenance-48x20.txt new file mode 100644 index 0000000..44e37f4 --- /dev/null +++ b/internal/ui/testdata/layout/maintenance-48x20.txt @@ -0,0 +1,20 @@ + ◢◤ ◆ Manage › Maintenance + Maintenance + ▌ Task + ▌ Services + ▌ Vacuum + ▌ Upgrade + ▌ Compress + ▌ Tags + ▌ Uninstall + ▌ Give the disk space of deleted rows back + ▌ (Postgres VACUUM). Do it after deleting a + ▌ lot, e.g. after compressing Synapse's + ▌ state. + Kind of vacuum Complete (FULL, ANALYZE; se + + + + + + ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/manage-120x36.txt b/internal/ui/testdata/layout/manage-120x36.txt index 96da27e..25ddf00 100644 --- a/internal/ui/testdata/layout/manage-120x36.txt +++ b/internal/ui/testdata/layout/manage-120x36.txt @@ -11,8 +11,9 @@ │ ↺ Restore ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ │ ↶ Rollback ││ ✓ Check services c │ │ ✎ Fine-tune ││ ↯ Restart all services r │ -│ ⇢ Move server ││ ± See what an update brings n │ -│ ▤ Servers ││ ▣ Check container images i │ +│ ⚒ Maintenance ││ ± See what an update brings n │ +│ ⇢ Move server ││ ▣ Check container images i │ +│ ▤ Servers ││ ⏻ Start, stop or reinstall services p │ │ ││ ⇪ Update interzone │ │ ▸ Mirrors ││ │ │ ││ People ─────────────────────────────────────────────────────────────────────────────── │ @@ -24,12 +25,11 @@ │ ││ ◷ Scheduled backups s │ │ ││ ↺ Restore a backup e │ │ ││ ↶ Roll back z │ +│ ││ ⌫ Vacuum the database │ +│ ││ ⇡ Upgrade Postgres │ +│ ││ ⇲ Compress Synapse's state │ │ ││ │ -│ ││ Look closer ────────────────────────────────────────────────────────────────────────── │ -│ ││ ▦ Server dashboard d │ -│ ││ ≡ View logs l │ -│ ││ ✎ Fine-tune the roles f │ -│ ◫ auto (wide) ctrl+l ││ │ +│ ◫ auto (wide) ctrl+l ││ Look closer ────────────────────────────────────────────────────────────────────────── │ │ ◐ interzone ctrl+y ││ ▼ more below │ │ ◂ fold ctrl+b menu ││ │ ╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/internal/ui/testdata/layout/manage-46x40.txt b/internal/ui/testdata/layout/manage-46x40.txt index 95570f8..602f3e5 100644 --- a/internal/ui/testdata/layout/manage-46x40.txt +++ b/internal/ui/testdata/layout/manage-46x40.txt @@ -13,6 +13,7 @@ ↯ Restart all services r ± See what an update brings n ▣ Check container images i + ⏻ Start, stop or reinstall servic… p ⇪ Update interzone People ───────────────────────────────────── @@ -24,17 +25,16 @@ ◷ Scheduled backups s ↺ Restore a backup e ↶ Roll back z + ⌫ Vacuum the database + ⇡ Upgrade Postgres + ⇲ Compress Synapse's state Look closer ──────────────────────────────── ▦ Server dashboard d ≡ View logs l ✎ Fine-tune the roles f + $ Database shell + # Run playbook tags x - Change things ────────────────────────────── - ◇ Change the setup w - ⇢ Move to another server v - ▤ Other servers o - - - + ▼ more below ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/manage-48x20.txt b/internal/ui/testdata/layout/manage-48x20.txt index cd67894..ea98f16 100644 --- a/internal/ui/testdata/layout/manage-48x20.txt +++ b/internal/ui/testdata/layout/manage-48x20.txt @@ -9,12 +9,12 @@ ↯ Restart all services r ± See what an update brings n ▣ Check container images i + ⏻ Start, stop or reinstall services p ⇪ Update interzone People ─────────────────────────────────────── + Add a user a @ Manage users m Data ───────────────────────────────────────── ⇩ Back up the database b - ◷ Scheduled backups s ▼ more below ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/manage-armed-120x36.txt b/internal/ui/testdata/layout/manage-armed-120x36.txt index 4226f98..e2f04dc 100644 --- a/internal/ui/testdata/layout/manage-armed-120x36.txt +++ b/internal/ui/testdata/layout/manage-armed-120x36.txt @@ -11,7 +11,8 @@ │ ↺ Restore ││ │ press r again to run │ │ │ ↶ Rollback ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ │ ✎ Fine-tune ││ ± See what an update brings n │ -│ ⇢ Move server ││ ▣ Check container images i │ +│ ⚒ Maintenance ││ ▣ Check container images i │ +│ ⇢ Move server ││ ⏻ Start, stop or reinstall services p │ │ ▤ Servers ││ ⇪ Update interzone │ │ ││ │ │ ▸ Mirrors ││ People ─────────────────────────────────────────────────────────────────────────────── │ @@ -23,13 +24,12 @@ │ ││ ◷ Scheduled backups s │ │ ││ ↺ Restore a backup e │ │ ││ ↶ Roll back z │ +│ ││ ⌫ Vacuum the database │ +│ ││ ⇡ Upgrade Postgres │ +│ ││ ⇲ Compress Synapse's state │ │ ││ │ │ ││ Look closer ────────────────────────────────────────────────────────────────────────── │ -│ ││ ▦ Server dashboard d │ -│ ││ ≡ View logs l │ -│ ││ ✎ Fine-tune the roles f │ -│ ││ │ -│ ◫ auto (wide) ctrl+l ││ Change things ──────────────────────────────────────────────────────────────────────── │ +│ ◫ auto (wide) ctrl+l ││ ▦ Server dashboard d │ │ ◐ interzone ctrl+y ││ ▼ more below │ │ ◂ fold ctrl+b menu ││ │ ╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/internal/ui/testdata/layout/manage-armed-46x40.txt b/internal/ui/testdata/layout/manage-armed-46x40.txt index 377623c..3a11d4b 100644 --- a/internal/ui/testdata/layout/manage-armed-46x40.txt +++ b/internal/ui/testdata/layout/manage-armed-46x40.txt @@ -10,6 +10,7 @@ ╰──────────────────────────────────────────╯ ± See what an update brings n ▣ Check container images i + ⏻ Start, stop or reinstall servic… p ⇪ Update interzone People ───────────────────────────────────── @@ -21,20 +22,19 @@ ◷ Scheduled backups s ↺ Restore a backup e ↶ Roll back z + ⌫ Vacuum the database + ⇡ Upgrade Postgres + ⇲ Compress Synapse's state Look closer ──────────────────────────────── ▦ Server dashboard d ≡ View logs l ✎ Fine-tune the roles f + $ Database shell + # Run playbook tags x Change things ────────────────────────────── ◇ Change the setup w ⇢ Move to another server v - ▤ Other servers o - - - - - - + ▼ more below ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/manage-armed-48x20.txt b/internal/ui/testdata/layout/manage-armed-48x20.txt index 8ee485c..d1563b5 100644 --- a/internal/ui/testdata/layout/manage-armed-48x20.txt +++ b/internal/ui/testdata/layout/manage-armed-48x20.txt @@ -9,12 +9,12 @@ ╰────────────────────────────────────────────╯ ± See what an update brings n ▣ Check container images i + ⏻ Start, stop or reinstall services p ⇪ Update interzone People ─────────────────────────────────────── + Add a user a @ Manage users m Data ───────────────────────────────────────── ⇩ Back up the database b - ◷ Scheduled backups s ▼ more below ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/menu-120x36.txt b/internal/ui/testdata/layout/menu-120x36.txt index 658fc53..91289b6 100644 --- a/internal/ui/testdata/layout/menu-120x36.txt +++ b/internal/ui/testdata/layout/menu-120x36.txt @@ -11,8 +11,9 @@ │ ↺ Restore ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ │ ↶ Rollback ││ ✓ Check services c │ │ ✎ Fine-tune ││ ↯ Restart all services r │ -│ ⇢ Move server ││ ± See what an update brings n │ -│ ▤ Servers ││ ▣ Check container images i │ +│ ⚒ Maintenance ││ ± See what an update brings n │ +│ ⇢ Move server ││ ▣ Check container images i │ +│ ▤ Servers ││ ⏻ Start, stop or reinstall services p │ │ ││ ⇪ Update interzone │ │ ▸ Mirrors ││ │ │ ││ People ─────────────────────────────────────────────────────────────────────────────── │ @@ -24,12 +25,11 @@ │ ││ ◷ Scheduled backups s │ │ ││ ↺ Restore a backup e │ │ ││ ↶ Roll back z │ +│ ││ ⌫ Vacuum the database │ +│ ││ ⇡ Upgrade Postgres │ +│ ││ ⇲ Compress Synapse's state │ │ ││ │ -│ ││ Look closer ────────────────────────────────────────────────────────────────────────── │ -│ ││ ▦ Server dashboard d │ -│ ││ ≡ View logs l │ -│ ││ ✎ Fine-tune the roles f │ -│ ◫ auto (wide) ctrl+l ││ │ +│ ◫ auto (wide) ctrl+l ││ Look closer ────────────────────────────────────────────────────────────────────────── │ │ ◐ interzone ctrl+y ││ ▼ more below │ │ ◂ fold ctrl+b menu ││ │ ╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/internal/ui/testdata/layout/menu-46x40.txt b/internal/ui/testdata/layout/menu-46x40.txt index 57ec02b..9ab8780 100644 --- a/internal/ui/testdata/layout/menu-46x40.txt +++ b/internal/ui/testdata/layout/menu-46x40.txt @@ -14,8 +14,11 @@ │ ↶ Rollback │ │ ✎ Fine-tune │ ╰───────────────────╯ ╰────────────────────╯ ╭───────────────────╮ ╭────────────────────╮ - │ ⇢ Move server │ │ ▤ Servers │ + │ ⚒ Maintenance │ │ ⇢ Move server │ ╰───────────────────╯ ╰────────────────────╯ + ╭───────────────────╮ + │ ▤ Servers │ + ╰───────────────────╯ ⇅ Mirrors ▸ ▤ Servers ▾ @@ -34,7 +37,4 @@ - - - ✕ close \ No newline at end of file diff --git a/internal/ui/testdata/layout/menu-48x20.txt b/internal/ui/testdata/layout/menu-48x20.txt index 2b0b91e..893be89 100644 --- a/internal/ui/testdata/layout/menu-48x20.txt +++ b/internal/ui/testdata/layout/menu-48x20.txt @@ -14,7 +14,7 @@ │ ↶ Rollback │ │ ✎ Fine-tune │ ╰────────────────────╯ ╰─────────────────────╯ ╭────────────────────╮ ╭─────────────────────╮ - │ ⇢ Move server │ │ ▤ Servers │ + │ ⚒ Maintenance │ │ ⇢ Move server │ ╰────────────────────╯ ╰─────────────────────╯ ▼ more below ✕ close \ No newline at end of file diff --git a/internal/ui/testdata/layout/sheet-120x36.txt b/internal/ui/testdata/layout/sheet-120x36.txt index 658fc53..91289b6 100644 --- a/internal/ui/testdata/layout/sheet-120x36.txt +++ b/internal/ui/testdata/layout/sheet-120x36.txt @@ -11,8 +11,9 @@ │ ↺ Restore ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ │ ↶ Rollback ││ ✓ Check services c │ │ ✎ Fine-tune ││ ↯ Restart all services r │ -│ ⇢ Move server ││ ± See what an update brings n │ -│ ▤ Servers ││ ▣ Check container images i │ +│ ⚒ Maintenance ││ ± See what an update brings n │ +│ ⇢ Move server ││ ▣ Check container images i │ +│ ▤ Servers ││ ⏻ Start, stop or reinstall services p │ │ ││ ⇪ Update interzone │ │ ▸ Mirrors ││ │ │ ││ People ─────────────────────────────────────────────────────────────────────────────── │ @@ -24,12 +25,11 @@ │ ││ ◷ Scheduled backups s │ │ ││ ↺ Restore a backup e │ │ ││ ↶ Roll back z │ +│ ││ ⌫ Vacuum the database │ +│ ││ ⇡ Upgrade Postgres │ +│ ││ ⇲ Compress Synapse's state │ │ ││ │ -│ ││ Look closer ────────────────────────────────────────────────────────────────────────── │ -│ ││ ▦ Server dashboard d │ -│ ││ ≡ View logs l │ -│ ││ ✎ Fine-tune the roles f │ -│ ◫ auto (wide) ctrl+l ││ │ +│ ◫ auto (wide) ctrl+l ││ Look closer ────────────────────────────────────────────────────────────────────────── │ │ ◐ interzone ctrl+y ││ ▼ more below │ │ ◂ fold ctrl+b menu ││ │ ╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/internal/ui/testdata/layout/tokens-120x36.txt b/internal/ui/testdata/layout/tokens-120x36.txt index d2b3306..23d063d 100644 --- a/internal/ui/testdata/layout/tokens-120x36.txt +++ b/internal/ui/testdata/layout/tokens-120x36.txt @@ -12,10 +12,11 @@ │ ↺ Restore ││ │ Used 14 no limit │ │ │ ↶ Rollback ││ │ Last used 3h ago │ │ │ ✎ Fine-tune ││ │ Made 0000-00-00 40d ago │ │ -│ ⇢ Move server ││ │ Expires never │ │ -│ ▤ Servers ││ │ │ │ -│ ││ │ x revoke n new token │ │ -│ ▸ Mirrors ││ ╰────────────────────────────────────────────╯ │ +│ ⚒ Maintenance ││ │ Expires never │ │ +│ ⇢ Move server ││ │ │ │ +│ ▤ Servers ││ │ x revoke n new token │ │ +│ ││ ╰────────────────────────────────────────────╯ │ +│ ▸ Mirrors ││ │ │ ││ │ │ ▾ Servers ││ │ │ ● example.org ││ │ @@ -28,7 +29,6 @@ │ ││ │ │ ││ │ │ ││ │ -│ ││ │ │ ◫ auto (wide) ctrl+l ││ │ │ ◐ interzone ctrl+y ││ │ │ ◂ fold ctrl+b menu ││ │ diff --git a/internal/ui/testdata/layout/users-120x36.txt b/internal/ui/testdata/layout/users-120x36.txt index 92b2571..9389bd5 100644 --- a/internal/ui/testdata/layout/users-120x36.txt +++ b/internal/ui/testdata/layout/users-120x36.txt @@ -11,14 +11,14 @@ │ ↺ Restore ││ │ │ ↶ Rollback ││ ▌ ● Alice Liddell admin 2h ago ╭────────────────────────────────────────────╮ │ │ ✎ Fine-tune ││ ● Bob 3d ago │ ● Alice Liddell admin │ │ -│ ⇢ Move server ││ ● Carol 45d ago │ @alice:example.org │ │ -│ ▤ Servers ││ ○ eve never │ │ │ -│ ││ ⊘ dave deactivated │ Last seen 2h ago 0000-00-00 00:00 │ │ -│ ▸ Mirrors ││ ⇄ Telegram 3 accounts ▸ │ Joined 0000-00-00 1y ago │ │ -│ ││ ⇄ WhatsApp 1 account ▸ │ Sessions 3 devices │ │ -│ ▾ Servers ││ │ Rooms 27 │ │ -│ ● example.org ││ │ Media 380 MB 142 files │ │ -│ ││ │ Email alice@example.org │ │ +│ ⚒ Maintenance ││ ● Carol 45d ago │ @alice:example.org │ │ +│ ⇢ Move server ││ ○ eve never │ │ │ +│ ▤ Servers ││ ⊘ dave deactivated │ Last seen 2h ago 0000-00-00 00:00 │ │ +│ ││ ⇄ Telegram 3 accounts ▸ │ Joined 0000-00-00 1y ago │ │ +│ ▸ Mirrors ││ ⇄ WhatsApp 1 account ▸ │ Sessions 3 devices │ │ +│ ││ │ Rooms 27 │ │ +│ ▾ Servers ││ │ Media 380 MB 142 files │ │ +│ ● example.org ││ │ Email alice@example.org │ │ │ ││ │ Picture set │ │ │ ││ │ │ │ │ ││ │ p new password a remove admin │ │ diff --git a/internal/ui/testdata/layout/users-180x50.txt b/internal/ui/testdata/layout/users-180x50.txt index a59a9e9..7ddb2df 100644 --- a/internal/ui/testdata/layout/users-180x50.txt +++ b/internal/ui/testdata/layout/users-180x50.txt @@ -11,14 +11,14 @@ │ ↺ Restore ││ │ │ ↶ Rollback ││ ▌ ● Alice Liddell admin 2h ago ╭──────────────────────────────────────────────────────────────────────────────────────╮ │ │ ✎ Fine-tune ││ ● Bob 3d ago │ ● Alice Liddell admin │ │ -│ ⇢ Move server ││ ● Carol 45d ago │ @alice:example.org │ │ -│ ▤ Servers ││ ○ eve never │ │ │ -│ ││ ⊘ dave deactivated │ Last seen 2h ago 0000-00-00 00:00 │ │ -│ ▸ Mirrors ││ ⇄ Telegram 3 accounts ▸ │ Joined 0000-00-00 1y ago │ │ -│ ││ ⇄ WhatsApp 1 account ▸ │ Sessions 3 devices │ │ -│ ▾ Servers ││ │ Rooms 27 │ │ -│ ● example.org ││ │ Media 380 MB 142 files │ │ -│ ││ │ Email alice@example.org │ │ +│ ⚒ Maintenance ││ ● Carol 45d ago │ @alice:example.org │ │ +│ ⇢ Move server ││ ○ eve never │ │ │ +│ ▤ Servers ││ ⊘ dave deactivated │ Last seen 2h ago 0000-00-00 00:00 │ │ +│ ││ ⇄ Telegram 3 accounts ▸ │ Joined 0000-00-00 1y ago │ │ +│ ▸ Mirrors ││ ⇄ WhatsApp 1 account ▸ │ Sessions 3 devices │ │ +│ ││ │ Rooms 27 │ │ +│ ▾ Servers ││ │ Media 380 MB 142 files │ │ +│ ● example.org ││ │ Email alice@example.org │ │ │ ││ │ Picture set │ │ │ ││ │ │ │ │ ││ │ p new password a remove admin s sign out everywhere d deactivate │ │ diff --git a/internal/ui/testdata/layout/users-bridge-120x36.txt b/internal/ui/testdata/layout/users-bridge-120x36.txt index 40abec3..bd065c8 100644 --- a/internal/ui/testdata/layout/users-bridge-120x36.txt +++ b/internal/ui/testdata/layout/users-bridge-120x36.txt @@ -11,14 +11,14 @@ │ ↺ Restore ││ │ │ ↶ Rollback ││ ● Alice Liddell admin 2h ago ╭────────────────────────────────────────────╮ │ │ ✎ Fine-tune ││ ● Bob 3d ago │ ⇄ Telegram bridge │ │ -│ ⇢ Move server ││ ● Carol 45d ago │ │ │ -│ ▤ Servers ││ ○ eve never │ Accounts 3 1 active this month │ │ -│ ││ ⊘ dave deactivated │ Bot @telegrambot:example.org │ │ -│ ▸ Mirrors ││ ▌ ⇄ Telegram 3 accounts ▾ │ Media 4.0 MB │ │ -│ ││ ● Telegram bridge… bot 1h ago │ │ │ -│ ▾ Servers ││ ○ Nikolai (Telegram) never │ Puppets stand in for people on the other n │ │ -│ ● example.org ││ ○ Pavel (Telegram) never │ the bridge creates and manages them. │ │ -│ ││ ⇄ WhatsApp 1 account ▸ ╰────────────────────────────────────────────╯ │ +│ ⚒ Maintenance ││ ● Carol 45d ago │ │ │ +│ ⇢ Move server ││ ○ eve never │ Accounts 3 1 active this month │ │ +│ ▤ Servers ││ ⊘ dave deactivated │ Bot @telegrambot:example.org │ │ +│ ││ ▌ ⇄ Telegram 3 accounts ▾ │ Media 4.0 MB │ │ +│ ▸ Mirrors ││ ● Telegram bridge… bot 1h ago │ │ │ +│ ││ ○ Nikolai (Telegram) never │ Puppets stand in for people on the other n │ │ +│ ▾ Servers ││ ○ Pavel (Telegram) never │ the bridge creates and manages them. │ │ +│ ● example.org ││ ⇄ WhatsApp 1 account ▸ ╰────────────────────────────────────────────╯ │ │ ││ │ │ ││ │ │ ││ │