pantheon-upstreams / drupal-composer-managed

Pantheon platform's standard Drupal upstream, and recommended starter template for custom upstreams.
8 stars 24 forks source link

Issue with simplesamlphp modules while using pantheon-systems/upstream-management #3

Closed XjSv closed 6 months ago

XjSv commented 1 year ago

I am currently using the pantheon-systems/upstream-management package to manage a custom upstream. When settings everything up and running the initial composer install, everything is installed correctly.

Then I run the composer update-upstream-dependencies and commit everything except the root/composer.lock file.

The problem is that when setting up a separate site based on the committed upstream code and running composer install the simplesamlphp modules are installed in the root directory instead of inside the /vendor/simplesamlphp directory. There is no root lock file before running composer install, the upstream-configuration/locked/composer.json is also included in the root composer.json file.

This does not happen if I don't use pantheon-systems/upstream-management.

The issue is similar as this: https://github.com/simplesamlphp/composer-module-installer/issues/3

XjSv commented 1 year ago

It seems like the issue is resolved if you install 'drupal/simplesamlphp_auth' from the root composer.json instead of the upstream-configuration one.

The caveat with this module should be documented, otherwise if you follow instructions and install any upstream dependencies in the upstream-configuration/composer.json file then you will inevitably run into this issue.

markfullmer commented 1 year ago

I wonder if the issue is not directly because of where you're adding the requirement for simplesamlphp, but rather that a Simplesamlphp Composer plugin needs to be added to the list of allowed plugins in the root composer.json file. This is corroborated in the issue referenced above: https://github.com/simplesamlphp/composer-module-installer/issues/3#issuecomment-249146309

I can confirm that our team requires simlesamlphp/simplesamlphp and drupal/simplesamlphp_auth by way of an external dependency, so our experience is that you do not have to require this in the root composer.json file.

I think this doesn't have anything to do with Pantheon.

XjSv commented 1 year ago

It sounds like it's definitely a composer configuration issue, maybe on my end. The issue is that I already have simplesamlphp/composer-module-installer in my root composer.json file's allowed plugins section.

[root]/composer.json ```json { "name": "PROJECT_NAME", "description": "PROJECT_DESCRIPTION", "type": "project", "license": "MIT", "repositories": [ { "type": "composer", "url": "https://packages.drupal.org/8" }, { "type": "path", "url": "upstream-configuration/locked" } ], "require": { "php": ">=8.1", "composer/installers": "^1.9", "cweagans/composer-patches": "^1.7", "drupal/core-composer-scaffold": "9.5.*", "drupal/core-project-message": "^9", "drupal/core-recommended": "9.5.*", "drupal/core-vendor-hardening": "^9", "drush/drush": "^11", "pantheon-systems/drupal-integrations": "^9", "pantheon-systems/upstream-management": "^1.0", "my/distribution-dependencies": "dev-main" }, "require-dev": { "behat/behat": "^v3.7.0", "drupal/coder": "^8.3", "drupal/drupal-extension": "^4.1", "drupal/twig_vardumper": "^3.0", "kint-php/kint": "^4.2", "phpunit/phpunit": "^9", "squizlabs/php_codesniffer": "^3.5.8" }, "conflict": { "drupal/drupal": "*" }, "minimum-stability": "dev", "prefer-stable": true, "extra": { "installer-paths": { "web/core": ["type:drupal-core"], "web/libraries/{$name}": ["type:drupal-library"], "web/modules/contrib/{$name}": ["type:drupal-module"], "web/profiles/contrib/{$name}": ["type:drupal-profile"], "web/themes/contrib/{$name}": ["type:drupal-theme"], "drush/Commands/contrib/{$name}": ["type:drupal-drush"], "web/modules/custom/{$name}": ["type:drupal-custom-module"], "web/profiles/custom/{$name}": ["type:drupal-custom-profile"], "web/themes/custom/{$name}": ["type:drupal-custom-theme"], "web/private/scripts/quicksilver/{$name}/": ["type:quicksilver-script"] }, "patches": { "drupal/webp": { "hash_equals warning": "https://www.drupal.org/files/issues/2022-03-17/fix.hash_.error_.issue_.3267138.patch" }, "drupal/core": { "install cache bug": "https://www.drupal.org/files/issues/2021-03-12/2350711-9.x-71.patch", "ckeditor5 field widgets row settings": "https://www.drupal.org/files/issues/2023-02-02/3241295-d9.5-101.patch" } }, "composer-exit-on-patch-failure": true, "patchLevel": { "drupal/core": "-p2" }, "drupal-scaffold": { "allowed-packages": ["pantheon-systems/drupal-integrations"], "locations": { "web-root": "./web" }, "file-mapping": { "[project-root]/.editorconfig": false, "[project-root]/pantheon.upstream.yml": false, "[project-root]/.gitattributes": false, "[web-root]/sites/development.services.yml": false } }, "enable-patching": true }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true, "platform": { "php": "8.1" }, "allow-plugins": { "simplesamlphp/composer-module-installer": true, "composer/installers": true, "cweagans/composer-patches": true, "drupal/core-composer-scaffold": true, "drupal/core-project-message": true, "drupal/core-vendor-hardening": true, "php-http/discovery": true, "pantheon-systems/upstream-management": true, "phpstan/extension-installer": true, "dealerdirect/phpcodesniffer-composer-installer": true } }, "autoload": { "classmap": ["upstream-configuration/scripts/ComposerScripts.php"] }, "scripts": { "post-install-cmd": [ "ln -sf ../vendor/simplesamlphp/simplesamlphp/www web/simplesaml", ... "DrupalComposerManaged\\ComposerScripts::postInstall" ], "post-update-cmd": [ "ln -sf ../vendor/simplesamlphp/simplesamlphp/www web/simplesaml", ... "DrupalComposerManaged\\ComposerScripts::postUpdate" ], "pre-update-cmd": ["DrupalComposerManaged\\ComposerScripts::preUpdate"], "upstream-require": ["DrupalComposerManaged\\ComposerScripts::upstreamRequire"] }, "scripts-descriptions": { "upstream-require": "Add a dependency to an upstream. See https://pantheon.io/docs/create-custom-upstream for information on creating custom upstreams." } } ```
mordonez commented 10 months ago

On simplesamlphp 2.1 the static folder is public instead www

https://www.drupal.org/project/simplesamlphp_auth/issues/3340606 https://simplesamlphp.org/docs/2.1/simplesamlphp-upgrade-notes-2.0.html

lcatlett commented 9 months ago

this is not an issue with the upstream-management package or Pantheon - in addition to allowing simplesamlphp/composer-module-installer in the root composer.json file's allowed plugins section, you need to actually composer require simplesamlphp/composer-module-installer: "^1.2.0", and then configure the installer types and install path for the saml modules in the extra section of the root composer.json:

eg

 "installer-types": [
            "simplesamlphp-module"
        ],

and

 "installer-paths": {
            "vendor/simplesamlphp/simplesamlphp/{$name}": ["type:simplesamlphp-module"]
        },
XjSv commented 6 months ago

@lcatlett Thank you! The solution you provided works.