[Bugfix:System] fix twig cache directory#12867
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12867 +/- ##
=========================================
Coverage 21.67% 21.67%
Complexity 9802 9802
=========================================
Files 268 268
Lines 36723 36723
Branches 489 489
=========================================
Hits 7960 7960
Misses 28278 28278
Partials 485 485
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Here's a reference of another system with a problem. And yes, it happened in the last couple weeks. |
|
Conversation on Zulip about the option of specifying an override directory:
Unfortunately, this has php version in the path and will need to be updated every version bump of php. And it might get lost or overwrite production machine customizations. So we're going to move the cache directories. I'm going to merge this now, and open an issue to follow up with the other cache directories. |
### Why is this Change Important & Necessary? A May 2026 change for Apache and php-fpm security has made the '/usr' directory read-only for php. Any configuration files that will be edited through Submitty web pages / GUI need to be moved out of '/usr'. Currently, this is just the autograding_containers.json file, which is edited by the docker UI page to add/revise docker containers assigned to each capability (worker VMs are committed to support capabilities in the autograding_workers.json file.) This change is related to issue #12869 and PR #12867 ### What is the New Behavior? The docker UI page now allows edits to the containers assigned to each capability as this autograding_containers.json configuration file has been moved to /var where it can be edited from the web UI. ### What steps should a reviewer take to reproduce or test the bug or new feature? Visit the DockerUI page from the side bar of the instructor or administrator user. ### Automated Testing & Documentation Hopefully this will fix the Cypress DockerUI failure that has been occuring consistently since this change was made in Apache. ### Other information Further system edits are likely necessary -- issue #12869 is still unresolved. --------- Co-authored-by: Barb Cutler <Barb Cutler> Co-authored-by: roye2 <[email protected]> Co-authored-by: Nick Ciuica <[email protected]>
Why is this Change Important & Necessary?
The default for php fpm configuration changed recently on a production server causing new writes to the
twig cache to fail. If the twig cache was cleared (which happens on software update), every page load would crash. The previous location of the twig cache in
/usr/local/submitty/site/cache/twigwas blocked because the file/lib/systemd/system/php8.2-fpm.servicecontains the lineProtectSystem=fullwhich means that/usrand/bootare read-only.What is the New Behavior?
The twig cache has been moved to
/var/local/submitty/cache/twig.What steps should a reviewer take to reproduce or test the bug or new feature?
On a vagrant development machine, debug mode is on by default and twig is not cached. To enable caching of twig files, you can set
$debug = false;in theloadTwigfunction insite/app/libraries/Output.php. After editing the file runsubmitty_install_site. If caching is enabled, files should be added to the specified cache directory on new page loads. The directory can be manually cleared to enable testing.Automated Testing & Documentation
Why wasn't this caught with automated testing? Is all of our testing in debug mode? Why wasn't it caught by the developers? Because vagrant is in debug mode by default. This is a downside of being in debug mode all the time.
Other information
I'm worried that the other caches in /usr/local/submitty/site/cache/ are also impacted.
Is /var/local/submitty/cache a good place to put these files? Is there a better location?