Move the server between a container and the host #33

Merged
jcoffey-dev merged 1 commits from feat/move-server into main 2026-10-15 03:42:38 +00:00
Owner

install run again with the other --server now moves the mail server, with its configuration and mail, instead of refusing with "not built yet". The last unbuilt item in the README.

How

  • Needs an API key (--key - / INBUXA_API_KEY, never written down), as certs and join do: the server's listeners and its auto-ban exemptions change with the shape, and only the server changes those. New jmap.ContainerListeners undoes HostListeners; AllowedIPs keeps exemptions from doubling.
  • beginMove: checks the key, stops what runs here, archives the data into <dir>/backups before anything of the new shape is written.
  • finish: copies the data (renamed into place on the host, streamed into the volumes for a container, so no second full copy), rewrites the one path config.json names, starts the server in its new shape -- on the host first behind the loopback fence (new modeFenced) until its listeners are fitted -- and checks it didn't come back in bootstrap mode.
  • Copied, never moved: the volumes or <dir>/server stay where they were. Leftovers of an earlier install in the target are archived and emptied, never mixed in.
  • A failure in finish, or anything stopping the run before it (abort), puts the old shape back.
  • The plan says when a run is a move; apply -f moves too. The interface doesn't offer it yet (it has no key to give).

Tests (lab VM, Debian 13)

  • new e2e/cases/move-server.sh 56/56: no key and a wrong key change nothing; a broken host binary puts the container back; container -> host -> container, each time keeping an account and the first mailbox's IMAP sign-in, front ends answering, status agreeing, archives taken, old copy left, key not written down.
  • install-host.sh now expects the key refusal in place of "not built yet": 44/44. uninstall-host 14/14, rerun-host-server 12/12.
  • unit tests for move detection, the config path rewrite and rename-into-place; gofmt, vet amd64+arm64, govulncheck clean.

Not covered: podman (Red Hat family) and a non-local install with Caddy in front; worth a run on DISTRO=fedora before release.

`install` run again with the other `--server` now moves the mail server, with its configuration and mail, instead of refusing with "not built yet". The last unbuilt item in the README. **How** - Needs an API key (`--key -` / `INBUXA_API_KEY`, never written down), as `certs` and `join` do: the server's listeners and its auto-ban exemptions change with the shape, and only the server changes those. New `jmap.ContainerListeners` undoes `HostListeners`; `AllowedIPs` keeps exemptions from doubling. - `beginMove`: checks the key, stops what runs here, archives the data into `<dir>/backups` before anything of the new shape is written. - `finish`: copies the data (renamed into place on the host, streamed into the volumes for a container, so no second full copy), rewrites the one path `config.json` names, starts the server in its new shape -- on the host first behind the loopback fence (new `modeFenced`) until its listeners are fitted -- and checks it didn't come back in bootstrap mode. - Copied, never moved: the volumes or `<dir>/server` stay where they were. Leftovers of an earlier install in the target are archived and emptied, never mixed in. - A failure in `finish`, or anything stopping the run before it (`abort`), puts the old shape back. - The plan says when a run is a move; `apply -f` moves too. The interface doesn't offer it yet (it has no key to give). **Tests** (lab VM, Debian 13) - new `e2e/cases/move-server.sh` 56/56: no key and a wrong key change nothing; a broken host binary puts the container back; container -> host -> container, each time keeping an account and the first mailbox's IMAP sign-in, front ends answering, `status` agreeing, archives taken, old copy left, key not written down. - `install-host.sh` now expects the key refusal in place of "not built yet": 44/44. `uninstall-host` 14/14, `rerun-host-server` 12/12. - unit tests for move detection, the config path rewrite and rename-into-place; gofmt, vet amd64+arm64, govulncheck clean. Not covered: podman (Red Hat family) and a non-local install with Caddy in front; worth a run on `DISTRO=fedora` before release.
jcoffey-dev added 1 commit 2026-10-15 03:32:44 +00:00
Move the server between a container and the host
ci / test (pull_request) Successful in 1m37s
bef9f459a6
`install` run again with the other --server now moves the mail server,
with its configuration and mail, instead of refusing ("not built yet").

- Needs an API key (--key - / INBUXA_API_KEY, never written down), as
  certs and join do: the server's listeners (jmap.HostListeners, and the
  new ContainerListeners) and its auto-ban exemptions change with the
  shape, and only the server changes those.
- beginMove checks the key, stops what runs here and archives the data
  into <dir>/backups before anything of the new shape is written; finish
  copies it (renamed into place, or streamed into the volumes), rewrites
  the one path config.json names, starts the server in its new shape --
  on the host first behind the loopback fence (modeFenced) until its
  listeners are fitted -- and checks it came back configured.
- Copied, never moved: the volumes, or <dir>/server, stay where they were.
  Leftovers of an earlier install in the target are archived and emptied,
  never mixed in. A failure in finish, or anything stopping the run
  before it (abort), puts the old shape back.
- The plan says when a run is a move. `apply -f` moves too.

e2e/cases/move-server.sh: 56/56 (no key and a wrong key change nothing;
a broken host binary puts the container back; container -> host -> container
keeping an account and IMAP sign-in, front ends answering, status agreeing).
install-host.sh expects the key refusal in place of "not built yet": 44/44;
uninstall-host 14/14, rerun-host-server 12/12.
jcoffey-dev merged commit f683b1bfab into main 2026-10-15 03:42:38 +00:00
jcoffey-dev deleted branch feat/move-server 2026-10-15 03:42:39 +00:00
Sign in to join this conversation.