I'm building a docker environment for a Symfony application. I have a container per application with an attached data only container for the web root that is linked to the application server. As part of the security hardening for the infrastructure these data containers are set to read only, to prevent any remote code exploits. Each application then also has a side car container that allows logs to be written to.
Symfony currently writes the cache to the default cache_dir
location of
${web_root}/app/cache/${env}
Which is in the read-only data container
when trying to boot the application I get this error
Unable to write in the cache directory
Obviously as its in the write only container this will happen
I've set my log_path is set in parameters outside the read-only container in the read-write sidecar logging container of
/data/logs/symfony
which works fine.
I've read the Symfony cookbook on how to over ride the directory structure but it only advises on how to do this in AppKernal.php
which I don't want to do as the paths may change dependant on if its in a local/uat/prod
environment.
We feed Symfony different parameters from our build server depending on the environment we are deploying to so it makes sense to put this config in here.
does anyone know if its possible to override the cache dir in config rather than editing AppKernal.php