Skip to content

ddev ssh (maybe) should land in root /var/www/html not docroot (implement working_directory config) #505

Closed

Description

@rfay

What happened (or feature request):

I got myself confused today on a site that had a docroot because I was using ddev ssh, which currently takes people to the docroot, hiding the fact that their actual root is one down. IMO we should ddev ssh into the root of the mount. In my case, that means if I'm in ~/workspace/drupal8 and I ddev ssh I'll end up in /var/www/html, not (as currently) /var/www/html/docroot

Note that I believe ddev exec might still have to land in the docroot, for things like drush to work predictably. And of course that's the argument for us to land ddev ssh in the docroot.

What you expected to happen:

How to reproduce this:

Version: Please include the output of ddev version, docker version and the project's .ddev/config.yaml.

Anything else do we need to know:

Related source links or issues:

Activity

  1. changed the title [-]ddev ssh should land in root /var/www/html not docroot[/-] [+]ddev ssh (maybe) should land in root /var/www/html not docroot[/+] on Dec 4, 2017
  2. rfay commented on Jan 24, 2018

    @rfay
    MemberAuthor

    One suggestion for this is to add a configuration for "working directory", and ddev ssh and ddev exec would land there.

  3. changed the title [-]ddev ssh (maybe) should land in root /var/www/html not docroot[/-] [+]ddev ssh (maybe) should land in root /var/www/html not docroot (implement working_directory config)[/+] on Jan 30, 2018
  4. rfay commented on Feb 21, 2018

    @rfay
    MemberAuthor

    Added "needs decision" to this because it needs a conversation. What we'd do with this affects exec (probably), hooks (possibly). Very much affects drush behavior. I just think we should talk through the implications.

  5. rickmanelius commented on Feb 23, 2018

    @rickmanelius
    Contributor

    It sounds like there are two factors at player here: user expectation and usefulness. On the expectation side, I can see how one might expect to land in the mount root versus docroot. On the usefulness side, it might help to get a few examples of when ddev exec would be better served running from the mount versus the docroot.

    Another thing to consider is that some codebases will have the two match and others will have (usually) one folder level difference.

    I guess I'm not sold yet because a user would have already configured the docroot to indicate where nginx should serve from and I see that as a major source of confusion. However, by that logic we could have just as easily set the default behavior to the execute from the mount. That said, having a basic drush command behave differently based on whether the docroot and mount folder were the same or not seems like it would lead to more frustration. And to that end, I would be biased towards keeping it the way it is now.

    Happy to discuss next week and see if the working directory config helps or adds more confusion.

  6. rfay commented on Feb 24, 2018

    @rfay
    MemberAuthor

    The reason we love ddev ssh to land in docroot is that it makes drush work out of the box, maybe wp-cli too. But we can certainly make drush work in the project root, we have the tools, already create a drush settings file, so we can just solve that one and we'll be happy with ddev ssh landing in project root I think. The issue for drush settings is #454

  7. mglaman commented on Feb 26, 2018

    @mglaman
    Contributor

    One reason for not landing in root: RoboCLI or Phing. What if I have a task runner I am expecting to not run in the root context?

    Perhaps there could be a --docroot flag to automatically switch to executing in the docroot? But then the use case of Drush/Console/WP-CLI become more cumbersome.

    Platform.sh CLI has a specific Drush command helper. Would it kill to have

    • ddev exec for arbitrary commands, with --docroot support
    • ddev drush which executes drush in docroot or with --root
    • ddec wpcli which executes WP-CLI in docroot

    This also makes adoption easier as these common commands no longer need an extra step ddev drush is easier than ddev exec drush

  8. HenningCash commented on May 12, 2018

    @HenningCash

    I'm currently trying ddev and was confused that ddev exec uses the webroot as working directory. The main reason for me is composer and dedicated web-directories: The composer.json will often (if not always) reside in the root-directory of the project. So simply running ddev exec composer install will fail and you have to set the working directory manually with ddev exec composer -d /var/www/html install.

    What about detecting the current directory (root or web or XYZ) and automatically use this as working directory for ddev exec|ssh?

  9. truls1502 commented on Jul 15, 2018

    @truls1502
    Contributor

    I am agreed with @rfay and @HenningCash because right now, we have a repo with composer and Drupal 8. Drupal 8 has a docroot. So today I have to run with a long command like ddev exec composer install -d /var/www/html. So it would be great to give us the options like root or docroot.

  10. added this to the v1.4.0 milestone on Nov 22, 2018
  11. 22 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions