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:
+15
-2
@@ -30,6 +30,7 @@ import (
|
||||
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/compose"
|
||||
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/deps"
|
||||
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/docker"
|
||||
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/host"
|
||||
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/jmap"
|
||||
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/plan"
|
||||
)
|
||||
@@ -70,7 +71,7 @@ type Log interface {
|
||||
|
||||
// Run carries out p. It refuses anything but container shapes for now, and
|
||||
// says so rather than pretending a host install happened.
|
||||
func Run(ctx context.Context, p plan.Plan, log Log) (*Result, error) {
|
||||
func Run(ctx context.Context, p plan.Plan, f host.Facts, log Log) (*Result, error) {
|
||||
o := p.Options
|
||||
for _, c := range []plan.Component{plan.Server, plan.Console, plan.Webmail} {
|
||||
if o.Shape(c) == plan.Host {
|
||||
@@ -86,6 +87,15 @@ func Run(ctx context.Context, p plan.Plan, log Log) (*Result, error) {
|
||||
if err := deps.Resolve(ctx, log.Out(), p.Needs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// The survey was taken before any of that existed. Installing podman
|
||||
// on a machine that had no runtime and then driving the deployment
|
||||
// with the old facts meant reaching for a docker that was never
|
||||
// going to be there.
|
||||
f = host.Survey(ctx)
|
||||
if !f.Runtime.Usable {
|
||||
return nil, fmt.Errorf("after installing what was missing, containers still are not usable: %s", f.Runtime.Why)
|
||||
}
|
||||
log.Info("using %s %s", f.Runtime.Kind, f.Runtime.Version)
|
||||
}
|
||||
|
||||
dir := o.Dir
|
||||
@@ -165,7 +175,10 @@ func Run(ctx context.Context, p plan.Plan, log Log) (*Result, error) {
|
||||
}
|
||||
log.Info("compose.yaml, .env%s", map[bool]string{true: " and Caddyfile", false: ""}[stack.Proxy])
|
||||
|
||||
cmp := docker.Compose{Dir: dir}
|
||||
// Whichever runtime the survey found: docker where there is one, podman
|
||||
// on the Red Hat family, driven through the same compose plugin.
|
||||
docker.UseRuntime(f.Runtime)
|
||||
cmp := docker.Compose{Dir: dir, Runtime: f.Runtime}
|
||||
|
||||
log.Step("fetching the images")
|
||||
if err := cmp.Run(ctx, "pull", "--quiet"); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user