cli.administration.deploy.development package

Subpackages

Submodules

cli.administration.deploy.development.build module

cli.administration.deploy.development.build.add_parser(sub: argparse._SubParsersAction) → None
cli.administration.deploy.development.build.handler(args: argparse.Namespace) → int

cli.administration.deploy.development.cli module

cli.administration.deploy.development.cli.main(argv: list[str] | None = None) → int

cli.administration.deploy.development.common module

Shared helpers for the development deploy CLI.

DEV_INVENTORY_VARS_FILE mirrors INFINITO_INVENTORY_VARS_FILE from default.env; the pairing is drift-guarded.

cli.administration.deploy.development.common.make_compose() → Compose
cli.administration.deploy.development.common.resolve_container() → str

Return INFINITO_CONTAINER; raise SystemExit if unset.

cli.administration.deploy.development.compose module

class cli.administration.deploy.development.compose.Compose(repo_root: Path, distro: str)

Bases: object

Wrapper around docker compose for the dev/CI stack.

down() → None

Tear down the stack.

exec(cmd: list[str], *, check: bool = True, workdir: str | None = None, capture: bool = False, live: bool = False, tty: bool | None = None, extra_env: dict[str, str] | None = None) → CompletedProcess

Execute inside the infinito container.

tty=None auto-selects (local: True, CI: False). live=True streams stdout/stderr.

run(args: list[str], *, check: bool = True, capture: bool = False, live: bool = False, text: bool = True, extra_env: dict[str, str] | None = None) → CompletedProcess
up(*, run_entry_init: bool = True) → None
wait_for_healthy(*, timeout_s: int | None = None) → None

Wait for the infinito container’s healthcheck.

cli.administration.deploy.development.coredns module

class cli.administration.deploy.development.coredns.CoreDNSCorefileRenderer(repo_root: Path, env_filename: str = '.env', template_relpath: str = 'compose/coredns/Corefile.tmpl', output_relpath: str = 'compose/coredns/Corefile')

Bases: object

Render compose/coredns/Corefile from compose/coredns/Corefile.tmpl.

What this does:
  • Reads variables from env file (default: .env, generated from default.env)

  • Substitutes ${VAR} placeholders into the Corefile template

  • Writes the output atomically (tmp -> rename)

  • Optionally prints a preview of the first N lines

Substitution runs in-process rather than through envsubst: the act runner and the nested deploy containers do not all ship gettext, and a missing binary turned a two-variable substitution into a failed deploy.

Hard guarantees:
  • Fails if template/env files are missing

  • Fails if output path exists and is a directory

  • Fails if output directory cannot be created or is not writable

  • Fails if rendered file is empty

env_filename: str = '.env'
output_relpath: str = 'compose/coredns/Corefile'
render(*, show_preview: bool = True, preview_lines: int = 25) → Path
repo_root: Path
template_relpath: str = 'compose/coredns/Corefile.tmpl'

cli.administration.deploy.development.down module

cli.administration.deploy.development.down.add_parser(sub: argparse._SubParsersAction) → None
cli.administration.deploy.development.down.down_stack(*, repo_root: Path, distro: str) → None
cli.administration.deploy.development.down.handler(args: argparse.Namespace) → int

cli.administration.deploy.development.env module

cli.administration.deploy.development.env.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.

cli.administration.deploy.development.env.resolve_distro() → str

Return INFINITO_DISTRO; raise SystemExit if missing or invalid.

cli.administration.deploy.development.exec module

cli.administration.deploy.development.exec.add_parser(sub: _SubParsersAction) → None
cli.administration.deploy.development.exec.handler(args: Namespace) → int

cli.administration.deploy.development.init module

cli.administration.deploy.development.log_utils module

cli.administration.deploy.development.log_utils.append_text(path: Path, text: str) → None
cli.administration.deploy.development.log_utils.log_path(logs_dir: Path, deploy_type: str, distro: str, suffix: str) → Path
cli.administration.deploy.development.log_utils.write_text(path: Path, text: str) → None

cli.administration.deploy.development.logs module

cli.administration.deploy.development.logs.add_parser(sub: argparse._SubParsersAction) → None
cli.administration.deploy.development.logs.handler(args: argparse.Namespace) → int

