Files
inbuxa-installer/e2e/vm/run.sh
T
jcoffey-dev 39510246f0 inbuxa join: the console and the webmail here, for a server elsewhere
`inbuxa join https://mail.example.com --key KEY` installs the front ends on
this machine for a mail server already running on another one. That server
is reached only over its own HTTPS, with an API key a server administrator
made in the console (--key -, or INBUXA_JOIN_KEY, keeps it out of the
shell's history; it is never written down). Through it the front ends'
addresses and a webmail client secret made here go into the server's
inbuxa:FrontEnds (server #195), which registers their sign-in and allows
the console's origin on every node, with no restart and nothing done by
hand on that machine.

It asks first, dry runs included, and refuses with the reason when the key
is wrong, the server has no inbuxa:FrontEnds, it already lists other front
ends (--replace), or its environment owns the webmail's secret. Then it
installs the console and the webmail in containers with Caddy, registers
them, exempts the webmail's address from the server's auto-ban (what its
name resolves to, loopback for a loopback server, or --exempt-address),
and checks that the server lets the console call it. A second join with
the same addresses converges.

The compose file learns a server elsewhere: the webmail reaches it at its
address, and Caddy serves only the front ends' names. Container and
host-server installs render as before.

INBUXA_SERVER_BINARY installs a server build instead of the release
wherever the server goes on the host, for testing a server change before
it is released; e2e/vm/run.sh passes one in with SERVER_BINARY=.

e2e/cases/join.sh: 24 checks on Debian 13 against a build of server #195,
ending with a person signing in to the joined webmail. install-local,
install-host, install-public, status-export and topology pass unchanged.
2026-10-11 23:22:39 -07:00

54 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# SPDX-FileCopyrightText: 2026 Coffey Labs LLC
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Build the installer, copy it into the lab machine, and run a case there.
#
# e2e/vm/run.sh e2e/cases/containers.sh rewind, then run that case
# KEEP=1 e2e/vm/run.sh e2e/cases/hosts.sh run it on the machine as it is
#
# The rewind is the point: every case starts on an identical machine, so a
# failure is the installer's and not the last run's leftovers.
set -euo pipefail
CASE="${1:?usage: run.sh e2e/cases/<case>.sh}"
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
. "$(dirname "$0")/lib.sh"
DISTRO="${DISTRO:-debian13}"
LAB="${LAB:-$HOME/.cache/inbuxa-lab/$DISTRO}"
MEM="${MEM:-4096}"; VCPUS="${VCPUS:-2}"; SSH_PORT="${SSH_PORT:-$(distro_port "$DISTRO")}"
DISK="$LAB/lab.qcow2"; CLEAN="$LAB/lab-clean.qcow2"; SEED="$LAB/seed.iso"
LOG="$LAB/console.log"; PIDFILE="$LAB/qemu.pid"
[ -f "$ROOT/$CASE" ] || { echo "no such case: $CASE" >&2; exit 1; }
[ "${KEEP:-}" = 1 ] || "$(dirname "$0")/reset.sh"
vm_running || { echo "the lab is not up -- run e2e/vm/up.sh" >&2; exit 1; }
echo "==> building the installer"
(cd "$ROOT" && GOOS=linux GOARCH=amd64 go build -o "$LAB/inbuxa" ./cmd/inbuxa)
# An upgrade case needs the installer as it was, too: OLD_REF builds that
# commit as /tmp/inbuxa-old.
if [ -n "${OLD_REF:-}" ]; then
echo "==> building the installer at $OLD_REF"
OLD_SRC="$(mktemp -d)"
(cd "$ROOT" && git archive "$OLD_REF" | tar -x -C "$OLD_SRC")
(cd "$OLD_SRC" && GOOS=linux GOARCH=amd64 go build -o "$LAB/inbuxa-old" ./cmd/inbuxa)
rm -rf "$OLD_SRC"
fi
echo "==> copying it in"
vm_scp "$LAB/inbuxa" [email protected]:/tmp/inbuxa >/dev/null
# A server build to install instead of the release (INBUXA_SERVER_BINARY in
# the case), for testing a server change before it is released.
if [ -n "${SERVER_BINARY:-}" ]; then
vm_scp "$SERVER_BINARY" [email protected]:/tmp/inbuxa-server-test >/dev/null
vm_ssh 'chmod +x /tmp/inbuxa-server-test'
fi
[ -z "${OLD_REF:-}" ] || vm_scp "$LAB/inbuxa-old" [email protected]:/tmp/inbuxa-old >/dev/null
vm_scp "$ROOT/$CASE" [email protected]:/tmp/case.sh >/dev/null
vm_ssh 'chmod +x /tmp/inbuxa /tmp/case.sh; [ ! -f /tmp/inbuxa-old ] || chmod +x /tmp/inbuxa-old'
echo "==> running $(basename "$CASE")"
vm_ssh 'sudo -E bash /tmp/case.sh'