Score:0

With sites/default/files not part of the git repo, which content will be used in dev?

cn flag

I am using a composer managed Drupal install and want to use git to move it between development and production environments. From what I understand, the only directory that is not supposed to be in the git repo is sites/default/files. Everything else incl. modules, themes, composer files etc. would be in the repo. Composer would only be run in local dev, but not in production.

What I don't understand is which content would be used in dev when the files folder does not contain the files from production? Is it just test content, for example created by devel generate? And what happens when a new dev joins the team? Will (s)he get a db dump from another dev system to set his/her environment up, because a db dump from production would include content linking to files that are not there due to the missing files directory!?

Hope you can help me to ensure I am thinking into the wrong direction.

leymannx avatar
ne flag
Repo mainly consist of only custom modules, custom themes, and composer.json/~lock. Core, contrib and libraries are all managed by Composer. Yes, it's up to you to provide a way that every developer can sync a stage or live DB to their local site at any time. This can be done with Drush and a sites YAML. Then it's `drush -y sql-sync @stage @self`. Same applies for files `drush -y rsync @stage:%files @self:%files`, or use the Stage File Proxy module. Every developer always runs `composer install` and `drush deploy` in their local after pulling changes.
leymannx avatar
ne flag
And you have to find a way to either upload the `composer install` build to Live with the CI or have it call `composer install` directly on Live after setting the site in maintenance mode, from a script maybe.
Extect avatar
cn flag
Thanks a lot! Would this still be the recommended way when deploying to a production site on a shared hosting? (afraid of hitting a memory limit when calling composer install and CI is not available in the project) I was therefore thinking about including even contrib modules in the repo.
cn flag
The CI approach has a bunch of benefits, but there's nothing inherently wrong with keeping vendor folders in the repo (in Drupal this includes core, contrib modules, contrib themes, etc). Shared hosting is a classic example where this pattern is very common, even nowadays, exactly for the memory issues you mentioned
Extect avatar
cn flag
@Clive: Thank you for clarifying. Very helpful!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.