Repository navigation
[#3209] Documented how '.env' reaches PHP-FPM through the Lagoon entrypoint and when a change to it applies. - #3214
Conversation
…ypoint and when a change to it applies.
…v' with a 'docker-compose.override.yml' route for machine-only values.
|
Warning Review limit reached
This review includes 3 billable files and costs up to $0.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 47 minutes for your next included review. View limit details
Comment |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
Code coverage (threshold: 90%) Per-class coverage |
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
Code coverage (threshold: 90%) Per-class coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3214 +/- ##
==========================================
- Coverage 92.29% 92.09% -0.20%
==========================================
Files 113 105 -8
Lines 5099 4933 -166
Branches 49 3 -46
==========================================
- Hits 4706 4543 -163
+ Misses 393 390 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
📖 Documentation preview for this pull request has been deployed to Netlify: https://6ad7114c6e7e80356f5d8390--vortex-docs.netlify.app This preview is rebuilt on every commit and is not the production documentation site. |
Closes #3209
Summary
development/environment/docker.mdxnow documents the third way.envreaches the containers: the Lagoon images behindcli,nginxandphpload.envfrom/appin their entrypoint, before PHP-FPM starts, so every web request sees variables thatdocker-compose.ymlnever lists. The## Environment variablesprocedure indevelopment/environment/README.mdxnow says how to apply such a variable (ahoy restart, notahoy up) and how to give it a machine-only value throughdocker-compose.override.yml, anddevelopment/variables.mdxlinks to that procedure instead of sayingahoy upapplies every change.The Docker page said "a container gets only the variables its service lists under
environment" and credited the Lagoon images only with the bash sessions incli. Read that way,DRUPAL_CLAMAV_ENABLED=1in.envnever reaches Drupal, yetsettings.clamav.php,settings.stage_file_proxy.php,settings.shield.phpand the maintenance theme line insettings.phpall read unlisted variables on every request. The procedure had the matching gap: when only such a variable changes in.env,ahoy upleaves thephpcontainer running and PHP-FPM keeps the old value, and a value set in.env.localnever reaches PHP-FPM at all.After merge, the 3 pages give the same answer for each kind of variable:
ahoy upfor the onesdocker-compose.ymlpasses,ahoy restartfor the ones PHP-FPM reads from.env, and nothing for the ones only thevendor/bin/vortex-*scripts read. The other 3 items in #3209 are already fixed onmainby #3205 (theminimum-stability,prefer-stableandsort-packagesentries incomposer.mdx, the "7 of the 10 tools" count forahoy lintincode-quality/README.mdx, and the#update-trigger-brancheslink incontinuous-integration/README.mdx), so this PR doesn't touch them, and it changes no template file, script or configuration.Before / After
Changes
Docker page (
development/environment/docker.mdx)environment", instead of "a container gets only" them, since the Lagoon images add.envon top.cli,nginxandphpimages read.envfrom/appin their entrypoint when the container starts, keep any variable the container already has, and PHP-FPM passes the result to every request, withDRUPAL_CLAMAV_ENABLEDas the example.ahoy restart(ordocker compose restart) applies it andahoy updoesn't..env.localline now says Docker Compose and the Lagoon images never read it, and a closing sentence says unlisted variables reach web requests from.envonly, with a link to the override route.Environment overview (
development/environment/README.mdx)## Environment variablesprocedure covers the variables Drupal reads withoutdocker-compose.ymlpassing them: PHP-FPM loads them from.envat container start, never from.env.local, and a change applies withahoy restart..env, goes throughdocker-compose.override.ymlwith a${VAR:-}entry for thephpservice, the value in.env.local, andahoy up. The page shows the YAML.Variables (
development/variables.mdx)ahoy upso the containers pick up the new values" is replaced with a link to the procedure, which covers all 3 kinds of variable.Verification
Checked on a running stack built from
main:/lagoon/entrypoints.shis the entrypoint of the Lagoon images. It sources/lagoon/entrypoints/50-dotenv.sh, which loads.env.defaults,.envand.lagoon.env*(never.env.local) and then restores every variable that was already exported, and then itexecs the main process. The working directory is/appincli,nginxandphp, and thephpandnginximages copy/app, including.env, from thecliimage, so the same happens in CI and on hosting.docker compose exec php printenvshowsDRUPAL_THEMEandDATABASE_HOSTbut notDRUPAL_CLAMAV_ENABLEDorVORTEX_PROJECT. A FastCGI request sent straight to PHP-FPM returnsgetenv('DRUPAL_CLAMAV_ENABLED') = '1'andgetenv('VORTEX_PROJECT') = 'your_site'; the pool setsclear_env = no.docker compose config --hash phpstays the same whenDRUPAL_CLAMAV_ENABLEDchanges and changes whenDRUPAL_THEMEdoes, soahoy uprecreates the container only for listed variables. Afterdocker compose restart php, the new PHP-FPM processes carry the.envvalues again.DRUPAL_EXAMPLE_API_KEY: ${DRUPAL_EXAMPLE_API_KEY:-}forphp, the merged configuration carries the value from the shell, and thephphash changes with that value.cli,bash -c printenvsees the.env-only variables throughBASH_ENV=/home/.bashrc, and a directexec printenvdoesn't.ahoy --file .vortex/.ahoy.yml lint-docs: markdownlint, cspell and Vale report 0 errors and 0 warnings across the 82 pages.ahoy --file .vortex/.ahoy.yml build-docs: the build passes with no broken links or anchors.