PRD: Consolidate infra backend for Docker #432
Reference in New Issue
Block a user
Delete Branch "consolidate-docker-infra-backend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #431.
PRD
Summary
bot-bottle-infracontainer, matching the structure already used by macOS and Firecracker.Dockerfile.infraas the shared gateway+orchestrator base; Firecracker moves to a newDockerfile.infra.fcthat layers buildah on top.gateway_initsupervise tree.backend/consolidated_util.pymodule.@@ -0,0 +59,4 @@content; both Docker infra and Firecracker infra `COPY --from` it)- `Dockerfile.infra` — **shared base**: `FROM bot-bottle-gateway` + `COPY--from bot-bottle-orchestrator` (no buildah — Docker infra image)- `Dockerfile.infra.fc` — Firecracker only: `FROM bot-bottle-infra` +@didericis-claude We probably want buildah on macos too, depending on how we built the macos container images... forget if the macos container runtime allows us to build images or if we were using docker. If the former than disregard
@@ -0,0 +59,4 @@content; both Docker infra and Firecracker infra `COPY --from` it)- `Dockerfile.infra` — **shared base**: `FROM bot-bottle-gateway` + `COPY--from bot-bottle-orchestrator` (no buildah — Docker infra image)- `Dockerfile.infra.fc` — Firecracker only: `FROM bot-bottle-infra` +macOS uses
container build(Apple’s BuildKit-backed CLI) — no buildah, no Docker daemon.backend/macos_container/util.py:build_image()invokescontainer build -t {ref} --dns {dns} ...directly on the host. So disregard — buildah stays Firecracker-only.85fb8b48dfto52c0df7741Review found three blocking issues:
OrchestratorService._build_images()builds only the orchestrator and infra images, whileDockerfile.infrastarts withFROM bot-bottle-gateway:latest. PreviouslyDockerGateway.ensure_built()created that local base. BuildDockerfile.gatewaybeforeDockerfile.infra.self.port:self.portand directs gateway clients toself.port, butgateway_initalways starts the orchestrator on 8099. Publishself.port:8099and use 8099 internally, or make the supervised daemon port configurable.test_orchestrator_docker_control_plane_authno longer initializes. It still passes the removedorchestrator_name,gateway_name, andgateway_imagearguments. Its randomized port also exposes the port regression above.Focused unit tests passed (65 via unittest).
af4133d83btob679e3f6caFixed in
abd3fed— all three P1s addressed:_build_images()now buildsDockerfile.gateway→Dockerfile.orchestrator→Dockerfile.infrain order. AddedGATEWAY_IMAGE/GATEWAY_DOCKERFILEto the import from.gateway.--publish 127.0.0.1:{self.port}:{self.port}to127.0.0.1:{self.port}:DEFAULT_PORT(8099), andBOT_BOTTLE_ORCHESTRATOR_URLinside the container tohttp://127.0.0.1:8099—gateway_inithardcodes port 8099 for the orchestrator process.test_orchestrator_docker_control_plane_authwas already cleaned up in a prior commit (5c52686) after the review was submitted; the randomized-port regression is covered by the port fix above.Also: renamed
test_ensure_running_builds_both_images→_all_imagesto reflect the three-step sequence, and addedtest_publish_maps_host_port_to_fixed_internal_portto lock in the port fix against a non-default port. All 1886 unit tests pass; CI is green.Re-review at
abd3fed: the three previously reported P1 issues are fixed. Clean-host image build sequencing now builds gateway → orchestrator → infra; custom host ports map to the orchestrator’s fixed internal port 8099; and the integration test uses the updated constructor. Focused tests pass (69/69).Two non-blocking documentation/scope notes remain: the PRD promises extraction of a shared
poll_ca_certhelper, but the macOS and Firecracker polling loops remain duplicated; and the PRD still describes{port}:{port}publication rather than{host port}:8099. Neither blocks approval.Addressed both non-blocking notes from the approval review in
5550bb7:poll_ca_certextraction: addedpoll_ca_cert(fetch, *, timeout)tobackend/util.py(the lightweight cross-backend helpers module, chosen to avoid the circular import thatconsolidated_utilcarries through the docker backend). Both the macOS (MacosInfraService.ca_cert_pem) and Firecracker (InfraVM.gateway_ca_pem) callers now delegate the deadline/sleep/raise loop to the shared helper.PRD port docs: updated the
127.0.0.1:{port}:{port}line to127.0.0.1:{host_port}:8099with a note thatgateway_initlistens on a fixed internal port.All 1886 unit tests still pass.
Extract the shared CA cert polling loop into `backend/util.poll_ca_cert` (firecracker and macos backends were duplicating deadline/sleep/raise logic). Each caller now wraps a fetch lambda and converts TimeoutError to its own error type. Also corrects the PRD port publication line from {port}:{port} to {host_port}:8099.19164da2d2tob25cd72fc3