Remove .ddev directory from composer create-project

Created on 11 December 2024, 8 days ago

Problem/Motivation

`composer create-project drupal/cms` currently creates/overwrites the .ddev directory (when using `ddev composer create drupal/cms`

It shouldn't do that. There shouldn't be a .ddev directory in the cms build (even if there could/should be in the download zipball)

Steps to reproduce

Do a simple drupal-cms `ddev create project` as in https://github.com/ddev/ddev/pull/6829 (https://ddev--6829.org.readthedocs.build/en/6829/users/quickstart/#drupa...)

You'll see that the `ddev composer create drupal/cms` ends up overwriting the .ddev directory (and the .ddev/config.yaml is an inappropriate and old and wrong one)

Proposed resolution

Remove the .ddev directory from the cms project

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Active

Component

Base Recipe

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States rfay Palisade, CO, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @rfay
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    This is critical, as we are shipping invalid DDEV config to people. Self-assigning to fix.

  • Pipeline finished with Canceled
    8 days ago
    Total: 64s
    #365854
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Back to @rfay for review!

  • Pipeline finished with Failed
    8 days ago
    Total: 110s
    #365863
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rfay Palisade, CO, USA

    This is looking good. I don't know how to manually test it, but I like it.

    I would remove the `php_version`, `use_dns_when_possible` and `composer_version` lines from the provided config.yaml in the zipball. And I would change the `ddev_version_constraint` to `>= 'v1.24.0` just because we don't need to chase old weirdness that could crop up.

    `php_version` 8.3 is default with current DDEV. And corepack_enable is true for drupal11 project type

  • Pipeline finished with Canceled
    8 days ago
    Total: 125s
    #365868
  • Pipeline finished with Canceled
    8 days ago
    Total: 64s
    #365874
  • Pipeline finished with Canceled
    8 days ago
    Total: 63s
    #365876
  • Pipeline finished with Failed
    8 days ago
    Total: 608s
    #365879
  • Pipeline finished with Failed
    8 days ago
    Total: 281s
    #365930
  • Pipeline finished with Failed
    8 days ago
    Total: 818s
    #365933
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts
  • Pipeline finished with Failed
    8 days ago
    Total: 580s
    #365943
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts
  • Pipeline finished with Failed
    8 days ago
    Total: 577s
    #365951
  • Pipeline finished with Failed
    8 days ago
    Total: 499s
    #365957
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rfay Palisade, CO, USA

    It should be OK, it will get more eyeballs if deployed. Thanks for the quick action!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States thejimbirch Cape Cod, Massachusetts

    +1 for RTBC

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Assigning to @tim.plunkett for final sign-off and commit.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States tim.plunkett Philadelphia

    Based on my conversation with @phenaproxima, part of why it's affixed with .command was to make it clickable in MacOS. Except that regardless of what directory it is in, it runs in my home directory (~) and then fails.

    I also discussed with @pameeela and she pushed back on using .command instead of the more common .sh

    If this were the only CLI thing and we could actually make everything doable from a GUI, then I'd be all for it. But we still need the CLI to get DDEV running anyway.

    So let's change this to launch-drupal-cms.sh and commit it. Unassigning myself so I don't block this while traveling.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts
  • Pipeline finished with Failed
    7 days ago
    Total: 642s
    #366651
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    This blocks Drupal CMS 1.0.0-rc2.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rfay Palisade, CO, USA

    The sh `[ ]` format is shorthand for running the built-in `test` command. So `if [ -f /path/to/file ]` means `if test -f /path/to/file`

    But the general use is `if somecommand` where success is `somecommand` returning 0. `test` is a special command.

    `command` is part of the POSIX spec, so should work everywhere.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Added manual testing instructions per @rfay's request.

  • Pipeline finished with Canceled
    7 days ago
    Total: 272s
    #366820
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts
  • Pipeline finished with Success
    7 days ago
    Total: 500s
    #366828
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany rkoller Nรผrnberg, Germany

    Following the steps provided in the issue summary i've first cloned the drupal_cms repo, applied the MR, and then copied the project_template directory into ~/Sites... I left the folder name as is and simply ran ./launch-drupal-cms.sh. the initial project start worked but on the composer create step i ran into an error because of the README.md file and the project folder not being clean

    Failed to create project: '/Users/rkoller/Sites/project_template/README.md' is not allowed to be present. composer create needs to be run on a clean/empty project with only the following paths: [web web/sites web/sites/default web/sites/default/.gitignore web/sites/default/files web/sites/default/files/sync web/sites/default/settings.ddev.php web/sites/default/settings.php] - please clean up the project before using 'ddev composer create'

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Oooh, great catch @rkoller. I adjusted the script to delete everything in the project root before DDEV spins up for the first time, and tested manually -- seems to work.

  • Pipeline finished with Failed
    7 days ago
    Total: 365s
    #366866
  • Pipeline finished with Failed
    7 days ago
    Total: 597s
    #366872
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Adjusting manual instructions.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany rkoller Nรผrnberg, Germany

    can confirm the install works now. i end up in the drupal cms installer when executing the shell script, which is the intended outcome.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany rkoller Nรผrnberg, Germany

    and i will quickly test another round based on the updated new instructions.

  • Pipeline finished with Failed
    7 days ago
    Total: 579s
    #366908
  • Pipeline finished with Failed
    7 days ago
    Total: 686s
    #366920
  • Pipeline finished with Canceled
    7 days ago
    Total: 125s
    #366966
  • Pipeline finished with Failed
    7 days ago
    Total: 582s
    #366971
  • Pipeline finished with Canceled
    7 days ago
    Total: 124s
    #366999
  • Pipeline finished with Failed
    7 days ago
    Total: 575s
    #367001
  • Pipeline finished with Failed
    7 days ago
    Total: 572s
    #367040
  • Pipeline finished with Failed
    7 days ago
    Total: 602s
    #367046
  • Pipeline finished with Failed
    7 days ago
    Total: 713s
    #367047
  • Pipeline finished with Canceled
    7 days ago
    Total: 124s
    #367086
  • Pipeline finished with Failed
    7 days ago
    Total: 666s
    #367088
  • Pipeline finished with Failed
    7 days ago
    Total: 532s
    #367144
  • Pipeline finished with Failed
    7 days ago
    Total: 578s
    #367150
  • Pipeline finished with Canceled
    7 days ago
    Total: 125s
    #367157
  • Pipeline finished with Failed
    7 days ago
    Total: 364s
    #367159
  • Pipeline finished with Failed
    7 days ago
    Total: 570s
    #367164
  • Pipeline finished with Canceled
    7 days ago
    #367204
  • Pipeline finished with Failed
    7 days ago
    Total: 756s
    #367206
  • Pipeline finished with Canceled
    7 days ago
    Total: 198s
    #367214
  • Pipeline finished with Canceled
    7 days ago
    Total: 154s
    #367217
  • Pipeline finished with Failed
    7 days ago
    Total: 301s
    #367219
  • Pipeline finished with Canceled
    7 days ago
    Total: 295s
    #367225
  • Pipeline finished with Failed
    7 days ago
    Total: 692s
    #367228
  • Pipeline finished with Failed
    7 days ago
    Total: 467s
    #367242
  • Pipeline finished with Failed
    7 days ago
    Total: 575s
    #367248
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rfay Palisade, CO, USA

    I tested this repeatedly in
    * WSL2
    * macOS
    * With the COMPOSER_CREATE set to use the temp special repo
    * Without that.
    * Introducing deliberate syntax errors into the script to simulate random errors.

    I think it behaves quite well enough for our purposes right now, and it can mature as we get feedback.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia bhanu951

    I tried to test the script on macOs and the script doesn't install the Drupal CMS as expected. Below are the steps I followed as per IS.

    1. git clone git@git.drupal.org:project/drupal_cms.git drupal-cms
    2. cd drupal-cms
    3. cp -r project_template cms-test
    4. cd cms-test
    5. `vi launch-drupal-cms.sh` and comment out `COMPOSER_CREATE=${COMPOSER_CREATE:-drupal/cms --stability="RC"}` and uncommnet
    `export COMPOSER_CREATE='drupal/cms --stability=dev --repository={"type":"vcs","url":"https://github.com/phenaproxima/test-ddev-cms.git"}'`
    6. Run ./launch-drupal-cms.sh from cms-test directory.

    Then I got below error.

    cms-test $./launch-drupal-cms.sh
    it usually does not make sense to `ddev config` in a subdirectory of an existing project. Is it possible you wanted to `ddev config` in parent directory /Users/bhanu951/Projects/Contrib/drupal-cms?
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rfay Palisade, CO, USA

    @bhanu951, you have to get the test directory *outside* the repository, which has its own .ddev folder. Otherwise DDEV discovers the parent directory (as it told you) and refuses.

    So copy the directory to ~/tmp/project-template or something.

    When this gets deployed, the directory will be standalone, it won't be living as a part of this repository.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rfay Palisade, CO, USA

    This is the script I've been using to create a new directory for testing:

    #!/bin/bash
    
    set -eu -o pipefail
    set -x
    
    ddev delete -Oy project-template
    rm -rf ~/tmp/project_template && cp -r project_template ~/tmp
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts
  • Pipeline finished with Skipped
    6 days ago
    #367968
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States hestenet Portland, OR ๐Ÿ‡บ๐Ÿ‡ธ
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Merged into 1.x, and the relevant public pages (https://new.drupal.org/drupal-cms/release-candidate and https://www.drupal.org/project/drupal_cms โ†’ ) have been updated by @hestenet to give people the new launch command.

    Whew!

Production build 0.71.5 2024