cli.administration.deploy.development.mirrors module

cli.administration.deploy.development.network module

cli.administration.deploy.development.network.detect_outer_network_mtu(env: Mapping[str, str] | None = None, *, daemon_config_path: Path = PosixPath('/etc/docker/daemon.json')) → str | None

cli.administration.deploy.development.proc module

cli.administration.deploy.development.proc.run_streaming(cmd: list[str], *, cwd, env: dict[str, str], text: bool = True) → CompletedProcess

Run a subprocess and stream stdout/stderr live to the terminal.

cli.administration.deploy.development.profile module

Runtime-context helpers for the dev/CI compose stack.

class cli.administration.deploy.development.profile.Profile

Bases: object

Runtime identity and the capability decisions derived from it.

cache_stack_enabled() → bool

True iff the pull-through cache stack should be loaded.

docker_root_ephemeral() → bool

True iff the docker data root may be wiped when the stack goes down.

image_mirror_enabled() → bool

True iff image references should be rewritten to the GHCR mirror.

instance() → int

Slot index of this checkout; 0 is the primary one.

Bookkeeping only: the compose layering below keys off the concrete resources a worktree was handed, never off this number, so a stray slot cannot make compose demand a value nobody set.

is_ci() → bool

True when any standard CI signal is set.

owns_cache_stack() → bool

True iff this instance runs the cache stack rather than sharing it.

runs_on_github() → bool

True on a real GitHub runner; act and generic CI are not that.

shared_cache_network() → str

Docker network of a cache stack owned elsewhere, empty when unset.

shared_git_dir() → str

Path of the checkout’s shared .git directory, empty when it owns one.

cli.administration.deploy.development.recreate module

cli.administration.deploy.development.recreate.add_parser(sub: _SubParsersAction) → None
cli.administration.deploy.development.recreate.foreign_endpoints(rows: str, project: str) → list[str]

Return the running containers of other projects on the network.

Parameters:
  • rows – docker ps lines of <name>\t<compose project>.

  • project – compose project that owns the network.

cli.administration.deploy.development.recreate.handler(args: Namespace) → int

cli.administration.deploy.development.restart module

cli.administration.deploy.development.restart.add_parser(sub: _SubParsersAction) → None
cli.administration.deploy.development.restart.handler(args: Namespace) → int

cli.administration.deploy.development.runner_mirror module

Point the images the CI runner pulls itself at their GHCR mirror.

cli.administration.deploy.development.runner_mirror.env_image(repo_root: Path, key: str) → str

Return the mirror reference for an image default.env declares.

Parameters:
  • repo_root – repository root holding default.env.

  • key – the default.env key naming the image.

cli.administration.deploy.development.runner_mirror.mirrored_images(repo_root: Path) → dict[tuple[str, str], str]

Return {(source_file, service): mirror reference} for every runner image.

Parameters:

repo_root – repository root the runner images are declared under.

cli.administration.deploy.development.runner_mirror.write_override(repo_root: Path, layered: list[str]) → str

Write the compose override that swaps the runner’s images for mirrors.

Parameters:
  • repo_root – repository root the compose files are relative to.

  • layered – compose files the stack is built from. Only their services are overridden, so the override never adds a service of its own.

Returns:

The override path relative to repo_root.

cli.administration.deploy.development.stop module

cli.administration.deploy.development.stop.add_parser(sub: argparse._SubParsersAction) → None
cli.administration.deploy.development.stop.handler(args: argparse.Namespace) → int

cli.administration.deploy.development.storage module

cli.administration.deploy.development.storage.detect_storage_constrained(compose: Compose, app_ids: list[str], variants: dict[str, int] | None = None) → bool

Return True if the declared storage need of app_ids and their transitive dependencies, at the given variant overlay, exceeds the free space on the filesystem holding DockerRootDir.

We intentionally measure the DockerRootDir filesystem because this is where images/volumes/build cache usually grow (especially in CI / Docker-in-Docker).

cli.administration.deploy.development.up module

cli.administration.deploy.development.up.add_parser(sub: _SubParsersAction) → None
cli.administration.deploy.development.up.handler(args: Namespace) → int

cli.administration.deploy.development.variant_select module

Module contents

cli.administration.deploy.development.main(argv: list[str] | None = None) → int