fix(docker): route staging's runtime pip fallback through internal PyPI mirror - #13178
Merged
Conversation
β¦PI mirror docker/ol-install-missing-deps.sh (added in #12984 alongside the new pydantic-settings pin) runs a bare `pip install` on every container start when the package isn't already importable. It never referenced PIP_INDEX_URL, so on the testing/staging box it fell back to the public PyPI index directly, which is blocked by Archive's firewall. compose.staging.yaml never forwarded PIP_INDEX_URL into the web/ fast_web containers' runtime environment either, so even exporting it in the host shell had no effect. Closes #13177
This was referenced Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docker/ol-install-missing-deps.sh(added in #12984 alongside the newpydantic-settingspin) runs a barepip installon every container start when the package isn't already importable:This never referenced
PIP_INDEX_URL(Archive's internal Nexus PyPI mirror β the only path allowed through the firewall). On the testing/staging server, where live bind-mounted code (merged viamake-integration-branch.sh) can be ahead of whateverolbaseimage is cached locally, the import check genuinely fails and the fallback hits the public PyPI index directly, which the firewall blocks.This PR grew through three commits as live testing on
ol-dev1surfaced each layer of the gap in turn:--index-url "${PIP_INDEX_URL:-https://pypi.org/simple/}"to the fallback install, and forwardsPIP_INDEX_URLintocompose.staging.yaml'sweb/fast_webruntimeenvironment:(it wasn't being passed through at all before).docker compose uphappened tosource /opt/olsystem/bin/build_env.shfirst in that exact shell session β nothing enforces it, and it's easy to forget (confirmed live: adocker compose upwithout sourcing it first reproduced the identical failure). Since/olsystemis already bind-mounted into the container,ol-install-missing-deps.shnow sourcesbuild_env.shfrom there directly whenPIP_INDEX_URLisn't already set, so it no longer depends on host shell state at all.PIP_INDEX_URLalso needs to be a build arg, not just a runtime env var: after (1) and (2) fixed the runtimepydantic-settingsfallback, a rebuild onol-dev1still failed withModuleNotFoundError: No module named 'web'βweb.pyinstalls from a git source (git+https://github.com/webpy/webpy.git@...) at build time viaDockerfile.oldev'sRUN uv pip install -r requirements_test.txt, which has no runtime fallback at all.Dockerfile.oldevalready declaresARG PIP_INDEX_URL/ARG UV_DEFAULT_INDEXfor exactly this, butcompose.staging.yamlnever wired it into thebuild:section β only ever into the runtime environment. Addedargs: - PIP_INDEX_URL=${PIP_INDEX_URL:-}to bothwebandfast_web.Production is not affected by any of this today β its containers only pull pre-built
openlibrary/olbase:latestimages (rebuilt weekly on GitHub Actions with unrestricted internet), so none of these fallback/build paths ever execute there. But the same scripts are deployed there too, so this closes latent gaps, not just staging-only ones.Testing
Compose config resolves correctly for both runtime env and build args:
Reproduced the original crash in a real
python:3.14.5-slim-trixiecontainer (matchesDockerfile.olbase's pin) by pointing the unfixed install line at an unreachable index β got the identical error from the incident.Ran the actual patched fallback script against the real
openlibrary/olbase:latestimage (pulled fresh): confirmed the image already haspydantic_settingsbaked in, forcibly removed it to simulate the staging drift scenario, and confirmed the patcheddocker/ol-install-missing-deps.shself-heals β both via an explicitly-setPIP_INDEX_URLand via the new/olsystem/bin/build_env.shauto-source fallback (verified with a stand-inbuild_env.shmounted at/olsystem, confirming it's only sourced whenPIP_INDEX_URLisn't already set, and that an already-set value takes precedence).Ran a real
docker build -f docker/Dockerfile.oldev --build-arg PIP_INDEX_URL=https://pypi.org/simple/: completes successfully, andimport websucceeds in the resulting image β confirms the build-arg wiring actually reaches theuv pip installstep that installsweb.py.Live-verified on
ol-dev1through the actual incident: confirmedPIP_INDEX_URLblank causes the exact reported failure, confirmed sourcingbuild_env.shand rebuilding fixes thepydantic-settingsruntime path, then hit the separateweb.pybuild-time gap, which commit 3 addresses. Awaiting a full rebuild + boot confirmation onol-dev1with all three commits applied.Pre-commit passed clean on all changed files (locally-runnable hooks;
mypy/generate-potfail locally as documented β they require Docker/theinfogamisubmodule).Related
Closes #13177