Refusing because Docker is absent is not help. It is a chore handed back to the operator, who will then install it however the first search result says to -- which is how machines end up with a third-party apt repository and a signing key nobody chose. So the installer offers. It says what it would do, in the same words the plan uses, and does it only when told: --install-deps during a run, or "inbuxa deps --install" on its own for someone preparing a machine before they have a domain to give it. What it installs, and from where, is the part worth arguing about: - the Docker daemon: the distribution's own package. One package from an archive the machine already trusts beats a new source. - the Compose plugin: Debian's docker.io ships no compose v2 at all, so this is Docker's official static build, pinned by version with its checksum in the source beside it. - Node: the official tarball into /opt/inbuxa/node, deliberately off PATH so it runs the webmail's unit and nothing else. Every download is checked before it is put in place; a checksum that does not match stops the step rather than warning and carrying on. Tested from a bare Debian 13 in the lab: 25 checks, ending with docker and compose answering, node 22 where the unit will look for it, and the installer agreeing that nothing is missing any more. The last of those failed the first time -- the survey looked for node on PATH only, and so could not see the one it had just installed.
77 lines
3.7 KiB
Bash
77 lines
3.7 KiB
Bash
#!/bin/bash
|
|
# SPDX-FileCopyrightText: 2026 Coffey Labs
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
#
|
|
# The offer: when a shape needs something this machine has not got, does the
|
|
# installer say what it would do, and then actually do it?
|
|
#
|
|
# Starts on a machine with neither Docker nor Node, which is the case worth
|
|
# proving: refusing there is easy and useless. By the end, containers work
|
|
# and a host install of the webmail has a Node to run on -- all of it fetched
|
|
# against pinned checksums.
|
|
#
|
|
# Run from the host with: e2e/vm/run.sh e2e/cases/deps.sh
|
|
set -uo pipefail
|
|
|
|
pass=0; fail=0
|
|
ok() { echo " ok $*"; pass=$((pass+1)); }
|
|
bad() { echo " FAIL $*"; fail=$((fail+1)); }
|
|
has() { grep -q -- "$2" <<<"$1" && ok "$3" || { bad "$3"; echo "$1" | sed 's/^/ /'; }; }
|
|
|
|
echo "==> a machine with nothing on it is told what is missing"
|
|
OUT="$(/tmp/inbuxa deps --console skip --webmail skip 2>&1)"; rc=$?
|
|
echo "$OUT" | sed 's/^/ /'
|
|
[ $rc -eq 0 ] && ok "saying so is not an error (exit 0)" || bad "exit $rc"
|
|
has "$OUT" "docker is missing" "names docker"
|
|
has "$OUT" "compose is missing" "names the compose plugin"
|
|
has "$OUT" "from the distribution's own archive" "says where docker comes from"
|
|
has "$OUT" "pinned checksum" "says the download is checked"
|
|
has "$OUT" "Pass --install to do it" "offers to do it"
|
|
command -v docker >/dev/null && bad "docker appeared without being asked for" || ok "nothing installed yet"
|
|
|
|
echo
|
|
echo "==> the refusal to install carries the same offer"
|
|
OUT="$(/tmp/inbuxa install --domain example.test --console skip --webmail skip 2>&1)"; rc=$?
|
|
[ $rc -ne 0 ] && ok "still refuses to install (exit $rc)" || bad "should have refused"
|
|
has "$OUT" "The installer can fix that" "but offers the fix"
|
|
has "$OUT" "Pass --install-deps" "and says how to accept"
|
|
|
|
echo
|
|
echo "==> the plan, once the offer is accepted, has a step for it"
|
|
OUT="$(/tmp/inbuxa install --domain example.test --console skip --webmail skip --install-deps --dry-run 2>&1)"; rc=$?
|
|
[ $rc -eq 0 ] && ok "accepted (exit 0)" || { bad "exit $rc"; echo "$OUT" | sed 's/^/ /'; }
|
|
has "$OUT" "Install what this machine is missing" "the first step is the fix"
|
|
has "$OUT" "docker: install docker.io" "which names the package"
|
|
has "$OUT" "Start the mail server as a container" "and the install goes on as a container install"
|
|
|
|
echo
|
|
echo "==> doing it"
|
|
OUT="$(/tmp/inbuxa deps --console skip --webmail skip --install 2>&1)"; rc=$?
|
|
echo "$OUT" | tail -20 | sed 's/^/ /'
|
|
[ $rc -eq 0 ] && ok "installed (exit 0)" || bad "exit $rc"
|
|
has "$OUT" "checksum ok" "checked what it downloaded"
|
|
has "$OUT" "docker usable" "and says the machine can do containers now"
|
|
|
|
docker version >/dev/null 2>&1 && ok "docker answers" || bad "docker does not answer"
|
|
docker compose version >/dev/null 2>&1 && ok "compose v2 answers" || bad "compose does not answer"
|
|
systemctl is-enabled docker >/dev/null 2>&1 && ok "docker is enabled at boot" || bad "docker is not enabled"
|
|
|
|
echo
|
|
echo "==> node, for a host install of the webmail"
|
|
OUT="$(/tmp/inbuxa deps --server skip --console skip --webmail host --install 2>&1)"; rc=$?
|
|
echo "$OUT" | head -12 | sed 's/^/ /'
|
|
[ $rc -eq 0 ] && ok "installed (exit 0)" || bad "exit $rc"
|
|
has "$OUT" "checksum ok" "checked the tarball"
|
|
V="$(/opt/inbuxa/node/bin/node --version 2>/dev/null)"
|
|
[[ "$V" == v22.* ]] && ok "node $V is in /opt/inbuxa/node" || bad "no usable node in /opt/inbuxa/node (got '$V')"
|
|
command -v node >/dev/null && bad "it put node on PATH; it should stay out of the way" || ok "it stayed out of PATH"
|
|
|
|
echo
|
|
echo "==> and now nothing is missing"
|
|
OUT="$(/tmp/inbuxa deps --server container --console container --webmail host 2>&1)"
|
|
has "$OUT" "Nothing is missing" "says so"
|
|
|
|
echo
|
|
echo "==> $pass passed, $fail failed"
|
|
[ "$fail" -eq 0 ]
|