How should TYPO3 run on a Docker-based architecture such as Divio in which:
- multiple containers run in parallel
- are recycled without warning
- have no shared local file storage
It seems that the requirement to write to typo3temp (and to some other file locations) is hard-coded in TYPO3.
(By forcing the site to run in just one container instead of multiple containers, it has been possible to create a new admin user and and use the /typo3 backend. However, there could be other problems arising further down the road.
The application has AWS S3 file storage, and a MySQL database.)
Is there some way around this? How do TYPO3 installations in similar containerised environments solve this issue?
TYPO3 instances need some work on your side for being scaled horizontally.
I am assuming TYPO3 v9+ and a default composer based installation.
You need to share at least
public/typo3temp,public/fileadminand./varbetween instances. That is because their state is very much tied to the database state. See https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/DirectoryStructure/Index.html.The rest is part of your TYPO3 deployment and could be baked into container images. I am pretty sure for live deployment none of these need to be writable. You might lose some admin backend functionality like through-the-backend configuration changes but that should be obvious.
Raising site performance
That said, getting more performance out of TYPO3 is a lot easier with a reverse caching proxy in front of it than by multiplying PHP instances. There is also https://extensions.typo3.org/extension/staticfilecache/ which generates static HTML for cachable content and has a good reputation, too.