Offer only what this machine can deliver

The installer knew one distribution: Debian, with docker, on a new enough
release. Everything else it would have offered and then failed at.

Three facts now decide what the matrix offers, and each is read from the
machine rather than assumed:

- The container runtime. Docker where the machine has one, podman on the Red
  Hat family, which ships no docker at all. Both go through the same compose
  plugin: compose speaks the Docker API and podman serves it, so there is one
  compose file and one deployment path, not two. Telling a Fedora operator to
  add Docker's own repository to a machine that already has a container
  runtime would have been the wrong trade.

- glibc. The server binary is downloaded, not built here, and it is linked
  against 2.39. Rocky 9 (2.34), Debian 12 and Ubuntu 22.04 cannot run it, so
  the host shape is refused there with the version found and the container
  shape named as the answer -- rather than installing a file that cannot
  start.

- The operating system itself. This compiles for macOS and Windows because Go
  compiles anything, and on either it would read no os-release, find no
  systemd, and describe a machine that does not exist. It now says what it is
  and exits.

Two bugs the other distributions found, both of which Debian could not have:

- The survey reported the first thing in the way and stopped, so on Fedora it
  asked to start podman.socket, and then -- having done it -- asked for the
  compose plugin. Needs are named now, not described, and reported together.

- apply used the survey taken before dependencies were installed, so on a
  machine that had no runtime at all it installed podman and then reached for
  docker. It re-surveys after resolving, and stops if containers still are
  not usable.

The lab takes DISTRO now: debian13, debian12, ubuntu2404, fedora, rocky9,
arch, each with its own disk and ssh port so several can be up at once. The
cases no longer say "docker" either. install-local passes on Debian 13,
Fedora 43 and Rocky 9 -- 20 checks each, ending with a sign-in to the webmail
the installer put there.
This commit is contained in:
2026-09-22 22:22:45 -07:00
parent 8725d8c11b
commit e55ff6b2df
14 changed files with 525 additions and 96 deletions
+33 -5
View File
@@ -114,27 +114,55 @@ type Availability struct {
Why string
}
// Available answers for one cell of the matrix.
// ServerGlibc is the C library the published server binary is linked
// against. It is built in a current Debian, so a host install of the server
// needs a distribution at least this new -- Debian 13, Ubuntu 24.04, Fedora
// 40 and Arch all are; Rocky 9, Debian 12 and Ubuntu 22.04 are not, and on
// those the container shape is the answer rather than a binary that cannot
// start.
const (
ServerGlibcMajor = 2
ServerGlibcMinor = 39
)
// Available answers for one cell of the matrix: can this machine, as it is,
// deliver this component in this shape? Everything the interface offers and
// everything a flag will accept comes through here, so an offer is never
// made that the machine cannot keep.
func Available(f host.Facts, c Component, s Shape) Availability {
switch s {
case Skip:
return Availability{OK: true}
case Container:
if !f.Docker.Present {
return Availability{Why: "docker is not installed"}
if !f.Runtime.Present {
return Availability{Why: "no container runtime: neither docker nor podman is installed"}
}
if !f.Docker.Usable {
return Availability{Why: f.Docker.Why}
if !f.Runtime.Usable {
return Availability{Why: f.Runtime.Why}
}
return Availability{OK: true}
case Host:
if !f.Systemd {
return Availability{Why: "a host install needs systemd, which is not running this machine"}
}
switch c {
case Server:
// The binary is downloaded, not built here, so the machine has
// to be able to run it.
if f.Glibc.Version == "" {
return Availability{Why: "this machine's C library could not be read, and the server binary is linked against glibc " +
fmt.Sprintf("%d.%d", ServerGlibcMajor, ServerGlibcMinor)}
}
if !f.Glibc.AtLeast(ServerGlibcMajor, ServerGlibcMinor) {
return Availability{Why: fmt.Sprintf(
"the server binary needs glibc %d.%d or newer and this machine has %s; run the server as a container here",
ServerGlibcMajor, ServerGlibcMinor, f.Glibc.Version)}
}
return Availability{OK: true}
case Console:
// Static files behind whatever serves them: nothing to run.
return Availability{OK: true}
case Webmail:
if !f.Node.Present {