Make apache run properly on Windows, fixes #1109 #1111
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Problem/Issue/Bug:
Apache doesn't work at all on Windows.
There are two problems.
First: https://github.com/drud/ddev/blob/5ed08dc93b285b00fb77ab5ec35fabcaf375ad64/containers/ddev-webserver/files/etc/apache2/envvars#L49-L50 is overwritten with uid_0 (which didn't exist in /etc/passwd)
Second:
Apache just won't run as root. Period. Without recompiling.
How this PR Solves The Problem:
Use uid 1000 in windows instead of using uid 0. This seems to work fine. I've checked to make sure that at least with docker-for-windows files created by the webserver come through as the correct user on the host.
Manual Testing Instructions:
Use apache-fpm as webserver_type on Windows.
Automated Testing Overview:
Related Issue Link(s):
OP #1109
Release/Deployment notes:
This changes the UID used inside the web container to UID 1000 instead of root (uid 0). Although this seems to have no detectable problems on docker for windows in terms of creating files with improper uid there could be side-effects. But it's sure nice to not be running as root inside the container.
This also might causes issues to some Windows user doing an exec hook without sudo.