@crvouga/homelab 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mise/locks/npm-wrangler/{4.170.0 → 4.171.0}/aube-lock.yaml +46 -46
- package/.mise/locks/npm-wrangler/{4.170.0 → 4.171.0}/package.json +1 -1
- package/ansible/monitoring/README.md +7 -0
- package/ansible/ubuntu/baseline.yml +2 -14
- package/ansible/ubuntu/policy.json +2 -1
- package/ansible/ubuntu/recovery.yml +1 -1
- package/ansible/ubuntu/t3-boot-readiness.py +38 -0
- package/ansible/ubuntu/t3-desktop.yml +2 -13
- package/ansible/ubuntu/t3-headless.yml +2 -0
- package/ansible/ubuntu/t3-health.sh +13 -40
- package/ansible/ubuntu/tasks/check-legacy-t3.yml +17 -0
- package/ansible/ubuntu/tasks/recovery.yml +30 -3
- package/ansible/ubuntu/tasks/retire-agent-launchers.yml +14 -0
- package/docs/runbooks.md +9 -4
- package/docs/ubuntu-sync.md +14 -14
- package/docs/worker-contract.md +23 -8
- package/mise.lock +3 -3
- package/mise.toml +1 -1
- package/package.json +2 -2
- package/schema/check-ids.json +1 -1
- package/src/check-registry.ts +1 -1
- package/src/platform/t3-service.ts +12 -1
- package/src/t3-linked-check.ts +153 -13
- package/src/worker-activity.ts +43 -7
- package/src/worker-host-checks.ts +22 -35
|
@@ -204,7 +204,7 @@ async function recoveryChecks(
|
|
|
204
204
|
: 'The T3 desktop app runs as an enabled session service with automatic crash recovery.'
|
|
205
205
|
)
|
|
206
206
|
);
|
|
207
|
-
checks.push(await t3HealthCheck(run
|
|
207
|
+
checks.push(await t3HealthCheck(run));
|
|
208
208
|
checks.push(await wipGuardCheck(run));
|
|
209
209
|
checks.push(await t3StabilityCheck(run, userInfo().homedir));
|
|
210
210
|
checks.push(
|
|
@@ -269,32 +269,21 @@ export async function serviceRecoveryCheck(run: Runner): Promise<Check> {
|
|
|
269
269
|
);
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
/**
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
): Promise<number | null> {
|
|
278
|
-
const started = await run([
|
|
279
|
-
'systemctl',
|
|
280
|
-
'--user',
|
|
281
|
-
'show',
|
|
282
|
-
'--property=ActiveEnterTimestampMonotonic',
|
|
283
|
-
'--value',
|
|
284
|
-
t3Unit(session),
|
|
272
|
+
/** The retained first successful loopback probe, measured from this boot. */
|
|
273
|
+
async function bootToServingSeconds(run: Runner): Promise<number | null> {
|
|
274
|
+
const marker = await run([
|
|
275
|
+
'cat',
|
|
276
|
+
`/run/user/${userInfo().uid}/personal-t3-boot-readiness-ms`,
|
|
285
277
|
]);
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
278
|
+
const value = marker.stdout.trim();
|
|
279
|
+
const milliseconds = Number(value);
|
|
280
|
+
return marker.ok && /^\d+$/.test(value) && Number.isSafeInteger(milliseconds)
|
|
281
|
+
? milliseconds / 1000
|
|
282
|
+
: null;
|
|
290
283
|
}
|
|
291
284
|
|
|
292
|
-
/**
|
|
293
|
-
|
|
294
|
-
export async function t3HealthCheck(
|
|
295
|
-
run: Runner,
|
|
296
|
-
session: 'desktop' | 'headless' = 'desktop'
|
|
297
|
-
): Promise<Check> {
|
|
285
|
+
/** Check the current server independently of the boot readiness record. */
|
|
286
|
+
export async function t3HealthCheck(run: Runner): Promise<Check> {
|
|
298
287
|
const probe = await run(
|
|
299
288
|
[
|
|
300
289
|
'curl',
|
|
@@ -307,9 +296,7 @@ export async function t3HealthCheck(
|
|
|
307
296
|
{ timeoutMs: 15_000 }
|
|
308
297
|
);
|
|
309
298
|
const answers = probe.ok && hasEnvironmentIdentity(probe.stdout);
|
|
310
|
-
const boot = answers
|
|
311
|
-
? await bootServing(run, session)
|
|
312
|
-
: { late: false, summary: '' };
|
|
299
|
+
const boot = answers ? await bootServing(run) : { late: false, summary: '' };
|
|
313
300
|
const ok = answers && !boot.late;
|
|
314
301
|
return {
|
|
315
302
|
id: 'worker:t3-health',
|
|
@@ -321,7 +308,7 @@ export async function t3HealthCheck(
|
|
|
321
308
|
? {
|
|
322
309
|
remedy: {
|
|
323
310
|
action: boot.late
|
|
324
|
-
? 'The T3
|
|
311
|
+
? 'The first successful T3 loopback probe was later than t3Service.bootServingSeconds in ansible/ubuntu/policy.json. Read the journal of the T3 unit and of personal-worker-recovery for what delayed the start after boot.'
|
|
325
312
|
: 'Apply the approved converge revision over verified SSH, then rerun check --workers. No password prompt or state reset is attempted by health.',
|
|
326
313
|
},
|
|
327
314
|
}
|
|
@@ -342,22 +329,22 @@ function hasEnvironmentIdentity(response: string): boolean {
|
|
|
342
329
|
}
|
|
343
330
|
}
|
|
344
331
|
|
|
345
|
-
/** Compare the
|
|
332
|
+
/** Compare the first successful loopback probe with the boot-serving deadline. */
|
|
346
333
|
async function bootServing(
|
|
347
|
-
run: Runner
|
|
348
|
-
session: 'desktop' | 'headless'
|
|
334
|
+
run: Runner
|
|
349
335
|
): Promise<{ late: boolean; summary: string }> {
|
|
350
336
|
const limit = policy.t3Service.bootServingSeconds;
|
|
351
|
-
const serving = await bootToServingSeconds(run
|
|
352
|
-
if (serving === null)
|
|
337
|
+
const serving = await bootToServingSeconds(run);
|
|
338
|
+
if (serving === null)
|
|
339
|
+
return { late: false, summary: ' Boot readiness was not measured.' };
|
|
353
340
|
if (serving > limit)
|
|
354
341
|
return {
|
|
355
342
|
late: true,
|
|
356
|
-
summary: `T3_BOOT_SERVING_LATE: The T3
|
|
343
|
+
summary: `T3_BOOT_SERVING_LATE: The first successful T3 loopback probe was ${serving} seconds after boot, past the ${limit} seconds a worker is given to serve after a power loss.`,
|
|
357
344
|
};
|
|
358
345
|
return {
|
|
359
346
|
late: false,
|
|
360
|
-
summary: ` The T3
|
|
347
|
+
summary: ` The first successful T3 loopback probe was ${serving} seconds after boot (at most ${limit}).`,
|
|
361
348
|
};
|
|
362
349
|
}
|
|
363
350
|
|