mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-11 21:26:44 +00:00
Parallel compose slots, swarm lab clusters and GUI lanes each kept their own pip, npm and pacman downloads, and a failed swarm run left its cluster (about 25 GB of node docker data plus the rescue bundle in the act container) on the root filesystem until someone ran make swarm-down. INFINITO_CACHE_SHARED_HOST_PATH (default <DIR_CACHE>/shared) is now mounted read-write at the same path into every compose slot and every swarm lab node, with PIP_CACHE_DIR and npm_config_cache below it; empty, the renders stay byte-identical to before. On a host whose os-release ID is exactly arch running an arch stack, INFINITO_CACHE_HOST_PACMAN_PATH mounts the host pacman cache read-only and scripts/docker/cache/pacman.sh makes it the first CacheDir with <shared>/pacman/ second, so new downloads land in the shared folder and the host cache stays untouched; on Manjaro and every other host pacman uses the shared folder alone. make swarm-zombie without keep=true now copies the act job's rescue diagnostics and Playwright artefacts to the host and then releases the lab nodes, the lab network, the NFS export volume and the act outer container, on success and on failure; when the copy fails the nodes still go, the act container stays and the run exits naming make swarm-down. make roundtrip passes keep to every swarm step, make clean-cache removes the shared folder, and the disc-space cleanup skips pacman cache directories it cannot write. apt and dnf keep their per-container caches behind the package-cache proxy, and no docker data root is shared between daemons. Requirement 065. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
2.8 KiB
Python
77 lines
2.8 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
from utils.distros import distro_names
|
|
|
|
VALID_DISTROS: tuple[str, ...] = distro_names()
|
|
|
|
TOOLS_LANE_KEYS: tuple[str, ...] = (
|
|
"INFINITO_TOOLS_LIBRETRANSLATE_PORT",
|
|
"INFINITO_TOOLS_LITELLM_PORT",
|
|
"INFINITO_TOOLS_MODELS_HOST_PATH",
|
|
"INFINITO_TOOLS_S1_PORT",
|
|
"INFINITO_TOOLS_TRANSLATE_PORT",
|
|
)
|
|
|
|
|
|
def compose_file_args() -> list[str]:
|
|
"""Compose `-f` flags shared by up and down flows.
|
|
|
|
Each override is gated on the resource it needs being present, not on the
|
|
instance slot: an override whose `:?` guard is unsatisfied would abort the
|
|
stack outright, so a checkout that was never handed a shared git dir or
|
|
cache network simply does not layer that file in.
|
|
"""
|
|
from .extra_mounts import parse_mounts, write_mounts_override
|
|
from .profile import Profile
|
|
|
|
profile = Profile()
|
|
out = ["-f", "compose.yml"]
|
|
if profile.shared_git_dir():
|
|
out += ["-f", "compose/worktree.override.yml"]
|
|
if profile.cache_stack_enabled():
|
|
out += ["-f", "compose/cache.override.yml"]
|
|
if profile.shared_cache_network():
|
|
out += ["-f", "compose/cache.shared.override.yml"]
|
|
if profile.shared_package_cache():
|
|
out += ["-f", "compose/shared-cache.override.yml"]
|
|
if profile.host_pacman_cache():
|
|
out += ["-f", "compose/pacman.override.yml"]
|
|
if profile.gpu_reservable():
|
|
out += ["-f", "compose/gpu.override.yml"]
|
|
if (os.environ.get("INFINITO_PUBLISH_PORTS") or "").strip().lower() == "false":
|
|
out += ["-f", "compose/noports.override.yml"]
|
|
if all((os.environ.get(key) or "").strip() for key in TOOLS_LANE_KEYS):
|
|
out += ["-f", "compose/tools.override.yml"]
|
|
|
|
if profile.image_mirror_enabled():
|
|
from utils.cache.files import PROJECT_ROOT
|
|
|
|
from .runner_mirror import write_override
|
|
|
|
out += ["-f", write_override(PROJECT_ROOT, out[1::2])]
|
|
mounts = parse_mounts(os.environ.get("INFINITO_EXTRA_MOUNTS") or "")
|
|
if mounts:
|
|
from utils.cache.files import PROJECT_ROOT
|
|
|
|
out += ["-f", write_mounts_override(PROJECT_ROOT, mounts)]
|
|
return out
|
|
|
|
|
|
def resolve_distro() -> str:
|
|
"""Return INFINITO_DISTRO; raise SystemExit if missing or invalid."""
|
|
distro = os.environ["INFINITO_DISTRO"].strip()
|
|
if not distro:
|
|
raise SystemExit(
|
|
"INFINITO_DISTRO is not set. Run 'make dotenv' (or source scripts/meta/env/load.sh) "
|
|
f"or export INFINITO_DISTRO=<{'|'.join(VALID_DISTROS)}> "
|
|
"before invoking cli.administration.deploy.development."
|
|
)
|
|
if distro not in VALID_DISTROS:
|
|
raise SystemExit(
|
|
f"INFINITO_DISTRO={distro!r} is not a valid distro. "
|
|
f"Valid: {', '.join(VALID_DISTROS)}."
|
|
)
|
|
return distro
|