User another TLD instead of .local

Issue #99 resolved
LiAh Sheep created an issue

Let’s change *.openshift.local to *.openshift.vm or whatever:

  • cnpaas-openshift/Vagrantfile
  • cnpaas-openshift/bin/init/dev-bootstrap.sh
  • cnpaas-openshift/bin/init/ext-domain-setup
  • cnpaas-openshift/bin/init/set-env
  • cnpaas-portal/config/autoload/app_config.env.yml
  • cnpaas-portal/config/autoload/paas_cfg.env.yml

Some references articles explaining this stupid behaviour:

ACCESSING .LOCAL DOMAINS IS SLOW ON MAC OS X

This appears to be a fault in Mac OS X Lion, where it takes 5 seconds to resolve .local domain names, even if they are hardcoded in your /etc/hosts file. You can work around this problem by using Charles's DNS Spoofing tool intead of /etc/hosts, however you'll experience the .local DNS resolution delay when not using Charles. I recommend using an alternative TLD such as .dev.

Comments (13)

  1. LiAh Sheep reporter

    The hostname change didn't work because the following line was unstable for Vagrantfile:

    config.vm.hostname = "broker.openshift.vm"
    

    Looking for other methods.

  2. LiAh Sheep reporter

    The line was unstable because I haven’t updated /etc/hosts properly. This solution should actually be fine.

  3. Jimmy Chu
    • changed status to open

    Will work on this after Apr 2nd.

    Ideally, broker hostname is called broker01.oo.cnpaas.localhost. App domain will be apps.cnpaas.localhost, so we have a more consistent prod/staging/prod naming.

  4. LiAh Sheep reporter

    But the problem is .localhost is used for 127.0.0.1 by default. I'm not sure if dnsmasq can set it properly?

  5. Jimmy Chu

    I believe they are configurable both on /etc/host and dnsmasq.

    Set localhost to one IP, and abc.localhost to another IP.

  6. LiAh Sheep reporter

    Found a workaround (finally). Short answer is to use the following in /etc/hosts:

    ::1 broker.openshift.local apps.openshift.local
    ::1 app01-test01.apps.openshift.local
    
    192.168.33.10 broker.openshift.local apps.openshift.local
    192.168.33.10 app01-test01.apps.openshift.local
    

    Long answer:

    Mac OS looks up .local domains by the following order:

    1. IPV6 entries in /etc/hosts
    2. IPV6 Bonjour service
    3. IPV4 entries in /etc/hosts
    4. IPV4 Bonjour service

    The 5-second timeout occurs in Step 2, when Mac couldn’t find a machine matching the host name, then it proceeds to Step 3. If we add duplicate ::1 entries in /etc/hosts, we can trick Mac to think it is a IPV6 address and proceed to Step 3 directly.

    Ref:

  7. Log in to comment