Score:0

Tarball 9.3.0 to Composer 9.3.0

us flag

We have a large production website running 8.9.20 with a Tarball directory format. We would like to make the jump to 9.3.0 and convert the site from Tarball to Composer directory format. I performed the following:

  • Cloned the production website to "staging" (copy production directory and database)
  • drush up drupal-9.3.0

This "staging" Tarball 9.3.0 website has a clean "status" report and could be promoted to production with some additional testing. This is a great step in the right direction.

I also created a composer based website to directory "d9" as follows:

  • composer create-project drupal/recommended-project d9
  • composer require contrib modules and bootstrap theme
  • updated composer.json repository to find our GitHub code
  • composer require non-drupal library to vendor, custom module and custom bootstrap subtheme

This Composer 9.3.0 site "status" report is clean. The site does not contain our configuration data (content types, etc) or our content. Another step in the right direction.

How do we move from Tarball to Composer directory format? Perhaps this is as easy as copying the database from the Tarball 9.3.0 site to the Composer 9.3.0 site. This is similar to our Cloning process above without copying the directory. I have never seen this documented anywhere and would like to make sure this is the correct move for our (eventually) production website. Thanks!

my flag
I am trying to find my writeup about this. I suspect it was an answer here, but I can't find it. I would add an answer here, but it has been a few years since I have done this. You are on the right path. I believe your next step would be to take your new `composer.json`, and then copy it into your site. Then rename directories to match the installer paths, and delete what would be the build artifacts managed by composer. Then `composer install ; drush cr`.
Score:1
cn flag

The site does not contain our configuration data (content types, etc) or our content. How do we move from Tarball to Composer directory format? Perhaps this is as easy as copying the database from the Tarball 9.3.0 site to the Composer 9.3.0 site.

Yes, when you have managed to rebuilt the entire codebase with composer you can move the database containing your content and the active configuration. Copy at the same time the files directory, in a default install sites/default/files/, so that both are in sync.

The files folder contains some files generated during a cache rebuild or when needed. Like aggregated css/js files, compiled templates or image styles. It doesn't really matter whether you simply copy all files or exclude those to let them be rebuilt if necessary.

Concerning the config sync folder. If you switch to the composer drupal/recommended-project it is also recommended to move the sync folder outside of the webroot. See https://www.drupal.org/docs/configuration-management/changing-the-storage-location-of-the-sync-directory

Greg Sims avatar
us flag
Thanks for the feedback 4k4! copying ```sites/default/files/``` makes since. This is not as straight-forward as you might think as there are differences between the two websites -- at least in my case. I will detail these differences below and what I decided to do as I look at each subdirectory.
Greg Sims avatar
us flag
```google_analytics``` module figured out that its subdirectory did not exist on the new website and created it along with associate content. I do not believe I will copy this subdirectory.
Greg Sims avatar
us flag
It appears the content of the ```css``` and ```js``` subdirectories is stored in the database. Perhaps ```drush cr``` figures out that ```*.css``` and ```*.js``` did not exist in the files directory and created them. I do not believe copying these two subdirectories from the Tarball site to the Composer site is needed as a result.
Greg Sims avatar
us flag
The ```styles``` and ```languages``` subdirectories are also created dynamically.
Greg Sims avatar
us flag
The content of the ```php``` subdirectory is created dynamically -- but the file mode is different. The tarball is showing 755 and composer is showing 777. Copying all of ```sites/default/files/``` would eliminate this difference. Here is the Core Issue -- https://www.drupal.org/node/2486569 -- that is working to change the filemode away from 777.
Greg Sims avatar
us flag
I relocated the ```config_*``` directory out of the webroot to ```sites/default/sync``` and updated ```settings.php``` per the documentation cited above.
4uk4 avatar
cn flag
This is not out of the webroot. The concept of the recommended composer project is to introduce the web/ folder and move the vendor/ folder outside. To do the same thing for the config folder this is the correct example from the cited doc: `$config_directories[CONFIG_SYNC_DIRECTORY] = '../config/sync';`
Greg Sims avatar
us flag
I changed the location of ```config/sync``` per @4k4 above.
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.