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:
+34
-7
@@ -15,6 +15,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/apply"
|
||||
@@ -60,6 +61,20 @@ deps flags:
|
||||
`
|
||||
|
||||
func main() {
|
||||
// The three programs are Linux services: systemd units, a container
|
||||
// runtime, /etc and /var. This binary compiles for macOS and Windows
|
||||
// because Go will compile it for anything, and on either it would read
|
||||
// no /etc/os-release, find no systemd, and report a machine that does
|
||||
// not exist. Saying so is the only honest thing it can do there.
|
||||
if runtime.GOOS != "linux" {
|
||||
fmt.Fprintf(os.Stderr,
|
||||
"inbuxa installs on Linux, and this is %s.\n\n"+
|
||||
"The mail server, the console and the webmail are Linux services. To try them\n"+
|
||||
"on this machine, run them in containers with Docker or Podman Desktop; to\n"+
|
||||
"install them, run this on the Linux machine that will host them.\n",
|
||||
runtime.GOOS)
|
||||
os.Exit(2)
|
||||
}
|
||||
if len(os.Args) < 2 {
|
||||
// The interface is the no-argument case. Until it lands, say so
|
||||
// plainly rather than pretending: a half-built screen is worse than
|
||||
@@ -145,7 +160,7 @@ func install(args []string) int {
|
||||
|
||||
fmt.Println("\nApplying:")
|
||||
log := &printer{}
|
||||
res, err := apply.Run(context.Background(), p, log)
|
||||
res, err := apply.Run(context.Background(), p, f, log)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "\nstopped: "+err.Error())
|
||||
return 1
|
||||
@@ -285,14 +300,26 @@ func render(f host.Facts) string {
|
||||
fmt.Fprintf(&b, " %-22s %d GB free\n", "disk", f.DiskFreeGB)
|
||||
}
|
||||
|
||||
docker := "not installed"
|
||||
runtime := "none: neither docker nor podman is installed"
|
||||
switch {
|
||||
case f.Docker.Usable:
|
||||
docker = "usable, server " + f.Docker.Version + ", compose " + f.Docker.Compose
|
||||
case f.Docker.Present:
|
||||
docker = "installed but not usable: " + f.Docker.Why
|
||||
case f.Runtime.Usable:
|
||||
runtime = f.Runtime.Kind + " " + f.Runtime.Version + ", compose " + f.Runtime.Compose
|
||||
if f.Runtime.Socket != "" {
|
||||
runtime += ", at " + f.Runtime.Socket
|
||||
}
|
||||
case f.Runtime.Present:
|
||||
runtime = f.Runtime.Kind + " installed but not usable: " + f.Runtime.Why
|
||||
}
|
||||
fmt.Fprintf(&b, " %-22s %s\n", "docker", docker)
|
||||
fmt.Fprintf(&b, " %-22s %s\n", "container runtime", runtime)
|
||||
|
||||
glibc := "could not be read"
|
||||
if f.Glibc.Version != "" {
|
||||
glibc = f.Glibc.Version
|
||||
if !f.Glibc.AtLeast(plan.ServerGlibcMajor, plan.ServerGlibcMinor) {
|
||||
glibc += fmt.Sprintf(" (older than the %d.%d the server binary needs)", plan.ServerGlibcMajor, plan.ServerGlibcMinor)
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(&b, " %-22s %s\n", "glibc", glibc)
|
||||
|
||||
node := "not installed"
|
||||
switch {
|
||||
|
||||
Reference in New Issue
Block a user