I want to run Drupal from a cloud and I am trying to figure out the design of the file system for multi-site setup.
In cloud there are multiple webservers hidden under the load balancer serving content from a single database(which is a service that handles replication on its own so no issue there) and using central storage for user/drupal data.
So far I have solved the user-added data(mostly images uploaded into a content or attached via fields) but I'm stuck on how to handle files like compiled Twig templates, config directory, services file and settings file and similar.
Once a new web server instance is created it will fetch the code from git repository. The user data is handled via stream wrapper(and cdn) so no action is needed there. But how should I handle the system(yml, php..) files? The settings.php and services.yml are global so they won't change(still - how to handle this in multisite setup?) and the rest is dynamic(ie. once the cache is flushed the twig templates are recompiled and this needs to be synced for all instances).
The more static files like the settings.php and services.yml files could be potentially stored in some "remote" storage and fetched from there(ie. a directory tree matching the installed sites with these files already present - not a git repo though, I think that would not be a good idea) or they could be dynamically generated based on data stored in special database.
But what about the rest(twig, config...). Would something like a fast cache be a good design? Redis db that would hold the current files and each instance would either fetch them manually or serve them directly? Once an instance flushes cache this would be immediately "synced" to all instances in second scenario. For first scenario there would have to be some timestamp with latest change that each instance would have to check on each page load and re-fetch the files.
Drupal has this quite specific file system tree so that's why I'm asking this in here. I'm sure many people run Drupal in the cloud and I'm curious how they solved this "issue".