Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Drupal 10 #52

Closed
6 tasks done
gitressa opened this issue Jan 12, 2022 · 42 comments
Closed
6 tasks done

Add support for Drupal 10 #52

gitressa opened this issue Jan 12, 2022 · 42 comments

Comments

@gitressa
Copy link
Contributor

gitressa commented Jan 12, 2022

I just needed to install Drupal 10 ... so perhaps a 10.x branch can be created here?

Since there are no fundamental changes between D9 and D10, the D9 branch for lando/drupal-contributions can easily be tweaked for D10, and when the drupal10 Lando recipe is ready, we can update it. See also #5.

joshua1234511 pushed a commit to joshua1234511/drupal-contributions that referenced this issue Feb 14, 2022
@joshua1234511
Copy link

Created a branch based of 9.x. no major changes.
https://github.com/joshua1234511/drupal-contributions/tree/10.x

Using Drupal10 recipe https://docs.lando.dev/config/drupal10.html

Known Issues

WARN ==> drupal10 is not a supported recipe type.

@labboy0276
Copy link

@joshua1234511 We added Drupal 10 support in the 3.6.2 pre-release

Please make sure that your on at least that version.

@gitressa
Copy link
Contributor Author

gitressa commented Mar 8, 2022

@labboy0276 Please note that this issue is about creating a 10.x branch for this project, so it's not solved yet.

@labboy0276
Copy link

oh ok

@labboy0276 labboy0276 reopened this Mar 8, 2022
@gitressa
Copy link
Contributor Author

gitressa commented Mar 8, 2022

I am not sure how exactly it is supposed to be done, but basically just a clone of 9.x called 10.x, if that's possible?

And then tweak 10.x branch, as described in the Issue Summary, or see #11.

@serundeputy
Copy link
Contributor

yes; @gitressa #11 is how to do it.

@labboy0276 can you create a 10.x branch for this repo and set it as the default branch please?
Then @gitressa file your PR against the 10.x branch.

@labboy0276
Copy link

@gitressa @serundeputy the 10.x branch is ready to go: https://github.com/lando/drupal-contributions/tree/10.x

I didnt make it the default branch since D9 is still the current version and stuff.

@cdubz
Copy link

cdubz commented Mar 9, 2022

Thanks, @labboy0276.

I just gave the 10.x branch and got a couple of errors during the build and end up with a non-functional build (404 Not Found errors going to the provided URLS). Full log of lando rebuild -y output is attached and potentially relevant failure stuff below. Seems the container I/O got unhappy during yarn install? I'll give it another try as well.

[...]
yarn install v1.22.17
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
error Could not write file "/app/web/core/yarn-error.log": "EPERM: operation not permitted, open '/app/web/core/yarn-error.log'"
error An unexpected error occurred: "EIO: i/o error, copyfile '/var/www/.cache/yarn/v6/npm-tsconfig-paths-3.12.0-19769aca6ee8f6a1a341e38c8fa45dd9fb18899b-integrity/node_modules/tsconfig-paths/src/mapping-entry.ts' -> '/app/web/core/node_modules/tsconfig-paths/src/mapping-entry.ts'".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
 
usermod: no changes
usermod: no changes
/app/scripts/rebuild.sh: 3: /app/web/vendor/drush/drush/drush: not found
mkdir: cannot create directory '/app/web/sites': Operation not permitted
find: '/app/web/sites/default': No such file or directory
/app/scripts/rebuild.sh: 6: /app/web/vendor/drush/drush/drush: not found
/app/scripts/rebuild.sh: 7: cannot create /app/web/.gitignore: Operation not permitted
/app/scripts/rebuild.sh: 8: cannot create /app/web/.gitignore: Operation not permitted
/app/scripts/rebuild.sh: 9: cannot create /app/web/.gitignore: Operation not permitted
/app/scripts/rebuild.sh: 10: cannot create /app/web/.gitignore: Operation not permitted
ERROR ==> /app/scripts/rebuild.sh: 10: cannot create /app/web/.gitignore: Operation not permitted 

  _      __              _           __
 | | /| / /__ ________  (_)__  ___ _/ /
 | |/ |/ / _ `/ __/ _ \/ / _ \/ _ `/_/ 
 |__/|__/\_,_/_/ /_//_/_/_//_/\_, (_)  
                             /___/     

