Repository navigation
Pick the PHP versions you install, like the databases - #16
Merged
Merged
Conversation
All three ran whether you wanted them or not: 5.7 GB of images and three
containers for what is usually one version plus an occasional second.
Databases already work the other way round, so versions become profiles
too -- php83, php84, php85 -- and the installer asks which to install and
which of them is the default.
Compose refuses to parse a project whose dependency sits behind a
disabled profile, so `depends_on: php${PHP_VERSION}dev` had to go from
both web servers. It only ordered startup; the backend is resolved per
request in resolve_docroot.lua. Keeping it would have meant one bad edit
of .env bricking every compose command, forge included.
The invariant: COMPOSE_PROFILES always carries the default version.
Zero php entries can then only mean a .env written before this change,
which is what ensure_php_profiles keys off -- it keeps every version
that .env used to run and says so once. forge php off refuses the
default, forge use installs what it switches to.
Asking for a version that is not installed used to proxy to a host that
does not resolve: a bare 503, same as a typo. Both servers now get
COMPOSE_PROFILES as ENABLED_PROFILES and answer with a page naming the
command to add it. It is written from the translate-name hook, not from
fixups: "/" reaches PHP through DirectoryIndex, and the internal
redirect throws away a body written that late -- the request ends as an
empty 200 on a directory.
Verified against a running stack on Apache and nginx, with the pty
driver answering the two new questions. Both new CI steps were falsified
once: the page by blanking ENABLED_PROFILES, the migration by removing
the call from need_env.
Two steps asserted COMPOSE_PROFILES exactly and were written before versions lived on that line. The first install of a scripted run also accepts the mail catcher, so the light-install check compares what is there rather than the whole line. Both were run verbatim from a clean copy this time -- the gap that let them through was checking only the steps the running stack could reach.
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.
All three PHP versions ran whether you wanted them or not: 5.7 GB of images (1.9 GB each) and three containers, for what is usually one version plus an occasional second. Databases already work the other way round, so versions become profiles too.
What changes
--php=84,83installs both and the first is the default, so--php=84keeps meaning what it meant.forge php list|on|off, alongsideforge db. They are ordinary profiles, so they also show inforge profile list.forge php offrefuses the default;forge use 8.5installs 8.5 first if you do not have it..envkeeps every version it had, announced once — agit pullcannot silently break a--pNNhost.The obstacle
Compose refuses to parse a project whose dependency sits behind a disabled profile:
Every compose command fails with it,
forgeincluded, sodepends_on: php${PHP_VERSION}devis gone from both web servers. It only ordered startup — the backend is resolved per request inresolve_docroot.lua.The invariant that keeps it safe:
COMPOSE_PROFILESalways carries the default version's profile. Zerophp[0-9][0-9]entries can then only mean a.envwritten before this change, which is what the migration keys off.Verification
Run against a real stack, both servers, before pushing. Three things it caught that CI would have taken a round trip each to find: the page cannot be written from the fixups hook (
/goes through DirectoryIndex, and the internal redirect discards the body — an empty 200 on a directory), Lua locals are invisible to functions defined above them (500 on every request), andpaste -sd', 'alternates delimiters, so three versions printed as8.3,8.4 8.5.Both new CI steps were falsified once: the page by blanking
ENABLED_PROFILES, the migration by removing the call fromneed_env.