@crvouga/homelab 0.23.2 → 0.23.4
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/azure-cli/2.93.0~a837e014/uv.lock +4 -4
- package/.mise/locks/npm-modelcontextprotocol-inspector/2.17.0~4c109bea/aube-lock.yaml +109 -154
- package/.mise/locks/npm-vercel/68.0.0/aube-lock.yaml +14 -14
- package/ansible/macos/manager.yml +124 -0
- package/ansible/macos/policy.json +52 -1
- package/ansible/macos/tasks/legacy-agent.yml +40 -0
- package/ansible/ubuntu/disk-gc.py +101 -4
- package/ansible/ubuntu/disk-guard.py +21 -12
- package/ansible/ubuntu/policy.json +3 -1
- package/ansible/ubuntu/tasks/resources.yml +2 -2
- package/ansible/uv.lock +21 -21
- package/cliproxy/README.md +2 -2
- package/cliproxy/docs/deployment.svg +1 -1
- package/cliproxy/launchd/dev.homelab.cliproxy-backup.plist +0 -12
- package/cliproxy/scripts/external-health.py +2 -2
- package/cliproxy/scripts/monitor +2 -2
- package/cliproxy/systemd/cliproxy-backup.timer +2 -2
- package/docs/runbooks.md +12 -1
- package/docs/worker-contract.md +24 -0
- package/mise.lock +1115 -53
- package/mise.toml +1 -1
- package/package.json +2 -2
- package/schema/check-ids.json +16 -0
- package/src/check-registry.ts +6 -0
- package/src/disk-gc-report.ts +20 -0
- package/src/manager-health.ts +95 -4
- package/src/worker-reboot.ts +3 -7
package/mise.toml
CHANGED
|
@@ -57,7 +57,7 @@ copilot = "1.0.114"
|
|
|
57
57
|
"http:antigravity" = { version = "1.5.18", bin = "antigravity", platforms = { linux-x64 = { url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.18-6386224290725888/linux-x64/cli_linux_x64.tar.gz" }, linux-arm64 = { url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.18-6386224290725888/linux-arm/cli_linux_arm64.tar.gz" }, macos-x64 = { url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.18-6386224290725888/darwin-x64/cli_mac_x64.tar.gz" }, macos-arm64 = { url = "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.18-6386224290725888/darwin-arm/cli_mac_arm64.tar.gz" } }, os = ["linux", "macos"] }
|
|
58
58
|
"http:cursor-agent" = { version = "2026.11.22-e9042b2", bin = "cursor-agent", bin_path = "dist-package", os = ["linux", "macos"], platforms = { linux-x64 = { url = "https://downloads.cursor.com/lab/{{version}}/linux/x64/agent-cli-package.tar.gz" }, linux-arm64 = { url = "https://downloads.cursor.com/lab/{{version}}/linux/arm64/agent-cli-package.tar.gz" }, macos-x64 = { url = "https://downloads.cursor.com/lab/{{version}}/darwin/x64/agent-cli-package.tar.gz" }, macos-arm64 = { url = "https://downloads.cursor.com/lab/{{version}}/darwin/arm64/agent-cli-package.tar.gz" } } }
|
|
59
59
|
|
|
60
|
-
"aws" = { version = "2.42.
|
|
60
|
+
"aws" = { version = "2.42.6", os = ["linux", "macos"] }
|
|
61
61
|
"rust" = "1.100.1"
|
|
62
62
|
"cmake" = "4.5.1"
|
|
63
63
|
"ninja" = "1.13.2"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/homelab",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.4",
|
|
4
4
|
"description": "Keeps a set of development machines in sync: one manager and many workers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "github:crvouga/homelab",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=22"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "33f827833d26e123aed517782048aa37fa7c5641"
|
|
77
77
|
}
|
package/schema/check-ids.json
CHANGED
|
@@ -971,6 +971,14 @@
|
|
|
971
971
|
"manual": "The manager converges itself in converge; what needs an administrator is granted once with ansible-playbook -e user=$(id -un) -K ansible/macos/manager-privilege.yml."
|
|
972
972
|
}
|
|
973
973
|
},
|
|
974
|
+
{
|
|
975
|
+
"id": "manager:legacy-agents",
|
|
976
|
+
"meaning": "No legacy manager LaunchAgent with a supported replacement remains installed or loaded.",
|
|
977
|
+
"severity": "advisory",
|
|
978
|
+
"repair": {
|
|
979
|
+
"manual": "The manager converges itself in converge; what needs an administrator is granted once with ansible-playbook -e user=$(id -un) -K ansible/macos/manager-privilege.yml."
|
|
980
|
+
}
|
|
981
|
+
},
|
|
974
982
|
{
|
|
975
983
|
"id": "manager:playbook",
|
|
976
984
|
"meaning": "The manager playbook passed its check-mode run and was applied, or is unchanged since and its postconditions hold.",
|
|
@@ -1003,6 +1011,14 @@
|
|
|
1003
1011
|
"manual": "The manager converges itself in converge; what needs an administrator is granted once with ansible-playbook -e user=$(id -un) -K ansible/macos/manager-privilege.yml."
|
|
1004
1012
|
}
|
|
1005
1013
|
},
|
|
1014
|
+
{
|
|
1015
|
+
"id": "manager:resource-coverage",
|
|
1016
|
+
"meaning": "The manager reports which resource admission and pressure guards its platform supports.",
|
|
1017
|
+
"severity": "advisory",
|
|
1018
|
+
"repair": {
|
|
1019
|
+
"manual": "The manager converges itself in converge; what needs an administrator is granted once with ansible-playbook -e user=$(id -un) -K ansible/macos/manager-privilege.yml."
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1006
1022
|
{
|
|
1007
1023
|
"id": "manager:schedule",
|
|
1008
1024
|
"meaning": "The manager's schedule converged the fleet within two of its intervals.",
|
package/src/check-registry.ts
CHANGED
|
@@ -314,6 +314,10 @@ export const CHECK_MEANINGS: Record<string, string> = {
|
|
|
314
314
|
'manager:identity': 'This machine is the declared fleet manager.',
|
|
315
315
|
'manager:disk-gc':
|
|
316
316
|
"The manager's disk GC runs on a schedule; its last report names what it reclaimed and what the worktrees, package stores and tool installs hold.",
|
|
317
|
+
'manager:resource-coverage':
|
|
318
|
+
'The manager reports which resource admission and pressure guards its platform supports.',
|
|
319
|
+
'manager:legacy-agents':
|
|
320
|
+
'No legacy manager LaunchAgent with a supported replacement remains installed or loaded.',
|
|
317
321
|
'manager:job-logs':
|
|
318
322
|
"newsyslog keeps the logs of the manager's scheduled jobs under the size the macOS policy names.",
|
|
319
323
|
'manager:playbook':
|
|
@@ -588,6 +592,8 @@ export const ADVISORY_CHECKS = [
|
|
|
588
592
|
'github:rate-limit',
|
|
589
593
|
'manager:docker',
|
|
590
594
|
'manager:job-logs',
|
|
595
|
+
'manager:resource-coverage',
|
|
596
|
+
'manager:legacy-agents',
|
|
591
597
|
'manager:updates',
|
|
592
598
|
'orca:app',
|
|
593
599
|
'orca:host',
|
package/src/disk-gc-report.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { Check, Runner } from './types';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface DiskGcReport {
|
|
8
8
|
finished: number;
|
|
9
|
+
operationFailures?: number;
|
|
9
10
|
targetUsedPercent?: number;
|
|
10
11
|
usedPercentAfter?: number;
|
|
11
12
|
disposable: boolean;
|
|
@@ -23,6 +24,14 @@ export interface DiskGcReport {
|
|
|
23
24
|
const number = (value: unknown): value is number =>
|
|
24
25
|
typeof value === 'number' && Number.isFinite(value) && value >= 0;
|
|
25
26
|
|
|
27
|
+
function operationFailures(
|
|
28
|
+
value: Record<string, unknown>
|
|
29
|
+
): Pick<DiskGcReport, 'operationFailures'> {
|
|
30
|
+
return number(value['operationFailures'])
|
|
31
|
+
? { operationFailures: value['operationFailures'] }
|
|
32
|
+
: {};
|
|
33
|
+
}
|
|
34
|
+
|
|
26
35
|
/** The report at `path`, or null when there is none or it is not one the
|
|
27
36
|
* collector wrote. Only its numbers are kept; nothing else is reported.
|
|
28
37
|
*/
|
|
@@ -61,6 +70,7 @@ export async function readDiskGcReport(
|
|
|
61
70
|
const same = value['sameFilesystem'];
|
|
62
71
|
return {
|
|
63
72
|
finished: value['finished'] as number,
|
|
73
|
+
...operationFailures(value),
|
|
64
74
|
...(number(value['usedPercentAfter']) && number(value['targetUsedPercent'])
|
|
65
75
|
? {
|
|
66
76
|
usedPercentAfter: value['usedPercentAfter'],
|
|
@@ -105,6 +115,16 @@ export function diskGcReportCheck(
|
|
|
105
115
|
now: number
|
|
106
116
|
): Check {
|
|
107
117
|
const summary = describeDiskGc(report, now);
|
|
118
|
+
if (report.operationFailures)
|
|
119
|
+
return {
|
|
120
|
+
id,
|
|
121
|
+
status: 'warn',
|
|
122
|
+
summary: `DISK_GC_OPERATIONS_FAILED ${report.operationFailures}. ${summary}`,
|
|
123
|
+
remedy: {
|
|
124
|
+
action:
|
|
125
|
+
'Inspect the collector service result. A managed cleanup or fetch failed or was refused by the disk reserve; restore capacity and credentials before retrying collection. The last run does not prove successful cleanup.',
|
|
126
|
+
},
|
|
127
|
+
};
|
|
108
128
|
if (
|
|
109
129
|
report.usedPercentAfter !== undefined &&
|
|
110
130
|
report.targetUsedPercent !== undefined &&
|
package/src/manager-health.ts
CHANGED
|
@@ -27,7 +27,9 @@ export async function managerHealth(
|
|
|
27
27
|
await managerClock(run),
|
|
28
28
|
await managerWatch(run, uid),
|
|
29
29
|
await managerDiskGc(run, uid, home),
|
|
30
|
-
await managerJobLogs(run, home, user),
|
|
30
|
+
await managerJobLogs(run, home, user, uid),
|
|
31
|
+
managerResourceCoverage(),
|
|
32
|
+
await managerLegacyAgents(run, home, uid),
|
|
31
33
|
];
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -180,6 +182,14 @@ export function jobLogs(home: string): string[] {
|
|
|
180
182
|
export const newsyslogDropIn = (user: string): string =>
|
|
181
183
|
`/etc/newsyslog.d/homelab-${user}.conf`;
|
|
182
184
|
|
|
185
|
+
function rotationLoaded(text: string, config: string): boolean {
|
|
186
|
+
return (
|
|
187
|
+
text.includes('/usr/sbin/newsyslog') &&
|
|
188
|
+
text.includes(config) &&
|
|
189
|
+
!/last exit code = [1-9]/.test(text)
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
183
193
|
/** The logs of the scheduled jobs stay under a fixed size: the newsyslog
|
|
184
194
|
* drop-in that rotates them is in place, names each of them, and none has
|
|
185
195
|
* grown past twice the size it is rotated at (newsyslog runs hourly).
|
|
@@ -187,7 +197,8 @@ export const newsyslogDropIn = (user: string): string =>
|
|
|
187
197
|
export async function managerJobLogs(
|
|
188
198
|
run: Runner,
|
|
189
199
|
home: string,
|
|
190
|
-
user: string
|
|
200
|
+
user: string,
|
|
201
|
+
uid = userInfo().uid
|
|
191
202
|
): Promise<Check> {
|
|
192
203
|
const logs = jobLogs(home);
|
|
193
204
|
const dropIn = await run(['cat', newsyslogDropIn(user)]);
|
|
@@ -195,13 +206,38 @@ export async function managerJobLogs(
|
|
|
195
206
|
dropIn.ok &&
|
|
196
207
|
dropIn.stdout.includes('# Managed by homelab: manager job logs') &&
|
|
197
208
|
logs.every((log) => dropIn.stdout.includes(`${log} `));
|
|
198
|
-
|
|
209
|
+
let userRotation = false;
|
|
210
|
+
if (!declared) {
|
|
211
|
+
const config = await run([
|
|
212
|
+
'cat',
|
|
213
|
+
join(home, macos.jobLogs.directory, 'newsyslog.conf'),
|
|
214
|
+
]);
|
|
215
|
+
const loaded = await run([
|
|
216
|
+
'/bin/launchctl',
|
|
217
|
+
'print',
|
|
218
|
+
`gui/${uid}/${macos.jobLogs.label}`,
|
|
219
|
+
]);
|
|
220
|
+
userRotation =
|
|
221
|
+
config.ok &&
|
|
222
|
+
loaded.ok &&
|
|
223
|
+
rotationLoaded(
|
|
224
|
+
loaded.stdout,
|
|
225
|
+
join(home, macos.jobLogs.directory, 'newsyslog.conf')
|
|
226
|
+
) &&
|
|
227
|
+
config.stdout.includes('# Managed by homelab: manager job logs') &&
|
|
228
|
+
logs.every((log) =>
|
|
229
|
+
config.stdout.includes(
|
|
230
|
+
`${log} 600 ${macos.jobLogs.keep} ${macos.jobLogs.maxKiB} * NZ`
|
|
231
|
+
)
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
if (!declared && !userRotation)
|
|
199
235
|
return {
|
|
200
236
|
id: 'manager:job-logs',
|
|
201
237
|
status: 'warn',
|
|
202
238
|
summary: 'MANAGER_JOB_LOG_ROTATION_MISSING',
|
|
203
239
|
remedy: {
|
|
204
|
-
action: `
|
|
240
|
+
action: `Run converge to install and load the manager's user-owned newsyslog rotation job. The administrator rotation remains supported through ansible/macos/manager-privilege.yml.`,
|
|
205
241
|
},
|
|
206
242
|
};
|
|
207
243
|
const limit = 2 * macos.jobLogs.maxKiB * 1024;
|
|
@@ -412,3 +448,58 @@ export async function containerWatchdog(
|
|
|
412
448
|
summary: 'No container stayed unhealthy in the last hour.',
|
|
413
449
|
};
|
|
414
450
|
}
|
|
451
|
+
|
|
452
|
+
/** macOS has no Linux cgroup admission or writer guard. Report that boundary
|
|
453
|
+
* explicitly rather than treating the scheduled collector as a reserve. */
|
|
454
|
+
export function managerResourceCoverage(): Check {
|
|
455
|
+
const missing = Object.entries(macos.resourceCoverage)
|
|
456
|
+
.filter(([, supported]) => !supported)
|
|
457
|
+
.map(([name]) => name);
|
|
458
|
+
return {
|
|
459
|
+
id: 'manager:resource-coverage',
|
|
460
|
+
status: missing.length ? 'warn' : 'pass',
|
|
461
|
+
summary: missing.length
|
|
462
|
+
? `MANAGER_RESOURCE_GUARD_UNSUPPORTED ${missing.join(', ')}`
|
|
463
|
+
: 'Manager resource guards are supported.',
|
|
464
|
+
remedy: {
|
|
465
|
+
action:
|
|
466
|
+
'macOS manager jobs use background CPU and I/O priority and scheduled disk collection, but these do not enforce admission or a disk reserve. Keep capacity available, monitor manager:disk and manager:disk-gc, and place agent work on Ubuntu workers with measured resource guards.',
|
|
467
|
+
},
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export async function managerLegacyAgents(
|
|
472
|
+
run: Runner,
|
|
473
|
+
home: string,
|
|
474
|
+
uid: number
|
|
475
|
+
): Promise<Check> {
|
|
476
|
+
const remaining: string[] = [];
|
|
477
|
+
for (const { legacy: label } of macos.legacyAgents) {
|
|
478
|
+
const installed = await run([
|
|
479
|
+
'test',
|
|
480
|
+
'-e',
|
|
481
|
+
join(home, 'Library/LaunchAgents', `${label}.plist`),
|
|
482
|
+
]);
|
|
483
|
+
const loaded = await run([
|
|
484
|
+
'/bin/launchctl',
|
|
485
|
+
'print',
|
|
486
|
+
`gui/${uid}/${label}`,
|
|
487
|
+
]);
|
|
488
|
+
if (installed.ok || loaded.ok) remaining.push(label);
|
|
489
|
+
}
|
|
490
|
+
return remaining.length
|
|
491
|
+
? {
|
|
492
|
+
id: 'manager:legacy-agents',
|
|
493
|
+
status: 'warn',
|
|
494
|
+
summary: `MANAGER_LEGACY_AGENTS_REMAIN ${remaining.join(', ')}`,
|
|
495
|
+
remedy: {
|
|
496
|
+
action:
|
|
497
|
+
'Run converge to unload and remove legacy LaunchAgents after their replacements are installed and loaded.',
|
|
498
|
+
},
|
|
499
|
+
}
|
|
500
|
+
: {
|
|
501
|
+
id: 'manager:legacy-agents',
|
|
502
|
+
status: 'pass',
|
|
503
|
+
summary: 'No replaced legacy LaunchAgents remain.',
|
|
504
|
+
};
|
|
505
|
+
}
|
package/src/worker-reboot.ts
CHANGED
|
@@ -53,14 +53,10 @@ export function maintenanceStopsRollout(node: { checks: Check[] }): boolean {
|
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
56
|
+
/** Explicit maintenance settles the same pending boot state as first converge,
|
|
57
|
+
* and refuses a failed bootstrap before selecting a reboot. */
|
|
58
58
|
export function updatesPending(checks: Check[]): boolean {
|
|
59
|
-
return checks
|
|
60
|
-
(check) =>
|
|
61
|
-
(check.id === 'worker:reboot-pending' && check.status !== 'pass') ||
|
|
62
|
-
protectionWaitsForReboot(check)
|
|
63
|
-
);
|
|
59
|
+
return rebootNeeded(checks);
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
/** The home of the account a roster entry converges, from its workspace. */
|