Describe the bug
Sorry, I can't say if it was ever intended to be used. I used it to get the project root (instead of hardcoding it as /var/www/html) inside the web container.
To Reproduce
Add a post-start hook in config.yaml:
hooks:
post-start:
- exec: env
The environment variable $WEBSERVER_DOCROOT was available until 1.14.2
Expected behavior
$WEBSERVER_DOCROOT contains the project root path inside the web container.
Version and configuration information (please complete the following information):
docker version) Client: Version: 19.03.6 API version: 1.40 Go version: go1.12.17 Git commit: 369ce74a3c Built: Fri Feb 28 23:45:43 2020 OS/Arch: linux/amd64 Experimental: false Server: Engine: Version: 19.03.6 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: 369ce74a3c Built: Wed Feb 19 01:06:16 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.3.3-0ubuntu1~18.04.2 GitCommit: runc: Version: spec: 1.0.1-dev GitCommit: docker-init: Version: 0.18.0 GitCommit:
Yes, it was removed. It was used to preprocess the apache and nginx files inside the web container. But now they're preprocessed by ddev on the host, so the file in ~/.ddev/nginx_full doesn't need that any more.
How do you use it? (It was actually the docroot, not /var/www/html (which is sometimes the docroot)
And thanks for testing!
I actually used it as project root. E.g. to get the directory ./data, I would use "$WEBSERVER_DOCROOT"/data.
In our TYPO3 projects we usually use this setup (config.yaml):
working_dir:
web: /var/www/html/src
docroot: src/public
I used it in these scripts, too:
https://github.com/drud/ddev-contrib/blob/master/custom-commands/dump-and-deploy-db/web/dump-db
https://github.com/drud/ddev-contrib/blob/master/custom-commands/dump-and-deploy-db/web/deploy-db
I am fine if it's gone. I was not sure if project root would always be /var/www/html but that seems to be a given now.
The project root is always /var/www/html; I guess the fact that $WEBSERVER_DOCROOT was always /var/www/html (without the docroot) is that that change was made in an environment that didn't propagate to your usage, so it was always misleading that it was called "DOCROOT".
I think we're better off without this environment variable, but I'm open to convincing. Sorry to break your scripts.
I guess you're willing to lose this as well. I'll add a note to the release notes.
No problem. It was undocumented so I am not to blame anyone if it's gone.
Closing then, happy to provide something in its place if it's useful.
If you have scripts that still use $WEBSERVER_DOCROOT just put this at the top of the script to define it in case it isn't available:
: "${WEBSERVER_DOCROOT:=/var/www/html}"
Most helpful comment
Closing then, happy to provide something in its place if it's useful.