Files
computer-playbook/cli/administration/deploy/development/env.py
T
kevinveenbirkenbachandClaude Opus 5.5 c9e7f950d9 Merge branch 'feature/updater' into feature/store-i18n
68 conflicts, resolved per hunk; resolutions agreed with the Updater
session were applied as agreed:

- svc-db-postgres (superuser password script and core) and
  sys-svc-rdbms realign_dedicated_db: updater's argv/stdin redesign with
  expand_argument_vars: false, nested into store-i18n's block structure.
- svc-db-redis 01_init: store-i18n's ACL password on stdin.
- sys-svc-proxy forwarded.conf.j2: store-i18n's handover-aware file,
  without the forwarded_base include (Host and X-Forwarded-Proto would
  be sent twice); forwarded_base serves the inline consumers, e.g.
  web-app-seaweedfs nginx.conf.j2.
- basic.conf.j2 and web-app-openproject proxy.conf.j2: issuer redirect,
  then handover, else updater's location/sso_acl.conf.j2; the
  server-level webserver_extra_configuration hook stays.
- web-app-keycloak: updater's admin-REST settings step and renumbered
  update steps; update/01_client.yml removed; store-i18n's design step
  and LDAP block kept; a73435cc9d arrived through rename detection.
- web-app-nextcloud OpenProject provisioning: updater's rewrite, all
  credentials on the Ruby runner's stdin.
- web-app-semaphore: store-i18n's canonical web root (a1d7835863).
- Role READMEs: no generated Cosmos/Architecture/Quick Setup/Credits
  sections; desk-* paths resolved to the dsk-* renames.

Integration fixes for what merged cleanly but did not fit together:

- web-app-matrix ansible vars: drop updater's second
  matrix_client_element_configuration_extension_json, which silently
  overrode store-i18n's design-aware value.
- url.origin instead of a stripped url.base in 19 places store-i18n
  added since 44aaa68924, same lookup targets (the double-slash lint).
- Package batch (18ea75049e, cb4d340de9): installs the deploy-start
  batch covers are removed (caffeine, cursor, blender, npm in dsk-gnt-*,
  with shared references), the rest carry batch: false and a nocheck
  with the verified reason (PyPI fallback, before the batch, vendor
  repository, configured flavor only, addon gate); dev-npm references
  the root npm id.
- sys-token-store write_many.yml: store-i18n's change-gated block and
  IS_SWARM_MODE.
- web-app-openproject: IS_COMPOSE_MODE in 02_migrate/run.yml; the
  seeded-admin lock (ccbf8f168d) ported into 04_admin/provision.yml and
  covered by the admin-state digest.
- Bucket policy (3b4ac40df5 and follow-ups) moved to web-svc-seaweedfs,
  where store-i18n's object store lives; the S3 admin secret travels on
  stdin instead of a task-level environment.
- act workflow.sh: no Exception-labelled comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 02:28:16 +01:00

73 lines
2.6 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.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