mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Closes a stack of env-pipeline regressions left over from the recent
INFINITO_* namespace refactor by:
* DOMAIN_PRIMARY now reads INFINITO_DOMAIN strictly (was: legacy DOMAIN
env var → defaulted to infinito.localhost, which never resolved
because CoreDNS serves the INFINITO_DOMAIN value, infinito.example).
* group_vars/all/08_networks.yml IPs (ip4/ip6/dns) now read
INFINITO_IP4 / INFINITO_IP6 / INFINITO_DNS_IP.
* PLAYWRIGHT_KEEP_ALL renamed to INFINITO_PLAYWRIGHT_KEEP end-to-end
(env-builder, role default, run_one.yml docker exec, playwright.config.js,
lint allowlist, docs anchor, CI workflow vars).
* PKGMGR_IMAGE renamed to INFINITO_PARENT_IMAGE; Dockerfile ARG drops
the inline default so env/default.env is the only SPOT.
* INFINITO_SRC_DIR centralized: Dockerfile ARG (no default) + ENV;
compose forwards it as build-arg, volume mount path, and container env;
every Python CLI + shell helper + CI workflow now reads it strictly
(os.environ[...] / "${INFINITO_SRC_DIR:?...}") instead of the literal
/opt/src/infinito.
* New entries in env/default.env: INFINITO_IP6=::1, INFINITO_PARENT_IMAGE,
INFINITO_PLAYWRIGHT_KEEP=false. All three propagated through
utils/env/handlers/passthrough.STATIC_KEYS and (where consumed in the
container) through compose.yml's environment block.
Validated end-to-end with `make test` (2360 tests across lint, lint-*,
test-lint, test-external, test-unit, test-integration).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
67 lines
1.6 KiB
Python
67 lines
1.6 KiB
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
import os
|
|
|
|
from .build import handler as build_handler
|
|
from .common import make_compose
|
|
|
|
|
|
def add_parser(sub: argparse._SubParsersAction) -> None:
|
|
p = sub.add_parser("up", help="Start compose stack (coredns + infinito).")
|
|
p.add_argument(
|
|
"--skip-entry-init",
|
|
action="store_true",
|
|
help="Do not run ${INFINITO_SRC_DIR}/scripts/docker/entry.sh true after stack is up.",
|
|
)
|
|
p.add_argument(
|
|
"--when-down",
|
|
action="store_true",
|
|
help="Only start stack if it is not already running.",
|
|
)
|
|
p.set_defaults(_handler=handler)
|
|
|
|
|
|
def _maybe_build_missing() -> int:
|
|
# CI: never build (image is pulled). Local: build if missing.
|
|
if os.environ["INFINITO_BUILD"] != "1":
|
|
return 0
|
|
|
|
build_args = argparse.Namespace(
|
|
missing=True,
|
|
no_cache=False,
|
|
target="",
|
|
tag="",
|
|
push=False,
|
|
publish=False,
|
|
registry="",
|
|
owner="",
|
|
repo_prefix="",
|
|
version="",
|
|
stable="",
|
|
)
|
|
|
|
return int(build_handler(build_args))
|
|
|
|
|
|
def _stack_is_running() -> bool:
|
|
compose = make_compose()
|
|
r = compose.run(["ps", "-q", "infinito"], check=False, capture=True)
|
|
cid = (r.stdout or "").strip()
|
|
return bool(cid)
|
|
|
|
|
|
def handler(args: argparse.Namespace) -> int:
|
|
# when-down: skip if already running
|
|
if args.when_down and _stack_is_running():
|
|
print(">>> Stack already running — skipping up")
|
|
return 0
|
|
|
|
rc = _maybe_build_missing()
|
|
if rc != 0:
|
|
return rc
|
|
|
|
compose = make_compose()
|
|
compose.up(run_entry_init=not bool(args.skip_entry_init))
|
|
return 0
|