Skip to content

drush.settings.php doesn't seem to work (on host), is also unmanaged and unhidden from git #454

Closed

Description

@rfay

What happened (or feature request):

When doing a site setup with ddev import-db (I think) on a drupal site we drop a drush.settings.php into the root of the repo (and include it from our generated settings.php). This was intended to allow access using drush from the host.

  • I don't think it works for running drush from the host right now: drush sql-cli on the host gets me various errors including include(): Failed opening [warning] '/Users/rfay/workspace/palisadeartlovers/docroot/sites/default../../../drush.settings.php'
  • We drop the file into the root of the repository. Unless the user adds it to gitignore or something, it becomes somewhat of an eyesore when attempting to maintain the repo.

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. added this to the v1.1.0 milestone on Sep 8, 2017
  2. modified the milestones: v1.1.0, v1.2.0 on Oct 21, 2017
  3. rfay commented on Dec 8, 2017

    @rfay
    MemberAuthor

    drush.settings.php is also the only user of $DEPLOY_NAME (which is always set to 'local'). It seems to be using it as a flag to detect whether drush is running in the container or on the host.

    DEPLOY_NAME should probably be removed in all its usages. A better-named env var might be appropriate. Bottom line is

    • drush.settings.php should work if it's going to exist
    • If it needs an env var in the container the env should be named better and have a useful value.
  4. mglaman commented on Feb 26, 2018

    @mglaman
    Contributor

    So for platform-docker I defined PLATFORM_DOCKER with the project name in the FPM and Nginx containers. This allowed me to know if I was in the host or not.

    This can be used to load the drush.settings.php. However this causes Console to break. I think there should be host.settings.php which is loaded whenever the env is missing.

    It could have something like this https://github.com/mglaman/platform-docker/blob/develop/resources/stacks/drupal8/settings.local.php

    Instead of my hack to call docker to get ports in

        $cmd = "docker inspect --format='{{(index (index .NetworkSettings.Ports \"3306/tcp\") 0).HostPort}}' {{ container_name }}";
        $port = trim(shell_exec($cmd));
    

    what if ddev start replaced the port somehow?

  5. mglaman commented on Feb 27, 2018

    @mglaman
    Contributor

    Thoughts on

    • When I run ddev start, my service ports are mapped to .ddev/ports.json
    • When I run ddev stop my service port maps are removed
    • When I run a CLI tool on my host, the CMS can be bootstrapped by services using port defined in .ddev/ports.json

    This would allow Solr, MySQL/Maria, Elastic, Redis support on host command line. I picked JSON because it's most easy thing to serialize/unserialize across languages.

    So regardless if WP-CLI, Drush, Console, whatever. Each CMS can support a host settings.

  6. rickmanelius commented on Feb 28, 2018

    @rickmanelius
    Contributor

    Hmm. Looks like a bug and therefore we'll want to prioritize it sooner than later. Not quite sure I feel like we've converged on a particular solution at the moment, but it looks like we have options.

  7. mglaman commented on Feb 28, 2018

    @mglaman
    Contributor

    I moved my ideas into #691 so this could be worked on as a bug fix and not bloat the scope.

  8. mglaman commented on Feb 28, 2018

    @mglaman
    Contributor

    Note: this can only be reproduced if you ran a database import.

  9. removed this from the v1.2.0 milestone on May 17, 2018
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions