You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web container should mount the full project directory, not just docroot #189
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):
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.
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.
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.
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.
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.
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.
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)
Activity
rickmanelius commentedon May 3, 2017
This will absolutely need to happen by the time we're handling provider plugins.
tannerjfco commentedon May 4, 2017
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.
rfay commentedon May 4, 2017
And what about the case where public files and private files aren't even on the same partition/mount?
tannerjfco commentedon May 12, 2017
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.
rickmanelius commentedon May 12, 2017
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.
beeradb commentedon May 12, 2017
Rather than introducing a moving piece like Dockergen, I'd probably prefer mount to
/app(or similar) and symlink the docroot to/var/www/htmlon 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.tannerjfco commentedon May 12, 2017
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.
rfay commentedon May 12, 2017
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.
tannerjfco commentedon May 12, 2017
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)