Your app started up but we detected some things you may wish to investigate.
These only may be a problem.


 ■ One of your build steps failed
   This **MAY** prevent your app from working.
   Check for errors above, fix them in your Landofile, and try again by running:
   lando rebuild


 ■ One of your events failed
   This **MAY** prevent your app from working.
   Check for errors above, fix them in your Landofile, and run the command again:
   


Here are some vitals:

 NAME            drupal-contributions                                  
 LOCATION        /Users/wellc/PhpstormProjects/drupal-contributions-10 
 SERVICES        appserver, database, chrome                           
 APPSERVER URLS  https://localhost:54400                               
                 http://localhost:54401                                
                 http://drupal-contributions.lndo.site/                
                 https://drupal-contributions.lndo.site/               

~/PhpstormProjects/drupal-contributions-10 10.x ?1 >

dc10-lando-rebuild-output.log

@gitressa
Copy link
Contributor Author

gitressa commented Mar 9, 2022

Thanks @labboy0276 for making the branch and adjusting versions. I agree that it makes sense to wait a bit with making 10.x the default.

I have also been seeing similar issues while testing the Drupal 10 recipe: After Lando says "Your app has started up correctly. Here are some vitals:" and I run a Drush command, it sometimes fail (I forget the error message). If you wait a few seconds and issue the command again, it works. It's as if some parts of Docker are not ready, when the next command is run first.

Also, with Drush I get this response:

$ lando drush st
In Assert.php line 2060:                                          
  The path must be a string. Got: boolean

But cache:rebuild and watchdog-show works ...

$ lando drush watchdog-show
 ---- -------------- -------- ---------- ---------------------------- 
  ID   Date           Type     Severity   Message                     
 ---- -------------- -------- ---------- ---------------------------- 
  36   09/Mar 15:43   cron     Info       Cron run completed.         
  35   09/Mar 15:43   system   Info       update module installed.    
  34   09/Mar 15:43   system   Info       standard module installed.
[...]

$ drush cache:rebuild
[success] Cache rebuild complete.

@labboy0276
Copy link

I can take a look a little later. I got everything to install ok, I didnt test much further than that.

@gitressa
Copy link
Contributor Author

gitressa commented Mar 9, 2022

This new 10.x branch actually looks fine to me. The installation completes and I can run phpunit tests.

There are two minor issues, I don't know how important they are:

Yarn warning

found 0 vulnerabilities
npm notice 
npm notice New minor version of npm available! 8.3.1 -> 8.5.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.5.3
npm notice Run npm install -g [email protected] to update!
npm notice 

Composer warnings
I get a lot of Composer Deprecation Notices such as Return type of Composer\DependencyResolver\RuleSetIterator::current() which makes sense since Composer version is 2.0.7. I suppose the Composer 2.2.6 update will get rolled out at some point in the future.

It seems like the drush core:status --> The path must be a string. Got: boolean issue is the only real problem I encounter, and it looks like a general Lando Drupal problem. I created this issue: drush-ops/drush#5089.

@gitressa
Copy link
Contributor Author

gitressa commented Mar 9, 2022

@cdubz Perhaps you can share your environment?

### System Configuration
| Q               | A
| --------------- | ---
| Lando version?  | 3.x.x
| OS?             | Mac/Linux/Windows

@cdubz
Copy link

cdubz commented Mar 9, 2022

I'll give it another go a little later today. Dealing with work production deployments ATM (:

I'm using Lando 3.6.2 on macOS and my guess is that my first attempt just choked Docker... as happens sometimes on macOS. Hopefully next go around will be successful for me as well.

@labboy0276
Copy link

@gitressa my 10.x branch is on the latest version of composer. All php 7.4+ image should be by default:

john@tandem:~/lando/drupal-contributions (10.x)$ lando composer --version
Composer version 2.2.6 2022-02-04 17:00:38

@gitressa
Copy link
Contributor Author

gitressa commented Mar 9, 2022

@cdubz Ah yes, macOS can be challenged performance-wise with Docker ...

This nugget, which purges all Docker containers and Lando cache was just shared by @generalredneck in https://gist.github.com/labboy0276/4406db072f9ed3bf3641f57c1d902027 and added by @labboy0276, if you ever feel like a fresh start: https://docs.lando.dev/help/purging-containers.html#purging-command

@gitressa
Copy link
Contributor Author

gitressa commented Mar 9, 2022

