fix: guard PHP-FPM log dir setup against unset PHP_LOG_DIR#177
Conversation
PHP_LOG_DIR is never defined in the image, so the PHP-FPM log-dir block expanded to an empty path: the mountpoint test ran against "/" (always a mountpoint), taking the else branch and running chgrp/chmod on '', which printed 'cannot access: No such file or directory' on every container boot. Guard the block so it is a no-op until PHP_LOG_DIR is defined, eliminating the boot-time log noise without changing behavior for the Apache and MediaWiki log dirs.
|
🐳 The image based on 5b829f30 commit has been built with |
|
@naresh-kumar-babu This issue originated with this commit in July 2024. What is missing from this PR to satisfy the goals of the original commit or to wire this functionality into the Observability profile? |
We might need to add an Observability profile definition that mounts the log volume from run-all.sh |
Should that go in this PR or a separate PR? Put another way, what else needs to happen for this to be a complete solution for your original commit versus additional work that needs to happen in Canasta-CLI (CanastaWiki/Canasta-CLI#839)? |
I don't have full context on the code as it is originally from wikiteq (CanastaWiki/Canasta#388). I just worked on the code migration from wikiteq branch to canasta and made sure that it worked as expected. |
Summary
Fixes #174. The PHP-FPM log-dir block in
run-all.shreferencesPHP_LOG_DIR, which is never defined in the image. The empty value made themountpointtest run against/(always a mountpoint), so theelsebranch ranchgrp -R www-data ''andchmod -R g=rwX ''— printingcannot access '': No such file or directoryon every container boot since #420.Fix
Guard the block so it is a no-op when
PHP_LOG_DIRis unset. The Apache and MediaWiki log-dir blocks are unchanged (their vars are defined and they work).Chose to guard rather than delete because PHP-FPM logs are a legitimate future input for the Observability profile — tracked in CanastaWiki/Canasta-CLI#839. The guard stops the boot-time noise now and preserves the scaffolding for that wire-up.
Testing
bash -nclean. WithPHP_LOG_DIRunset the block logs a single skip line and runs nochgrp/chmod; the errors no longer appear in boot logs.