muesli / beehive

A flexible event/agent & automation system with lots of bees 🐝
GNU Affero General Public License v3.0
6.31k stars 324 forks source link

Broken Webserver? #156

Closed JZHeadley closed 5 years ago

JZHeadley commented 7 years ago

I've tried to build and run the code but I can't seem to get to a working webserver. Whenever I run the built beehive executable and navigate to the webpage, I get the following errors:

OPTIONS http://localhost:8181/v1/hives net::ERR_CONNECTION_REFUSED Error while processing route: hives.all The adapter operation was aborted Error The adapter operation was aborted

I've tried to make it work with pretty much all of the config options as well as with docker both building the image myself and using the prebuilt image.

Centos 7.3.1611 go version 1.8.3 selinux is enable but I disabled it for a bit and tried yet still got the same errors.

Any ideas?

muesli commented 7 years ago

Maybe your localhost resolves to an IPv6 address only? Try http://127.0.0.1:8181/ instead.

JZHeadley commented 7 years ago

Its a headless server so that was a bit difficult to try but I connected with firefox through X over ssh and still nothing.

muesli commented 7 years ago

That sounds a bit over-complicated ;-) Why don't you just expose Beehive's web interface via a reverse proxy (e.g. nginx)? Or run an SSH-tunnel to the headless server?

muesli commented 7 years ago

You can also expose the web interface publicly by binding it to a different address. See the command line args -bind and -canonicalurl.

JZHeadley commented 7 years ago

Command run: ./beehive -bind "192.168.8.116:8181" Output after trying to connect

Still get the same errors as above.

muesli commented 7 years ago

Well, certainly looks like Beehive is behaving fine and responding to requests. This must be a local issue, sorry. I'd probably investigate your firewall.

muesli commented 7 years ago

Note that I'm of course happy to still help you debug this further, but from what I can tell by the logs, this issue really is out of Beehive's domain.

HenryQW commented 6 years ago

@muesli I'm running into this very same issue.

Chrome console produces the same error

OPTIONS http://localhost:8181/v1/hives net::ERR_CONNECTION_REFUSED

And Beehive container seems to be fine

INFO[0000] Registering Resource                          Resource=HiveResource
INFO[0000] Registering Resource                          Resource=BeeResource
INFO[0000] Registering Resource                          Resource=ChainResource
INFO[0000] Registering Resource                          Resource=ActionResource
INFO[0000]
INFO[0000] Beehive is buzzing...
INFO[0001] Handling request                              Method=GET URL=/
INFO[0001] serving config/index.html ... (from )
INFO[0001] Finished request                              Duration=13.628801ms Method=GET Response=200 URL=/
INFO[0001] Handling request                              Method=GET URL=/assets/vendor-be4f842fde3a872763f02c82eea2cca0.css
INFO[0001] serving config/assets/vendor-be4f842fde3a872763f02c82eea2cca0.css ... (from assets/vendor-be4f842fde3a872763f02c82eea2cca0.css)
INFO[0001] Finished request                              Duration=1.144682ms Method=GET Response=200 URL=/assets/vendor-be4f842fde3a872763f02c82eea2cca0.css
INFO[0001] Handling request                              Method=GET URL=/assets/vendor-b3fb1a9072b30aa6b2b5a5a6f72c2d21.js
INFO[0001] Handling request                              Method=GET URL=/assets/beehive-admin-9c9bdb140077ec813901397800ee631f.css
INFO[0001] Handling request                              Method=GET URL=/assets/beehive-admin-a5b1e40caf9c5a7c62f689308573a1d0.js
INFO[0001] serving config/assets/beehive-admin-9c9bdb140077ec813901397800ee631f.css ... (from assets/beehive-admin-9c9bdb140077ec813901397800ee631f.css)
INFO[0001] Finished request                              Duration=8.236946ms Method=GET Response=200 URL=/assets/beehive-admin-9c9bdb140077ec813901397800ee631f.css
INFO[0001] serving config/assets/vendor-b3fb1a9072b30aa6b2b5a5a6f72c2d21.js ... (from assets/vendor-b3fb1a9072b30aa6b2b5a5a6f72c2d21.js)
INFO[0001] serving config/assets/beehive-admin-a5b1e40caf9c5a7c62f689308573a1d0.js ... (from assets/beehive-admin-a5b1e40caf9c5a7c62f689308573a1d0.js)
INFO[0001] Finished request                              Duration=17.339281ms Method=GET Response=200 URL=/assets/beehive-admin-a5b1e40caf9c5a7c62f689308573a1d0.js
INFO[0001] Finished request                              Duration=28.551478ms Method=GET Response=200 URL=/assets/vendor-b3fb1a9072b30aa6b2b5a5a6f72c2d21.js
INFO[0002] Handling request                              Method=GET URL=/favicon.ico
INFO[0002] serving config/index.html ... (from favicon.ico)
INFO[0002] Finished request                              Duration="530.896µs" Method=GET Response=200 URL=/favicon.ico
INFO[0002] Handling request                              Method=GET URL=/favicon.ico
INFO[0002] serving config/index.html ... (from favicon.ico)
INFO[0002] Finished request                              Duration=1.449189ms Method=GET Response=200 URL=/favicon.ico

@JZHeadley were you able to solve it?

muesli commented 6 years ago

@WangQiru: It seems to serve something. What address do you enter in your browser to access Beehive? What cli-args do you start Beehive with?

HenryQW commented 6 years ago

@muesli I spun up a test instance via docker, so it should be

ENTRYPOINT ["beehive", "-config", "/conf/beehive.conf", "-bind", "0.0.0.0:8181"]

I also tried https://github.com/muesli/beehive/pull/179 (CANONICAL_URL env parameter) but it gives the same error.

muesli commented 6 years ago

@WangQiru: Two things I'd try in that case:

  1. Access Beehive with http://127.0.0.1:8181 - see my first comment in this thread.

or

  1. Add an extra parameter to the Dockerfile: "-canonicalurl", "http://your_host_ip:8181". Replace your_host_ip with the IP of the machine hosting the docker container. Now try to access the admin interface with http://your_host_ip:8181 in your browser, too.

Let me know if that helps.

HenryQW commented 6 years ago

@muesli Solution 2 finally worked... there is a delay due to my corporate firewall and squid proxy.

muesli commented 6 years ago

@WangQiru That would definitely be a bug, yes. It's a bit odd, because I can't reproduce it without docker, but it sounds like the canonicalurl default gets overwritten with an empty string somehow. I'll come up with a fix.

Thanks for reporting & investigating the cause!

HenryQW commented 6 years ago

Using docker, I also noticed that beehive doesn’t write into beehive.conf, which means any bees created will not be saved, a browser tab refresh will clear everything. It’s probably just a permission issue.

LennyPenny commented 6 years ago

I'm still experiencing the problems outlined here - shouldn't #179 be merged?