I'm currently working on deploying Drupal8 on Openshift to achieve horizontal scaling, but I hit a problem.

On a single pod (ie: "server" running drupal"), everything seems to be ok so far. But when I'm deploying a new pod, it tries to load the private files (/sites/default/files) using the same path as the first pod.

I guess it's because something is cached in the DB since "Clearing all cache" fixes it.

Is there something in the configs I can do to prevent this behaviour ? And do you think of something I should be warned about when trying to achieve horizontal scaling ?

  • Sounds like a question for Openshift? What is a pod? – Kevin Jan 25 '17 at 14:51
  • Sorry, yes, to simplify in this context a pod is just another machine running Drupal. All pods are connected to the same drupal database. – Vanesbush Jan 25 '17 at 14:56
  • sites/default/files is public files not private. Drupal needs to have a shared file system, I also don't see why it shouldn't use the same path. You'll at least need to provide way more information on what the path it uses vs path it should use is and why that is a problem. – Berdir Jan 25 '17 at 19:57
  • Alright, so if I wish to use several servers with a load balancer I must find a way all of them share the same "sites/default/files" folder i.e synchronize the files it contains across my whole cluster ? – Vanesbush Jan 26 '17 at 8:56
  • Using something like GlusterFS ? – Vanesbush Jan 26 '17 at 9:04

Posting my comment as an answer.

sites/default/files needs to be on a shared file system so that Drupal can work correctly. This contains uploaded and generated files (e.g. CSS/JS).

If you do this, you probably want to move twig to a local temporary folder, see Can I change the location of the cached Twig templates?. Note that you then need to take care of emptying that folder on all servers when you do a deployment (Unless you do something really special, this cache only needs to be updated when you change your template files).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.