Search code examples
dockertypo3typo3-9.xddev

How can I fix the caching issue in TYPO3 and ddev?


I recently got into using ddev to develop TYPO3 pages, but I run into the same issue every once in a while. Sometimes (I don't really know what's causing this issue) the page just stops loading and after a while this errormessage appears:

PHP Warning
Core: Error handler (BE): PHP Warning: rename(/var/www/html/var/cache/code/cache_core/5d5a7572dd900787722599.temp,/var/www/html/var/cache/code/cache_core/site-configuration.php): No such file or directory in /var/www/html/public/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php line 234

I know that this error appears when TYPO3 has no permission to write cache but I don't know what I can do to prevent this issue. Restarting Docker fixes it for a short while but eventually it's happening again and this really costs a lot of time to restart Docker every 10 to 20 minutes.. Does anybody know what kind of configuration I need to do to prevent this issue?

Btw, I'm using Docker on Windows with TYPO3 9.5.8


Solution

  • As there is no official accepted answer yet I'll elaborate on what has been said:

    The issue can be resolved by following Susi's example in the comments of the initial post: Create a docker-compose.tempfs.yaml in the .ddev directory (look carefully for the spaces indent!)

    version: '3.6'
    
    services:
      web:
        volumes:
          - type: tmpfs
            target: /var/www/html/var
            tmpfs:
              size: 268435456
    

    Combining this with the setup for NFS described in https://ddev.readthedocs.io/en/stable/users/performance/ also increases performance.

    Mind:

    • The most feasible approach for using NFS seems to be creating your own package directory which you include via composer "path" repository inside the ddev directory which already gets mounted (e.g.. /projectname/Packages/Vendor.MyPackage).
    • Mounting directories above the ddev directory is complicated and prone to error when using symlinks.