Skip to content

hostname has to be properly configured #423

Open
kaos opened this Issue Sep 24, 2012 · 12 comments

6 participants

@kaos
Zotonic member
kaos commented Sep 24, 2012

If there's any issues in the hostname configuration, the communication with a running Zotonic instance may fail.

When the communication with a node fails, we could provide better diagnostics to help pin point the issue by checking that the configuration is consistent.

@arjan
Zotonic member
arjan commented Nov 8, 2012

I think you're talking about the node name of the system, right?
In that case, that has been fixed by my changes defaulting zotonic to -sname and the new ZOTONIC_DISTRIBUTED env var.

@arjan arjan closed this Nov 8, 2012
@kaos
Zotonic member
kaos commented Jun 26, 2013

Not really,

It can still fail, even with your changes, and when it does, I'd like better error messages. Also, some sort of diagnostic function to call that can report all relevant configuration settings it can find, and possible report on anything that looks fishy.

@kaos kaos reopened this Jun 26, 2013
@kaos
Zotonic member
kaos commented Jun 26, 2013

Typical issue:

# Mac OSX 10.8.3
# Erlang stable R15B03-1 (bottled) installed from Mac Homebrew

★ zotonic addsite zotryout -L
erl_call: can't ei_gethostbyname(HashNuke)
Zotonic is not running. You need to start Zotonic first to use this command.

★ erl_call -name zotonic001@HashNuke -a "zotonic status"; echo $?
erl_call: can't ei_gethostbyname(HashNuke)
1

★ erl_call -name zotonic001@HashNuke.local -a "zotonic status"; echo $?
ok0

The node was started properly, as it seems:

★ ps -ax | grep beam
87103 ttys003    0:00.00 grep beam
86990 ttys004    0:02.80 /usr/local/Cellar/erlang/R15B03-1/lib/erlang/erts-5.9.3.1/bin/beam.smp -P 10000000 -K true -- -root /usr/local/Cellar/erlang/R15B03-1/lib/erlang -progname erl -- -home /Users/akashmanohar -- -pa /Users/akashmanohar/src/zotonic/ebin /Users/akashmanohar/src/zotonic/deps/bear/ebin /Users/akashmanohar/src/zotonic/deps/bert.erl/ebin /Users/akashmanohar/src/zotonic/deps/bert/ebin /Users/akashmanohar/src/zotonic/deps/dh_date/ebin /Users/akashmanohar/src/zotonic/deps/eiconv/ebin /Users/akashmanohar/src/zotonic/deps/folsom/ebin /Users/akashmanohar/src/zotonic/deps/gen_smtp/ebin /Users/akashmanohar/src/zotonic/deps/lager/ebin /Users/akashmanohar/src/zotonic/deps/mimetypes/ebin /Users/akashmanohar/src/zotonic/deps/mochiweb/ebin /Users/akashmanohar/src/zotonic/deps/ua_classifier/ebin /Users/akashmanohar/src/zotonic/deps/webzmachine/ebin /Users/akashmanohar/src/zotonic/deps/z_stdlib/ebin /Users/akashmanohar/src/zotonic/modules/mod_oauth/deps/erlang-oauth/ebin /Users/akashmanohar/src/zotonic/priv/modules/*/deps/*/ebin /Users/akashmanohar/src/zotonic/priv/sites/*/modules/*/deps/*/ebin -sname zotonic001@HashNuke -boot start_sasl -config /Users/akashmanohar/src/zotonic/priv/erlang.config -sasl errlog_type error -s zotonic

This particular issue was resolved by adding HashNuke to the /etc/hosts/ file.

@ArthurClemens

Pff, I've spent hours on this. On my Mac, my terminal window says "arthur-2". Starting zotonic:

arthur-2:zotonic arthur$ ./bin/zotonic start
Starting Zotonic zotonic001@arthur-2
arthur-2:zotonic arthur$ ./bin/zotonic status
erl_call: can't ei_gethostbyname(arthur-2)
Zotonic is not running. You need to start Zotonic first to use this command.

Looking at zotonic_status, Zotonic was running.

Check with erl_call:

erl_call -name zotonic001@arthur-2; echo $?
erl_call: can't ei_gethostbyname(arthur-2)
1

erl_call -name zotonic001@localhost; echo $?
0

Finally, with Kaos' hint, I added arthur-2 to /etc/hosts:

127.0.0.1 arthur-2

and all worked as normal.

@arjan
Zotonic member
arjan commented Aug 7, 2013

Wow...

maybe we can add a sanity check to zotonic, trying to ping the hostname that zotonic will run under... and if the ping fails, print a horrible error message and exit.

@mworrell
Zotonic member
mworrell commented Aug 7, 2013

Yes, we definitely need such a sanity check.
This kind of bugs are too hard to trace back for mere mortals.

@kaos
Zotonic member
kaos commented Aug 7, 2013

👍

@ArthurClemens

Apparently an Mac OS update changed the machine name to MacBook-Pro. Luckily I found this discussion again.

@mworrell
Zotonic member

Good one - especially as we Mac OS X changes the hostname sometimes .... My machine sometimes get a '-1' or '-2' behind the name. This also gives problems when starting mnesia.

@stensonb

This is preventing me from trying Zotonic.

I have a /etc/hosts entry like this:

127.0.0.1 foo-bar

And when I try to add a site, I get this:

$ bin/zotonic addsite -s blog foo-bar
zotonic-addsite: Site name can only consist of lowercase alphanumeric and underscore characters.

My computer is named "foo-bar"...and I cannot change that. How do I tell Zotonic to be able to accept hyphens...https://tools.ietf.org/html/rfc1123 says hyphens are legal...

feeling frustrated

@arjan
Zotonic member
arjan commented Aug 12, 2015

A site's name and its hostname are usually not the same.

The site name is an Erlang identifier, the erlang module that holds the site's code will be named after the site name (eg foobar.erl); the site's hostname(s) can later be configured in a site's config file.

@ArthurClemens
@MerelyAPseudonym MerelyAPseudonym referenced this issue in Homebrew/legacy-homebrew Dec 22, 2015
Closed

Build RabbitMQ from source #47242

@ddeboer ddeboer modified the milestone: Release 1.0, Roadmap Jan 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.