Skip to content

[Bugfix:System] fix twig cache directory#12867

Merged
bmcutler merged 1 commit into
mainfrom
fix_twig_cache_directory
Jun 1, 2026
Merged

[Bugfix:System] fix twig cache directory#12867
bmcutler merged 1 commit into
mainfrom
fix_twig_cache_directory

Conversation

@bmcutler

@bmcutler bmcutler commented May 31, 2026

Copy link
Copy Markdown
Member

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/twig was blocked because the file /lib/systemd/system/php8.2-fpm.service contains the line ProtectSystem=full which means that /usr and /boot are 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 the loadTwig function in site/app/libraries/Output.php. After editing the file run submitty_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?

@github-project-automation github-project-automation Bot moved this to Seeking Reviewer in Submitty Development May 31, 2026
@bmcutler
bmcutler requested a review from cjreed121 May 31, 2026 05:57
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to In Review in Submitty Development May 31, 2026
@codecov

codecov Bot commented May 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.67%. Comparing base (9fe4117) to head (9b535bb).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            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           
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.02% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.73% <100.00%> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@bmcutler
bmcutler requested a review from williamjallen May 31, 2026 05:59
@bmcutler

Copy link
Copy Markdown
Member Author

@bmcutler

bmcutler commented Jun 1, 2026

Copy link
Copy Markdown
Member Author

Conversation on Zulip about the option of specifying an override directory:

/etc/systemd/system/php8.2-fpm.service.d/override.conf

[Service]
ReadWritePaths=/usr/local/ispconfig/interface/temp

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.

@bmcutler
bmcutler merged commit 5323d66 into main Jun 1, 2026
28 of 31 checks passed
@bmcutler
bmcutler deleted the fix_twig_cache_directory branch June 1, 2026 04:10
bmcutler added a commit that referenced this pull request Jun 19, 2026
### 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant