Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Server Side Host Check #19

Open
LeeThompson opened this issue Feb 2, 2023 · 9 comments
Open

[Feature] Server Side Host Check #19

LeeThompson opened this issue Feb 2, 2023 · 9 comments

Comments

@LeeThompson
Copy link

LeeThompson commented Feb 2, 2023

An option to have host check done on the server side rather than the browser.

This would be useful for:

  • Work around http/https issues
  • Allow remote checking of intranet services
  • Allow checking for services on an isolated subnet

This may also be a fix for #16

@erohtar
Copy link
Owner

erohtar commented Feb 3, 2023

That actually might be a good idea - I'll definitely try it.
Thank you!

@erohtar
Copy link
Owner

erohtar commented Feb 25, 2023

I feel really bad not responding here sooner, but I've been really busy recently, and once when I got to work on this (about a week back) I was getting errors that didn't make sense - turns out it was my local php server at fault that I had up for testing.

Anyway, pls try this when you get a chance. I've made the server check really flexible by making it a per-tile setting (just like disableCheck)

  • serverCheck - (Optional) If set to 1, the online check will run at the server, instead of in browser

The server check would likely only work for urls that are externally accessible (as opposed to Tailscale generated ones, as is the case with most of mine), but I'm open to updating the php function if needed.

dasherr.1.06.00.beta.zip

@LeeThompson
Copy link
Author

LeeThompson commented Feb 26, 2023

Seems to work but seeing some unexpected anomalies with a https & http mix where it's actually inconsistent. I am really not sure what's going on with it and I'm not prepared to think it's an issue with dasherr at this point. Will do more testing.

It would be nice if these serverCheck and disableCheck could be set at section and page levels as well.

Update: For some reason the widgets aren't working anymore if I'm in https, if I'm in http they work.

@erohtar
Copy link
Owner

erohtar commented Feb 27, 2023

It would be nice if these serverCheck and disableCheck could be set at section and page levels as well.

Right now I feel the server check is only good for exceptional use and someone would enable it in select few tiles. If it was more widely usable then I'd also feel this is called for. Though it's possible that my personal setup is what makes me see it that way (nothing open to outside internet, and every machine on Tailscale).

For some reason the widgets aren't working anymore if I'm in https, if I'm in http they work.

I'm willing to bet that has something to do with mixed content. Maybe if someday I moved the widget processing to php as well, but that day is not today :)

@LeeThompson
Copy link
Author

Fair enough!

I don't use Tailscale myself, most of the stuff isn't internet accessible but a few are.

@erohtar
Copy link
Owner

erohtar commented Mar 1, 2023

Is Glances internet accessible? For me it isn't and server can't access something via php if I give it a Tailscale address or localhost. Though I'm not ruling out the possibility of me mucking something up because of my inexperience with how server side programming works.

@LeeThompson
Copy link
Author

No, right now everything I'm doing is intranet. Glances is local only. In theory the php test should work in either case since it is on the same local subnet as Glances.

@erohtar
Copy link
Owner

erohtar commented Mar 2, 2023

Next chance I get, I'll create an extremely simple PHP to test if Glances data can be read at the server and then JS can pull that info periodically through there instead of directly - you think that might help solve any CORS/MixedContent related issues?

@LeeThompson
Copy link
Author

It should since the PHP function will be essentially acting as a proxy and since Dashrr would presumably be running on the same subnet as Glances it should be fine.

I already do monitoring of intranet services this way. (Personally I don't really need Dashrr's checks for that reason but I imagine others might want it to be more flexible but it's really locked down on the web client side - and rightfully so.)

DtxdF added a commit to DtxdF/Dasherr that referenced this issue Dec 6, 2023
Check of services is now handled by the host using a small PHP script
that receives the URL to connect to and checks not only if it is
alive, but also checks its status code or returns 502 as fallback.
Check the status code is necessary in many cases, especially related
to the container world, since the status code can be used to see if a
service is really alive or dead (playing with healthcheckers and small
services that perform this task, for example).

The checkOnline() function in worker.js has been modified a bit for
reuse. I think another approach to implement this feature is to send
an identifier to the PHP script that does a read to settings.json to
get the URL of the website to check. I think this is a bit more complex,
but it only makes sense if the settings.json cannot be modified through
the web UI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants