Skip to content

Web container should mount the full project directory, not just docroot #189

Closed

Description

@tannerjfco

What happened (or feature request):

Our initial solution to support sites containing site files to serve within a folder like docroot was to change the mount point on the container to the docroot folder. This works fine if all code and assets necessary for the site to run exist within docroot, but if the site relies on code or assets above the docroot, they are unavailable to the web container, which is likely to cause the site to fail to function as expected.

What you expected to happen:

Sites need their full code base available in order to serve successfully. We should change the mount point to satisfy this need, and consider a different solution for changing the path the web container serves the site from.

How to reproduce it (as minimally and precisely as possible):

This is easiest demonstrated by attempting to spin up a project that uses composer with a vendor directory outside the docroot. For a d8 example, see https://github.com/drupal-composer/drupal-project. Attempting to start this project in ddev will cause drupal to fatal error, unable to find the vendor directory.

Anything else do we need to know:

Related source links or issues:

Activity

  1. added this to the milestone on May 3, 2017
  2. rickmanelius commented on May 3, 2017

    @rickmanelius
    Contributor

    This will absolutely need to happen by the time we're handling provider plugins.

  3. tannerjfco commented on May 4, 2017

    @tannerjfco
    ContributorAuthor

    I think we should consider prioritizing this issue, as it can affect users today. If their site depends on assets above docroot, it is very likely their site will not function with ddev. In my experience its a common pattern, so I expect it's not a small number of cases either.

  4. rfay commented on May 4, 2017

    @rfay
    Member

    And what about the case where public files and private files aren't even on the same partition/mount?

  5. tannerjfco commented on May 12, 2017

    @tannerjfco
    ContributorAuthor

    Changing the mount point back to the project root should be trivial, but we'll need a way to update the nginx configuration to reflect the docroot path. This is defined in the server block of the nginx config, which doesn't handle environment variables unfortunately. We could add docker-gen to allow dynamic updating of the configuration similar to how the nginx-proxy works. While we currently only need to change a single line of configuration, I wouldn't be surprised if we needed to account for more configuration scenarios for the web nginx config in the future.

  6. rickmanelius commented on May 12, 2017

    @rickmanelius
    Contributor

    I'm assuming we're going to need the ability to tailor/tweak additional values, so that makes sense to pursue. I imagine we should split that out into a separate issue versus tracking both here even though that would be a dependency for this to proceed.

    Also, a separate issue for the private directory question from @rfay would also be handy.

  7. beeradb commented on May 12, 2017

    @beeradb
    Contributor

    Rather than introducing a moving piece like Dockergen, I'd probably prefer mount to /app (or similar) and symlink the docroot to /var/www/html on container start (unless I'm missing some reason that won't work). Dockergen is something we have to deal with in the nginx-proxy, but honestly the templates are fairly unwieldy and I'm not eager to introduce it elsewhere.

  8. tannerjfco commented on May 12, 2017

    @tannerjfco
    ContributorAuthor

    IMO we have already done a workaround for updating the nginx configuration, and shouldn't pursue another one, since we can reasonably expect additional future configuration requirements such as handling private files. A symlink may work just fine, but may also cause unexpected behavior and/or confusion for users. I don't have specific examples, but vaguely recall seeing issues on a couple specific projects.

    I certainly understand hesitation to introduce docker-gen elsewhere based on the complexity of the nginx-proxy templating, but its worth noting that nginx-proxy is dealing with quite a bit more complexity than I think we'd be dealing with in this situation. I can't say introducing it is the most exciting prospect, but I feel like we should be able to address our needs more simplistically than what nginx-proxy is doing.

  9. rfay commented on May 12, 2017

    @rfay
    Member

    I kind of wonder if we need some kind of yaml that just describes mounts to be done and where they end up on nginx. More config and possibly complexity than I would prefer, but something like that is going to end up happening at some point. There's no reason to assume that one mount will do the job, or even 2.

  10. tannerjfco commented on May 12, 2017

    @tannerjfco
    ContributorAuthor

    I think if we change the mount back to project root, it will address most people's needs in terms of container volume mounting. If users needed to provide an additional mount, they can now do so by providing a compose override file that defines an additional mount for the web container (or others as they see fit)

  11. modified the milestones: v0.8.0, v1.1.0 on Jun 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions