Skip to content

[#3209] Documented how '.env' reaches PHP-FPM through the Lagoon entrypoint and when a change to it applies. - #3214

Merged
AlexSkrypnyk merged 2 commits into
mainfrom
feature/3209-docs-factual-errors
Oct 20, 2026
Merged

AlexSkrypnyk merged 2 commits into
mainfrom
feature/3209-docs-factual-errors

Conversation

@AlexSkrypnyk

Copy link
Copy Markdown
Member

Closes #3209

Summary

development/environment/docker.mdx now documents the third way .env reaches the containers: the Lagoon images behind cli, nginx and php load .env from /app in their entrypoint, before PHP-FPM starts, so every web request sees variables that docker-compose.yml never lists. The ## Environment variables procedure in development/environment/README.mdx now says how to apply such a variable (ahoy restart, not ahoy up) and how to give it a machine-only value through docker-compose.override.yml, and development/variables.mdx links to that procedure instead of saying ahoy up applies 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 in cli. Read that way, DRUPAL_CLAMAV_ENABLED=1 in .env never reaches Drupal, yet settings.clamav.php, settings.stage_file_proxy.php, settings.shield.php and the maintenance theme line in settings.php all read unlisted variables on every request. The procedure had the matching gap: when only such a variable changes in .env, ahoy up leaves the php container running and PHP-FPM keeps the old value, and a value set in .env.local never reaches PHP-FPM at all.

After merge, the 3 pages give the same answer for each kind of variable: ahoy up for the ones docker-compose.yml passes, ahoy restart for the ones PHP-FPM reads from .env, and nothing for the ones only the vendor/bin/vortex-* scripts read. The other 3 items in #3209 are already fixed on main by #3205 (the minimum-stability, prefer-stable and sort-packages entries in composer.mdx, the "7 of the 10 tools" count for ahoy lint in code-quality/README.mdx, and the #update-trigger-branches link in continuous-integration/README.mdx), so this PR doesn't touch them, and it changes no template file, script or configuration.

Before / After

BEFORE - how docker.mdx said .env reaches a container

  .env ───────► Docker Compose ──► only the vars a service lists ──► container
  .env ───────► ~/.bashrc ───────► bash sessions in cli
  (no documented path from .env to a PHP-FPM request for an unlisted var)

AFTER - what the running stack does, now documented

  .env ───────► Docker Compose ──► only the vars a service lists ──► container
  .env ───────► Lagoon entrypoint, at container start ──► PHP-FPM ──► request
  .env ───────► ~/.bashrc ───────► bash sessions in cli
  .env.local ─► Ahoy export ─────► Compose ${VAR} references only
                                   (listed in docker-compose.override.yml to
                                   reach PHP-FPM)
Applying a .env change            BEFORE (docs said)    AFTER (docs say)
────────────────────────────      ──────────────────    ────────────────
var docker-compose.yml passes     ahoy up               ahoy up
var only PHP-FPM reads            ahoy up (no effect)   ahoy restart
var only vortex-* scripts read    ahoy up               nothing to run

Changes

Docker page (development/environment/docker.mdx)

  • Compose "sets only the variables a service lists under environment", instead of "a container gets only" them, since the Lagoon images add .env on top.
  • New paragraph: the cli, nginx and php images read .env from /app in their entrypoint when the container starts, keep any variable the container already has, and PHP-FPM passes the result to every request, with DRUPAL_CLAMAV_ENABLED as the example.
  • New paragraph: PHP-FPM keeps the values it started with, a change to such a variable doesn't alter the container's configuration, so ahoy restart (or docker compose restart) applies it and ahoy up doesn't.
  • The .env.local line now says Docker Compose and the Lagoon images never read it, and a closing sentence says unlisted variables reach web requests from .env only, with a link to the override route.

Environment overview (development/environment/README.mdx)

  • The ## Environment variables procedure covers the variables Drupal reads without docker-compose.yml passing them: PHP-FPM loads them from .env at container start, never from .env.local, and a change applies with ahoy restart.
  • A machine-only value, for example a credential that must stay out of the committed .env, goes through docker-compose.override.yml with a ${VAR:-} entry for the php service, the value in .env.local, and ahoy up. The page shows the YAML.

Variables (development/variables.mdx)

  • "run ahoy up so 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.sh is the entrypoint of the Lagoon images. It sources /lagoon/entrypoints/50-dotenv.sh, which loads .env.defaults, .env and .lagoon.env* (never .env.local) and then restores every variable that was already exported, and then it execs the main process. The working directory is /app in cli, nginx and php, and the php and nginx images copy /app, including .env, from the cli image, so the same happens in CI and on hosting.
  • docker compose exec php printenv shows DRUPAL_THEME and DATABASE_HOST but not DRUPAL_CLAMAV_ENABLED or VORTEX_PROJECT. A FastCGI request sent straight to PHP-FPM returns getenv('DRUPAL_CLAMAV_ENABLED') = '1' and getenv('VORTEX_PROJECT') = 'your_site'; the pool sets clear_env = no.
  • docker compose config --hash php stays the same when DRUPAL_CLAMAV_ENABLED changes and changes when DRUPAL_THEME does, so ahoy up recreates the container only for listed variables. After docker compose restart php, the new PHP-FPM processes carry the .env values again.
  • With an override that lists DRUPAL_EXAMPLE_API_KEY: ${DRUPAL_EXAMPLE_API_KEY:-} for php, the merged configuration carries the value from the shell, and the php hash changes with that value.
  • In cli, bash -c printenv sees the .env-only variables through BASH_ENV=/home/.bashrc, and a direct exec printenv doesn'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.

…v' with a 'docker-compose.override.yml' route for machine-only values.
@AlexSkrypnyk AlexSkrypnyk added this to the 1.42.0 milestone Oct 20, 2026
@github-project-automation github-project-automation Bot moved this to BACKLOG in Vortex 1.x Oct 20, 2026
@AlexSkrypnyk AlexSkrypnyk added the A2 Working clone index A2 label Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 3 billable files and costs up to $0.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

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.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 81 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 9ea89d4a-72f4-4614-8d9f-267eed9e66a8
📥 Commits

Reviewing files that changed from the base of the PR and between e7af8e9 and fccd6c6.

📒 Files selected for processing: 3
  • .vortex/docs/content/development/environment/README.mdx
  • .vortex/docs/content/development/environment/docker.mdx
  • .vortex/docs/content/development/variables.mdx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

Copy link
Copy Markdown

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   100.00% (233/233)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

1 similar comment
@AlexSkrypnyk

Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   100.00% (233/233)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.09%. Comparing base (e7af8e9) to head (fccd6c6).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

📖 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.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Oct 20, 2026
@AlexSkrypnyk
AlexSkrypnyk merged commit 2e5d284 into main Oct 20, 2026
@AlexSkrypnyk
AlexSkrypnyk deleted the feature/3209-docs-factual-errors branch October 20, 2026 08:05
@github-project-automation github-project-automation Bot moved this from BACKLOG to Release queue in Vortex 1.x Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A2 Working clone index A2 Needs review Pull request needs a review from assigned developers

Projects

Status: Released in 1.42.0

Development

Successfully merging this pull request may close these issues.

Correct 4 factual errors in the Composer, code quality, CI and Docker docs

1 participant