Problem/Motivation

I’m pretty new to trying out Drupal CMS, but not new to Drupal sites with DDEV. I am definitely not liking that running ddev composer create-project drupal/cms blows away my .ddev/config.yaml file and replaces it with its own bare bones one. I deliberately run ddev config with my own needed parameters for db, php, and webserver and I like to be able to see them in config.yaml.

Is there anything I can do to prevent this from happening?

Steps to reproduce

ddev config --project-type=drupal11 --docroot=web --database=mysql:8.0 --webserver-type=apache-fpm --php-version=8.3

My full config.yaml file exists.

ddev start
ddev composer create-project drupal/cms

My config.yaml file has been replaced. And running ddev config --auto cannot restore it.

Proposed resolution

User interface changes

Configuration changes

Issue fork drupal_cms-3587501

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tommyk created an issue. See original summary.

phenaproxima’s picture

Nice find. I can't think of anything you can do to prevent this, but I think we should fix it.

The purpose of including a .ddev/config.yaml in the first place was to make our first-start instructions consistent in release notes and the README, and to make it so that people can download the Drupal CMS zip file and run ddev launch to get going. But you're right, that does break it for people who take the slightly longer way around, and configure DDEV before running ddev composer create-project, as documented in DDEV's quick-start for Drupal CMS.

So I think the solution here is to only add the .ddev/config.yaml to the ZIP package. We can do that by altering our drupal.org release GitLab CI job, which builds the ZIP file: https://git.drupalcode.org/project/drupal_cms/-/blob/2.x/.gitlab-ci.yml?....

Therefore, the changes we need here are:

  • Move project_template/.ddev/config.yaml to project_template/assets/ddev-config.yaml
  • In the CI job, after the *create-project step, we'll want to mv cms/assets/ddev-config.yml to cms/.ddev/config.yaml
  • Add a line to the CI job which confirms that the file was copied correctly
  • Remove the yq command which adjust the config file from .ddev/commands/web/tag.

A side effect of this is that the cPanel-compatible variant of the project template will no longer have default configuration for DDEV. Given who that variant is for, and how we expect it to be used, that's fine.

The end result here should be:

  • If you download the Drupal CMS ZIP file, you should be able to just cd into the extracted directory and run ddev launch, no questions asked.
  • If you pre-configure DDEV instead and use ddev composer create-project, your existing configuration should be preserved.

pameeela’s picture

Status: Active » Reviewed & tested by the community

I agree this is fine, we even already include ddev config --project-type=drupal11 --docroot=web in the steps to get started in the drupal/cms project. So this doesn't really change anything.

phenaproxima’s picture

Did a bit of due diligence here and I see that the dist ZIP file used by Packagist (composer create-project drupal/cms) is not the same one that gets attached to the release node, which is from our drupal.org release CI job.

That's good. It means that people who follow DDEV's quick-start instructions for Drupal CMS should not have their config.yaml overridden inadvertently: the only people who will get the canned config.yaml really and truly should be the ones who download the ZIP file from the release node.