The one-node bed supervises the host as a service, so reboot is a real check
Installs the shipped nox-mesh-host launcher and unit in the machine and lets the installer's --host-service start and enable it, instead of --host-in-background which cannot survive a reboot. E2 now proves the mesh comes back on its own. Claude-Session: https://claude.ai/code/session_01D6qtiYU3P9jk3pnAXyAFyx
This commit is contained in:
@@ -16,7 +16,8 @@ import { execFileSync } from "node:child_process";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { exec, instanceNameOf, push } from "../../src/lifecycle/operate.ts";
|
||||
import { placeBootstrap, BOOTSTRAP_PATH, HOST_PATH } from "../../src/lifecycle/place.ts";
|
||||
import { placeBootstrap, installHostService, BOOTSTRAP_PATH, HOST_PATH } from "../../src/lifecycle/place.ts";
|
||||
import { dirname } from "node:path";
|
||||
|
||||
/** What genesis did, or where it stopped. */
|
||||
export interface GenesisResult {
|
||||
@@ -72,6 +73,11 @@ export interface GenesisOptions {
|
||||
/** The site the anchor is placed at on the private network. Must match how the operator/test
|
||||
* places it afterwards, or the first re-place changes the overlay and recreates the control plane. */
|
||||
site?: string;
|
||||
/** Supervise the host as a systemd service (the real install path) instead of --host-in-background,
|
||||
* so it survives a reboot. Needs hostBinary to locate the packaging. */
|
||||
hostService?: boolean;
|
||||
/** The built mesh-host binary on this workstation; its repo's packaging/ dir supplies the unit. */
|
||||
hostBinary?: string;
|
||||
/** What of the catalogue to build. A branch under test is the usual reason this is not main. */
|
||||
catalogRef?: string;
|
||||
log?: (m: string) => void;
|
||||
@@ -145,6 +151,16 @@ export async function genesis(o: GenesisOptions): Promise<GenesisResult> {
|
||||
writeFileSync(local, o.bundleTemplate);
|
||||
await push(o.instanceId, node, local, "/tmp/substrate-template.lock");
|
||||
|
||||
// Supervise the host as a service (the real install path) when asked — the only way it survives a
|
||||
// reboot. Installs the shipped packaging in the machine, then lets --host-service start+enable it.
|
||||
if (o.hostService) {
|
||||
if (!o.hostBinary) {
|
||||
return stop("preparing the host service", "hostService needs hostBinary to find the packaging");
|
||||
}
|
||||
await installHostService(name, node, join(dirname(o.hostBinary), "packaging"), (m) => log(`genesis:${m}`));
|
||||
report.push(` host supervised by nox-mesh-host.service`);
|
||||
}
|
||||
|
||||
const command = [
|
||||
BOOTSTRAP_PATH,
|
||||
`--source ${o.source}`,
|
||||
@@ -166,9 +182,9 @@ export async function genesis(o: GenesisOptions): Promise<GenesisResult> {
|
||||
`--private-network wireguard`,
|
||||
`--packet-filter nftables`,
|
||||
`--host ${HOST_PATH}`,
|
||||
// The lab has no unit to supervise the host with, and the installer refuses to invent one — a
|
||||
// unit file is a packaging decision. A host started this way does not survive a reboot.
|
||||
`--host-in-background`,
|
||||
// A service when the packaging was installed above (survives a reboot); otherwise the
|
||||
// background process, which does not — the installer refuses to invent a unit either way.
|
||||
...(o.hostService ? [] as string[] : [`--host-in-background`]),
|
||||
].join(" ");
|
||||
|
||||
// Run up to three times. Not to paper over a failure — every attempt's failing step is printed —
|
||||
|
||||
@@ -492,6 +492,9 @@ before(async () => {
|
||||
// The same site N1 re-places the anchor at, so N1 is a no-op and the control plane is not
|
||||
// recreated mid-test (its --add-host would otherwise change).
|
||||
site: "hosting",
|
||||
// Supervise the host as a service so it survives the reboot check (E2).
|
||||
hostService: true,
|
||||
hostBinary: binary,
|
||||
log: (m) => console.log(m),
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user