azukiapp / azk

azk is a lightweight open source development environment orchestration tool. Instantly & safely run any environment on your local machine.
http://azk.io
Apache License 2.0
899 stars 63 forks source link

Domain name fails when I'm offline #446

Open dynaum opened 9 years ago

dynaum commented 9 years ago

When there is no internet connection the domain name of azk apps fail to respond.

gullitmiranda commented 9 years ago

@dynaum,

Unfortunately, this is an issue related with OS X, since it ignores /etc/resolver when disconnected.

The same issue occurs in http://pow.cx/ and is discussed in #104. The troubleshooting Can't access hosts while offline on OS X purposes the following solution:

This is due to a bug in the OS X resolver system. As a workaround, you can create an Ad-Hoc Wifi Network or add the hosts to your /etc/hosts file (perhaps with powder). See the discussion about this issue.

We're trying to figure out an alternative solution, but this is a kind of complex problem and we want to solve it in an elegant way, so it shouldn't be available so soon.

gullitmiranda commented 8 years ago

for now this solution is working for me:

$ brew install dnsmasq
# Create dnsmasq configuration file (using sample)
$ cp "$(brew --prefix dnsmasq)"/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
# add dnsmasq to startup
$ sudo cp -fv "$(brew --prefix dnsmasq)"/*.plist /Library/LaunchDaemons
$ sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
# launch dnsmasq
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

to test, disable all networks and run:

$ azk agent start
$ dig dev.azk.io
$ ping -c 4 dev.azk.io

if someone can test and if it works without problems, we can see a way to implement this. cc/ @alexferreira

reference: http://stackoverflow.com/questions/26840768/yosemite-localhost-resolver-and-dnsmasq-fails-offline

alexferreira commented 8 years ago

hi @gullitmiranda tested the solution offline and not had any problems, I had to offline thoroughly test because I need some stuff online, I am using online and already there was the problem twice efetuei the request for api and has failed, or came in api then sent the same request again and passed, it happened at two different points of application. to put a log on the api to confirm that this not getting

gullitmiranda commented 8 years ago

thanks for the feedback @alexferreira. I'll try to replicate this problem. Perhaps it will be necessary to make a restart in the application or Agent when there are changes in the network.

This problem can also be related to issue #588.

alexferreira commented 8 years ago

@gullitmiranda Added the dnsmas as reported, the problem still persisted, only ended when I added the local dns configuration of the machine ip 127.0.0.1 making before it get on an external dns first verificasse on site

gullitmiranda commented 8 years ago

nice @alexferreira. I am testing here also