feat(scheduling): replica spread + resource-aware auto placement (#56)

services.spread distributes replicas across every online, schedulable
agent (replica i → agents[i mod n], deterministic). auto placement now
orders by real headroom — memory utilisation, cpu usage, then container
count — instead of count alone.

Lifecycle (start/stop/restart/delete) and GET /runtime are now driven
by container_instances inventory, so remote replicas are visible and
tear down wherever they run — covers spread, pins, and stale pin
leftovers. Spread and explicit pins are mutually exclusive.

Generated with [Devin](https://devin.ai)

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Tomáš DvořákandDevin authored and GitHub committed 2026-10-09 17:03:26 +02:00
1 parent bc93c83cf9
commit dd5ce80ce2
21 files changed
+469 -100

No files matched your search

+2
View File
@@ -86,6 +86,7 @@ export type ServiceEntity = {
sleepIdleMinutes?: number;
nodeId?: string;
nodeName?: string;
spread?: boolean;
publicUrl?: string;
};
@@ -696,6 +697,7 @@ function normalizeService(service: RawService): ServiceEntity | null {
sleepIdleMinutes: service.sleep_idle_minutes,
nodeId: service.node_id,
nodeName: service.node_name,
spread: service.spread,
publicUrl: service.public_url,
};
}