0

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!

1
  • 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.
    – mpdonadio
    Dec 29, 2021 at 17:40

1 Answer 1

1

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

8
  • 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
    Dec 30, 2021 at 0:15
  • 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
    Dec 30, 2021 at 0:33
  • 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
    Dec 30, 2021 at 1:24
  • The styles and languages subdirectories are also created dynamically.
    – Greg Sims
    Jan 1, 2022 at 7:41
  • 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 -- drupal.org/node/2486569 -- that is working to change the filemode away from 777.
    – Greg Sims
    Jan 1, 2022 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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