Ddev: More than 10 hostnames per line of /etc/hosts breaks on Windows OS

Created on 28 Jun 2018  路  11Comments  路  Source: drud/ddev

Describe the bug
If too many host names are used in the project (additional_hostames - i.e. TYPO3 multisite projects), Windows does only allow a maximum of nine hosts per line. When installing (sudo.exe!) all host names are added in one line, so it is necessary to split the line manually.

https://superuser.com/questions/932112/is-there-a-maxium-number-of-hostname-aliases-per-line-in-a-windows-hosts-file

To Reproduce
Steps to reproduce the behavior:

  1. Add at least 8 host names to additional_hostnames in config.yaml
  2. Start ddev
  3. Try to open one of the host names 9+

Expected behavior
All host names should be resolved.

Screenshots
180628_ddev_max_hostnames

Version and configuration information (please complete the following information):

  • Host System: Windows 10
  • docker version:
Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:12:48 2018
 OS/Arch:      windows/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:22:38 2018
  OS/Arch:      linux/amd64
  Experimental: true
  • ddev version:
cli     v0.19.0
web     drud/nginx-php-fpm-local:v0.19.0
db      drud/mariadb-local:v0.19.0
dba     drud/phpmyadmin:v0.19.0
router  drud/ddev-router:v0.19.0
commit  v0.19.0
domain  ddev.local
  • config.yaml:
APIVersion: v0.19.0
name: h1
type: typo3
docroot: web
webimage: machbarsalzmann/nginx-php-fpm-local:1.3.0
php_version: "7.0"
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: true
additional_hostnames:
  - h2
  - h3
  - h4
  - h5
  - h6
  - h7
  - h8
  - h9
  - h10
provider: default
Prioritized

Most helpful comment

1575 takes the less ambitious approach of just warning Windows users.

All 11 comments

Thanks for this!

We do plan to add direct support for removing hostnames (soon) in ddev rm or just in ddev hostname.

As a workaround you can edit the hosts file to split lines at this point. You could also use the goodhosts utility in https://github.com/lextoumbourou/goodhosts/releases/tag/v2.1.0 to edit/remove.

I also made an upstream request in https://github.com/lextoumbourou/goodhosts/issues/11

Would be great if ddev checks this on startup and does the line splitting by itself. I think the multi site possibilites of TYPO3 are a key feature of the CMS.

This really isn't just a problem with multi-hostname, it's a problem with many projects, because we add but never remove hostnames at this point. Currently we only interact with the hosts file via goodhosts, which has explicit Windows support, and it doesn't seem to have a feature for this at this point.

OK, didn't know that! Keep up the good work. 馃憤

We now have hostname cleanup merged into our master branch and scheduled to come out with v1.1.0 next week https://github.com/drud/ddev/issues/831. I believe this will/should address this. Closing out because I believe this will be resolved as a result. Feel free to re-open if it doesn't!

Just a followup so this isn't too mysterious: What ddev now provides is:

  1. ddev hostname --remove-inactive, which does its best to clean up ddev-owned hostnames that are not currently being used.
  2. ddev remove --remove-data now cleans up hostnames that were associated with a project.

So this doesn't (yet?) directly access the 10-item Windows problem, but it certainly makes things easier than editing the hosts file.

Sounds good to me. But should this issue be re-opend, when it is not solved with the release v1.1.0. It's related to lextoumbourou/goodhosts, so I'm not quite sure.

I'm going to reopen; ddev could probably check to see how many items were added there and warn about it, and of course goodhosts is an open-source project, a PR can be submitted there.

I run into the same problem. Would be good if ddev could issue a note that there are too many hosts per line. Couldn't ddev just add a new line per host? Like this we would never run into the issue.

Yeah, the problem is that the library we use for this isn't responding to requests to do exactly that. (https://github.com/lextoumbourou/goodhosts/issues/11). It's worth considering doing a PR ourselves do solve this.

Your idea of having ddev look at the hosts file and give a warning is a good one, it would be nice to take a look at goodhosts and see if there's an easy way to do that.

1575 takes the less ambitious approach of just warning Windows users.

Was this page helpful?
0 / 5 - 0 ratings