Hub 2.5.0: a New install of Events 3.x installs the church's Accounts first

A release's "requires accounts" is met at install: Accounts then the
product in one batch (the product runs only after Accounts succeeded; a
failed Accounts fails the product's record and frees its ports). Accounts
domain from the form, or accounts.<rest of the domain>. An Accounts older
than required is refused. Contracts 1.8.0 vendored. 4 new tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 14:17:58 +02:00
co-authored by Claude Opus 5.5
parent 575c0cac68
commit 05d043e0a3
10 changed files with 172 additions and 24 deletions
@@ -13,7 +13,7 @@ type Msg = { type: "ok" | "err"; text: string } | null;
type Customer = { id: string; name: string; domain?: string | null };
type InstallRow = { id: string; name: string; url: string; customer: { id: string; name: string } | null; version: string | null };
const emptyNew = { product: "events", customerId: "", serverId: "", shortName: "", domain: "", timezone: "", adminName: "", adminEmail: "", version: "" };
const emptyNew = { product: "events", customerId: "", serverId: "", shortName: "", domain: "", accountsDomain: "", timezone: "", adminName: "", adminEmail: "", version: "" };
const emptyLink = { installId: "", serverId: "", shortName: "", webPort: "", apiPort: "" };
/** Installs on servers: New install (§7) and linking existing installs (§14). */
@@ -44,8 +44,10 @@ export default function InstallsPage() {
setBusy(true);
setMsg(null);
try {
const r = await api<{ deployment: Deployment; warnings: string[] }>("/api/admin/deployments", { method: "POST", body: { ...form, version: form.version || undefined } });
router.push(`/servers/installs/${r.deployment.id}${r.warnings.length ? `?warn=${encodeURIComponent(r.warnings.join(" "))}` : ""}`);
const r = await api<{ deployment: Deployment; warnings: string[]; alsoInstalling?: { product: string; domain: string; version: string } }>("/api/admin/deployments", { method: "POST", body: { ...form, version: form.version || undefined, accountsDomain: form.accountsDomain || undefined } });
// Hub 2.5.0: Cross Events 3.x for a church without Accounts installs Accounts first.
const notes = [...(r.alsoInstalling ? [`Accounts ${r.alsoInstalling.version} is installed first at ${r.alsoInstalling.domain}; Cross Events follows when it has finished.`] : []), ...r.warnings];
router.push(`/servers/installs/${r.deployment.id}${notes.length ? `?warn=${encodeURIComponent(notes.join(" "))}` : ""}`);
} catch (err) { setMsg({ type: "err", text: errorText(err) }); }
setBusy(false);
};
@@ -87,6 +89,9 @@ export default function InstallsPage() {
<div><label className="label" htmlFor="n-cust">Customer</label><select id="n-cust" className="input" required {...f("customerId")}><option value="">Choose…</option>{customers.map(c => <option key={c.id} value={c.id}>{c.name}</option>)}</select></div>
<div><label className="label" htmlFor="n-short">Short name</label><input id="n-short" className="input" required pattern="[a-z][a-z0-9-]{1,30}" placeholder="hope" {...f("shortName")} /><p className="mt-1 text-xs text-slate-500">Folders, database and tunnels: a-z, 0-9 and -.</p></div>
<div><label className="label" htmlFor="n-domain">Domain</label><input id="n-domain" className="input" required placeholder={form.product === "accounts" ? "accounts.hope.co.za" : "events.hope.co.za"} {...f("domain")} /></div>
{form.product === "events" && (
<div><label className="label" htmlFor="n-acc">Accounts domain</label><input id="n-acc" className="input" placeholder={form.domain ? form.domain.replace(/^[^.]+./, "accounts.") : "accounts.hope.co.za"} {...f("accountsDomain")} /><p className="mt-1 text-xs text-slate-500">Cross Events 3 signs in through the church&apos;s Accounts: a church without it gets it installed first, here.</p></div>
)}
<div><label className="label" htmlFor="n-tz">Time zone</label><input id="n-tz" className="input" placeholder="Africa/Johannesburg" {...f("timezone")} /></div>
<div><label className="label" htmlFor="n-an">Site admin name</label><input id="n-an" className="input" {...f("adminName")} /></div>
<div><label className="label" htmlFor="n-ae">Site admin email</label><input id="n-ae" type="email" className="input" {...f("adminEmail")} /><p className="mt-1 text-xs text-slate-500">Gets the welcome email and update notices.</p></div>