When it is installed, Package Manager should try to detect the paths of Composer and rsync

Created on 25 July 2024, 10 months ago

Problem/Motivation

OK, look...it just sucks when you install Project Browser and Automatic Updates, only to get a nasty error because the paths to Composer and/or rsync are not in the PATH.

There's no reason it has to be this way.

Proposed resolution

During hook_install(), Package Manager should use Symfony's executable finder to try and locate Composer and rsync. If either is found, they should be written to the package_manager.settings config.

✨ Feature request
Status

Active

Version

3.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
  • Starshot blocker

    A potential blocker for Drupal Starshot. More information: http://www.drupal.org/project/starshot

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @phenaproxima
  • Pipeline finished with Success
    10 months ago
    Total: 1474s
    #233540
  • Assigned to tedbow
  • Status changed to Needs review 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Success
    10 months ago
    Total: 1115s
    #233851
  • Assigned to phenaproxima
  • Status changed to Needs work 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA
    1. if Package Manager is installed at the command line (as is the case in the Starshot prototype, or any time Drush installs Package Manager).

      Why does this apply more to command line then the web install? Won't the logic be the same in either case?

    2. What happens if you installed package manager locally, the config is automatically set to /local-path/composer but then you deploy the site to server with config and composer is at /server-path/composer. Won't package manager fail because composer is not at /local-path/composer and won't try to find it because the config is set.

      As it is now if you install package manager locally and package manager can find Composer and then you deploy to a server and Package Manager can also find Composer but it is at different path then it will work in both places.

      But as I understand this change depending on how you deploy config then this will no longer work.

    3. If 2) is right could you not just handle this in the Starshot repo as it more defined use case where you can assume more things.

      Especially since I don't think we have ever had a issue filed from actual use complaining about this problem. My guess is usually Package Manager finds Composer and Rsync without a problem

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    Feels like a target rather than a blocker, not that I am trying to discourage :)

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    I spoke to Ted about this today and I think we are finally agreed that this is really necessary for Package Manager. Too many people have run into this problem for us to keep kicking it down the road. It should be fixed in core first, then backported to contrib, so I'm moving this issue to core's queue.

    The point about accidentally exporting invalid paths in config is well-taken, so I propose we create an event subscriber that responds to the ConfigEvents::STORAGE_TRANSFORM_EXPORT event and removes those values from exported configuration.

    On top of that...I think we need a settings form -- the first and hopefully only UI in Package Manager -- to set these values.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    phenaproxima β†’ changed the visibility of the branch 3463662-when-it-is to hidden.

  • Merge request !11070Add an event subscriber for config export β†’ (Open) created by phenaproxima
  • Pipeline finished with Canceled
    3 months ago
    Total: 298s
    #411434
  • Pipeline finished with Failed
    3 months ago
    Total: 1146s
    #411441
  • Pipeline finished with Failed
    3 months ago
    Total: 444s
    #411455
  • Pipeline finished with Failed
    3 months ago
    Total: 150s
    #411472
  • Pipeline finished with Success
    3 months ago
    Total: 974s
    #411501
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Needs tests but this is reviewable.

  • Pipeline finished with Canceled
    3 months ago
    Total: 92s
    #411553
  • Pipeline finished with Success
    3 months ago
    Total: 949s
    #411554
  • πŸ‡¬πŸ‡§United Kingdom catch

    People are definitely running into this a lot with Drupal CMS, lots of reports in slack.

    The point about accidentally exporting invalid paths in config is a good one, though, so I propose we create an event subscriber that responds to the ConfigEvents::STORAGE_TRANSFORM_EXPORT event and removes those values from exported configuration.

    That would avoid a config deployment breaking a remote site, but what happens on import from local - won't it override the set values to empty again?

    I was going to suggest using key/value a bit like https://www.drupal.org/project/drupal/issues/3437162 πŸ“Œ Move twig_debug and other development toggles into raw key/value Fixed but that would also get overwritten on a sync back from production so just moving things to a different place.

    Then I was thinking could we determine these on config import. But if we can keep determining them whenever we want, and assuming #6 is correct and this will work on non-cli, then what about first trying to find the executable, and then using executable locator, but then caching the location.

    That way if the executables are in $PATH nothing runs, if they're not, it does the lookup whenever, but no syncing involved.

    Then it could do a final fallback to the config value - although after all the above, wondering if that should move to $settings so it's easier to make it environment-specific.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Hmmm...those are very good points. I guess config sync won't work.

    At the very least, though, there should be a UI to change these values. Forcing people to do it with Drush is not doing us any real favors, and it might not even be possible for people who are on shared hosting without SSH access.

    Could we rescope this issue (or make a new issue) to add a settings form, and figure out auto-detection later?

  • πŸ‡¬πŸ‡§United Kingdom catch

    I think that should be a separate issue because if config and k/v don't work for storing this, where is the setting going to be written to, but also definitely worth exploring.

  • πŸ‡³πŸ‡ΏNew Zealand quietone
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Based on slack seems there may still be some work needed here.

  • πŸ‡¬πŸ‡§United Kingdom catch

    Reading comments in related issues this feels more like major task than normal feature request.

    I think we could use this as a hint on the settings page which is being added sin the other issue.

    And we could also locate and cache this as a fallback if nothing is found or configured.

Production build 0.71.5 2024