Prove the distributions, and ask the runtime question at the right time
install-local now passes on Debian 13, Ubuntu 24.04, Fedora 43, Rocky 9 and Arch: twenty checks each, ending with a sign-in to the webmail the installer put there. Two of those five have no docker at all and went through podman, with the same compose file and the same plugin. The case had a bug the first four runs could not show. It chose between docker and podman once, at the top of the script -- on a machine that starts with neither and installs one halfway through. Debian passed because that run predates the helper; Fedora and Rocky passed because podman was the right answer anyway; Ubuntu was the first machine where the answer changed underneath it, and it drove compose at a podman socket that was never going to exist. The question is asked at each call now. Worth keeping in mind for the installer proper, which had the same shape of bug a day earlier: anything learned before dependencies are installed is learned too early.
This commit is contained in:
@@ -24,16 +24,19 @@ DIR=/var/lib/inbuxa
|
||||
# Whichever runtime this machine has. The installer picks docker where there
|
||||
# is one and podman on the Red Hat family; a case that says "docker" only
|
||||
# tests half the distributions it is run on.
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
RT=docker
|
||||
compose() { docker compose -f "$DIR/compose.yaml" "$@"; }
|
||||
else
|
||||
RT=podman
|
||||
#
|
||||
# Asked at each call, not once at the top: these cases start on a machine
|
||||
# with no runtime at all and install one along the way, so anything decided
|
||||
# up here is decided before the answer exists.
|
||||
rt() { command -v docker >/dev/null 2>&1 && echo docker || echo podman; }
|
||||
compose() {
|
||||
if [ "$(rt)" = docker ]; then
|
||||
docker compose -f "$DIR/compose.yaml" "$@"
|
||||
else
|
||||
DOCKER_HOST=unix:///run/podman/podman.sock \
|
||||
/usr/local/lib/docker/cli-plugins/docker-compose -f "$DIR/compose.yaml" "$@"
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
echo "==> installing"
|
||||
OUT="$(/tmp/inbuxa install --local --domain example.test --install-deps --yes 2>&1)"; rc=$?
|
||||
@@ -66,7 +69,7 @@ curl -fsS http://127.0.0.1:8080/api/health 2>/dev/null | grep -q '"ok":true' &&
|
||||
|
||||
echo
|
||||
echo "==> the bootstrap credential did not outlive the setup"
|
||||
ENVOUT="$($RT inspect --format '{{range .Config.Env}}{{println .}}{{end}}' "$(compose ps -q server)")"
|
||||
ENVOUT="$("$(rt)" inspect --format '{{range .Config.Env}}{{println .}}{{end}}' "$(compose ps -q server)")"
|
||||
grep -q "RECOVERY_ADMIN" <<<"$ENVOUT" && { bad "the server still carries a recovery admin"; echo "$ENVOUT" | grep RECOVERY | sed 's/^/ /'; } || ok "no recovery admin in the running server"
|
||||
grep -q "INBUXA_WEBMAIL_CLIENT_SECRET" <<<"$ENVOUT" && ok "the webmail's client secret is where it belongs" || bad "the server has no webmail client secret"
|
||||
|
||||
|
||||
@@ -30,16 +30,19 @@ DIR=/var/lib/inbuxa
|
||||
# Whichever runtime this machine has. The installer picks docker where there
|
||||
# is one and podman on the Red Hat family; a case that says "docker" only
|
||||
# tests half the distributions it is run on.
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
RT=docker
|
||||
compose() { docker compose -f "$DIR/compose.yaml" "$@"; }
|
||||
else
|
||||
RT=podman
|
||||
#
|
||||
# Asked at each call, not once at the top: these cases start on a machine
|
||||
# with no runtime at all and install one along the way, so anything decided
|
||||
# up here is decided before the answer exists.
|
||||
rt() { command -v docker >/dev/null 2>&1 && echo docker || echo podman; }
|
||||
compose() {
|
||||
if [ "$(rt)" = docker ]; then
|
||||
docker compose -f "$DIR/compose.yaml" "$@"
|
||||
else
|
||||
DOCKER_HOST=unix:///run/podman/podman.sock \
|
||||
/usr/local/lib/docker/cli-plugins/docker-compose -f "$DIR/compose.yaml" "$@"
|
||||
}
|
||||
fi
|
||||
}
|
||||
WORK=/tmp/lab
|
||||
LABNET=inbuxa-e2e
|
||||
LABSUBNET=172.31.254.0/24
|
||||
@@ -159,7 +162,7 @@ CODE=$(curl -s -o /dev/null -w '%{http_code}' --cacert "$WORK/chain.pem" --resol
|
||||
|
||||
echo
|
||||
echo "==> and nothing was left behind that should not be"
|
||||
ENVOUT="$($RT inspect --format '{{range .Config.Env}}{{println .}}{{end}}' "$(compose ps -q server)")"
|
||||
ENVOUT="$("$(rt)" inspect --format '{{range .Config.Env}}{{println .}}{{end}}' "$(compose ps -q server)")"
|
||||
grep -q "RECOVERY_ADMIN" <<<"$ENVOUT" && bad "the server still carries a recovery admin" || ok "no recovery admin on the server"
|
||||
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user