@labboy0276 It's strange I am getting 2.2.6 in drupal10 recipe and 2.0.7 in drupal-contributions:

drupal10

~/drupal10$ lando composer --version
Composer 2.2.6 2022-02-04 17:00:38

drupal-contributions

~/drupal-contributions$ lando composer --version
PHP Deprecated:  Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() ...
[...]
Composer version 2.0.7 2020-11-13 17:31:06

Maybe I should try the Purging command for a fresh start ...

@gitressa
Copy link
Contributor Author

gitressa commented Mar 9, 2022

So I removed everything with the Purging command, and even deleted the ~/.lando folder for completeness, still getting the same result ...

What's interesting is that during both installations, it looks like Composer 2.0.7 is installed. This bit flashes by:

Composer (version 2.0.7) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

@labboy0276 I note that you write 7.4, but isn't PHP at 8.1 in the drupal10 recipe?

$ lando composer --version
PHP Deprecated:  Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be ...
[...]
Composer version 2.0.7 2020-11-13 17:31:06

$ lando info
[ { service: 'appserver',
    urls:
     [ 'https://localhost:49386',
       'http://localhost:49387',
       'http://drupal-contributions.lndo.site/',
       'https://drupal-contributions.lndo.site/' ],
    type: 'php',
    healthy: true,
    via: 'apache',
    webroot: 'web',
    config: { php: '~/.lando/config/drupal10/php.ini' },
    version: '8.1',

PS. The Drush issue was just fixed and a fresh version 11.0.7 released, very nice. Thanks @weitzman!

@labboy0276
Copy link

yeah not sure, it install 2.2.6 on my end within the drupal-contrib repo.

@cdubz
Copy link

cdubz commented Mar 9, 2022

Second go at install was a success 🎉

I do also have Composer 2.0.7 and PHP 8.1.3 --

~/PhpstormProjects/drupal-contributions-10 10.x ?1 > lando composer --version                                                        12:37:05
PHP Deprecated:  Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112

Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Composer version 2.0.7 2020-11-13 17:31:06

~/PhpstormProjects/drupal-contributions-10 10.x ?1 > lando php --version                                                          5s 12:37:17
PHP 8.1.3 (cli) (built: Mar  3 2022 07:27:53) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.3, Copyright (c), by Zend Technologies

@cdubz
Copy link

cdubz commented Mar 9, 2022

Setting a .lando.local.yml file with --

config:
  composer_version: 2-latest

gets me the latest Composer version (2.2.7). Hm...

@gitressa
Copy link
Contributor Author

@cdubz Interesting 🤔

Like I wrote, this flashes by during install of both drupal-contributions and a singular drupal10 recipe, which is weird, right?

Composer (version 2.0.7) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Also, I get this:

drupal-contributions (Composer 2.0.7)

$ ~/drupal-contributions$ lando ssh -c "which composer"
/usr/local/bin/composer

drupal10 recipe (Composer 2.2.6)

$ ~/drupal10$ lando ssh -c "which composer"
/app/vendor/bin/composer

So two questions:

  1. Why is Composer 2.0.7 added in /usr/local/bin/composer with the drupal10 recipe?
  2. Why is drupal-contributions using it, and not /app/vendor/bin/composer?

My first hunch would be to not install Composer 2.0.7 in the drupal10 recipe, and take it from there.

Do you have any idea how to prevent this @labboy0276?

@generalredneck
Copy link

I can answer why that happens. Drupal requires composer/composer in drupal/core-dev. Lando has /app/vendor/bin as the first path in $PATH. So the version in /app/vendor/bin downloaded by installing Drupal is overloading the one in /usr/local/bin/composer. My work around before was to remove the drupal/core-dev package.

@labboy0276
Copy link

@gitressa Lando installs composer in the php container. As @generalredneck pointed out, my guess is the funkiness is due to something within this repo or Drupal installing something not the best way via composer. However, I am still getting the right composer version on my end:

john@tandem:~/lando/drupal-contributions (10.x)$ lando composer --version
Composer version 2.2.6 2022-02-04 17:00:38
john@tandem:~/lando/drupal-contributions (10.x)$ lando ssh -c "which composer"
/usr/local/bin/composer

I don't see the drupal/core-dev package that @generalredneck mentioned in the composer.json for this repo though. Have you tried completely purging this repo with lando destroy and git clean -dfx. Also are you still running lando from source and / or lando 3.6.2?

Maybe @serundeputy has more insight since he built a good chunk of this repo.

@generalredneck
Copy link

running lando composer why composer/composer may show you where it's coming from.

@generalredneck
Copy link

generalredneck commented Mar 10, 2022

Like I wrote, this flashes by during install of both drupal-contributions and a singular drupal10 recipe, which is weird, right?

Composer (version 2.0.7) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

I think I can explain this...The lamp recipie's default configuration shows composer 2.0.7 You can see that here: https://github.com/lando/lamp/blob/9524d6e78a8f42a224c2fe3078b2c5cc6d74c545/docs/config.md#L16

That trickles down into this recipe. (correct me if I'm wrong), but since drupal-contributions does a get-drupal it does a composer install on the composer file inside /app/web. composer/ccomposer is in require-dev of the composer.json file there... therefore you will always get composer/composer:^2.2.4 in this case after the initial install...

Screenshot from 2022-03-10 09-24-55

HOWEVER since the vendor directory ins in /app/web/vendor and not /app/vendor (as that folder doesn't exist) you use the version in the global install see $PATH

www-data@fff489630118:/app$ echo $PATH
/app/vendor/bin:/app/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/www/.composer/vendor/bin:/helpers

@labboy0276
Copy link

@generalredneck that doc is out of date. The LAMP/LEMP recipes install the composer that is defined in the php images for that version.

@generalredneck
Copy link

I can confirm though that with the .lando.yml provided in this project, on lando 3.6.2 I'm getting composer 2.0.7 though by default...

@gitressa
Copy link
Contributor Author

This is the PR for lando/php where Composer was recently updated from 2.0.7 to 2.2.6:
https://github.com/lando/php/pull/25/files

Still, where does Composer 2.0.7 come from in the first place?

@generalredneck
Copy link

drupal-contributions 09:38:40 DEBUG ==> process pid19 running /usr/share/lando/bin/docker-compose exec appserver /bin/sh npm install --global yarn cstdio=[inherit, pipe, pipe], silent=false, mode=spawn, detached=false

added 1 package, and audited 2 packages in 1s

found 0 vulnerabilities
npm notice 
npm notice New minor version of npm available! 8.3.1 -> 8.5.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.5.3
npm notice Run npm install -g [email protected] to update!
npm notice 
drupal-contributions 09:38:42 DEBUG ==> process pid19 finished with exit code 0 
drupal-contributions 09:38:42 DEBUG ==> process pid20 running /usr/share/lando/bin/docker-compose exec appserver /bin/sh /helpers/install-composer.sh 2.0.7 cstdio=[inherit, pipe, pipe], silent=false, mode=spawn, detached=false
All settings correct for using Composer
Downloading...

Composer (version 2.0.7) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

drupal-contributions 09:38:44 DEBUG ==> process pid20 finished with exit code 0 
drupal-contributions 09:38:44 DEBUG ==> process pid21 running /usr/share/lando/bin/docker-compose kill cstdio=[inherit, pipe, pipe], silent=false, mode=spawn, detached=false
Killing drupalcontributions_appserver_1 ... 
Killing drupalcontributions_appserver_1 ... done

@labboy0276
Copy link

My guess is your images are old. I am not seeing them on my local.

@generalredneck
Copy link

generalredneck commented Mar 10, 2022

Burned docker to the ground and cleared lando cache running the documentation we talked about yesterday and still getting composer 2.0.7

@labboy0276
Copy link

and you are version 3.6.2 of Lando?

@labboy0276
Copy link

Hmm I dont think the latest php stuff got into 3.6.2. It is earmarked for 3.6.3

If you run from source do you still have the same issues?

@generalredneck
Copy link

so yeah lando 3.6.2. and composer 2.0.7. But at least now we know that's where it came from and at least for me I've shared my knowledge on why on a normal drupal 10 recipe install using composer you get composer out of /app/vendor/bin...

I don't know where this all fits into documentation though... as I think that's literally the next logical step.

@labboy0276
Copy link

yeah so my bad @generalredneck @gitressa I run Lando from source. The issue lies here: https://github.com/lando/php/pull/25/files#diff-8f3653a6dff688ba1460548a7abc453cb3cb60ddd3848a22ee2ac73b8b8769b9L113

Our images are already on 2.2.6 while the php service in Lando 3.6.2 still runs with 2.0.7 in the 0.5.1 version of the php plugin. The 0.5.2 has the right hotness and that will be in Lando 3.6.3

@gitressa
Copy link
Contributor Author

Ah, good to get this cleared up, I'm looking forward to Lando 3.6.3.

@gitressa
Copy link
Contributor Author

Thanks for releasing Lando 3.6.4, the Drupal 10 recipe works well, and the PHP image installs PHP 8.1.4 and Composer 2.2.12.

As a side note, Composer is updated to 2.3.5 during composer create-project, due to drupal/core-dev:

$ composer create-project -n drupal/recommended-project:10.0.x-dev drupal10 && cd drupal10
Creating a "drupal/recommended-project:10.0.x-dev" project at "./drupal10"
Installing drupal/recommended-project (10.0.x-dev 37932ebc6fa1a47e6483993738cafaecd1a1413b)
  - Downloading drupal/recommended-project (10.0.x-dev 37932eb)
  - Installing drupal/recommended-project (10.0.x-dev 37932eb): Extracting archive
Created project in /home/ras/dev/drupal10
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 121 installs, 0 updates, 0 removals
  - Syncing drupal/coder (8.3.13) into cache
  - Downloading drupal/core (10.0.x-dev e1ada79)
  - Installing composer/installers (v2.1.1): Extracting archive
For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins
You have until July 2022 to add the setting. Composer will then switch the default behavior to disallow all plugins.
  - Installing drupal/core-composer-scaffold (10.0.x-dev 64e014a): Extracting archive
  - Installing drupal/core-project-message (10.0.x-dev 93df701): Extracting archive
  - Installing phpstan/phpstan (1.4.0): Extracting archive
 [...]
  - Installing composer/composer (2.3.5): Extracting archive

Composer 2.3.5 required on drupal/core-dev

$ lando composer -n why composer/composer
For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins
You have until July 2022 to add the setting. Composer will then switch the default behavior to disallow all plugins.
drupal/core-dev  10.0.x-dev  requires  composer/composer (^2.3.5) 

The remaining tasks for Drupal 10 support (see Issue Summary) are to update versions and patch examples in the README.md file.

@labboy0276
Copy link

@gitressa what happens if you set the composer_version to 2-latest or '2.3.5' in the .lando.yml for the d10 recipe?

@gitressa
Copy link
Contributor Author

gitressa commented Apr 20, 2022

With composer_version set to 2-latest I get 2.3.5 natively in Lando:

Composer (version 2.3.5) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

I can stick to 2.2.12 by installing latest alpha, which is without drupal/core-dev

$ composer create-project -n drupal/recommended-project:^10.0.0-alpha drupalalpha10 && cd drupalalpha10
[...]
$ lando init --recipe drupal10 --name drupal10alpha --source cwd --webroot web && lando start
$ lando composer --version
Composer version 2.2.12 2022-04-13 16:42:25

@gitressa
Copy link
Contributor Author

With the last MR's getting merged, last outstanding 10.x task is #62 which can be taken care of in its own time, so this issue is fixed.

@blue928
Copy link

blue928 commented Jun 18, 2022

I've read through the thread and don't understand why this issue is closed.
If this is fixed, can someone please provide comprehensive steps to install Drupal 10? The documentation page is not correct, and a lot of people may be ending up on this top google search for answers.

For me, it's still a problem.

Here are the steps:

  1. Install 3.6.4, released on 4/19/2022
  2. visit the documentation page, select the Drupal 10 recipe (found here: https://docs.lando.dev/drupal/getting-started.html)
  3. Run the .sh script

Here is the outputted error. Notice there is no Drupal 10 in the recipe choices.

...
Invalid values:
  Argument: recipe, Given: "drupal10", Choices: "acquia", "backdrop", "drupal6", "drupal7", "drupal8", "drupal9", "joomla", "lagoon", "lamp", "laravel", "lemp", "mean", "pantheon", "platformsh", "symfony", "wordpress"
WARN ==> could not find app in this dir or a reasonable amount of directories above it! 
Usage: lando <command> [args] [options]
...
...
Did you mean ssh?
WARN ==> could not find app in this dir or a reasonable amount of directories above it! 
ERROR ==> Cannot set property 'opts' of undefined 

@gitressa
Copy link
Contributor Author

Please note that this is the Lando + Drupal Contributions repository:

This repo is intended to make it easy to contribute to the Drupal core and contrib projects.

lando/drupal is probably where you want to open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants