Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you have health checks in your web app or web site? [closed]

I have built PHP based "health check" scripts for several projects in the past, but they were always custom-made for the occasion and not written for abstraction as an independent product. I would like to know whether such a solution exists.

What I meam by "health check" is a protected web page that functions much like a suite of unit tests, but on a more operational level, showing red/yellow/green statuses for things like

  • Are the cache directories writable?
  • Is the PHP version correct, are required extensions installed?
  • Is the database server reachable?
  • Do the necessary tables exist in the database?
  • Is there enough disk space available?
  • Is the site's front page reachable and renders fully ( = no PHP errors)?
  • Do the project's libraries' MD5 checksums match the original ones?
  • Does the front page's output pass the W3C validator?

Do you do this - or parts of it - in your applications and web sites?

Are there any standardized tools for this that bring along all the functionality to perform the tests (ideally as plugins), and just need to be configured accordingly?

I am talking about a lightweight solution that can run even on the tiniest of PHP-based web packages with no extensions and server access.

Is there, maybe, a way to set this up using one of the Unit Testing frameworks available for PHP (preferably PHPUnit)? If so, do you know any resources / tutorials outlining how?

Update: There does not seem to be a popular ready-made solution for this, otherwise, with more than 100 views, I'm sure there would have been some mention of it. Seeing as there's some initial interest in building such a tool as an open source project, please feel free to post what an ideal solution for you would look like, and what features it would have to have.

like image 245
Pekka Avatar asked Mar 09 '10 00:03

Pekka


People also ask

What is a website health check?

Key elements of a website health check These are security, performance, search visibility, user experience, and monitoring and alerts.

How do I check my health application?

The most common way of running application health checks is by routinely interacting with a “ping” endpoint. This is an extra endpoint added to a service for the sole purpose of expressing its availability. This is a pretty good way of checking if a service is running or not.

How do I enable health check in Azure App?

To enable Health check, browse to the Azure portal and select your App Service app. Under Monitoring, select Health check. Select Enable and provide a valid URL path on your application, such as /health or /api/health . Click Save.

What are health checks in AWS?

Health checks are a way of asking a service on a particular server whether or not it is capable of performing work successfully. Load balancers ask each server this question periodically to determine which servers it is safe to direct traffic to.


1 Answers

Interesting question, but this is pretty broad. I haven't seen an unit testing tool yet which does all the backend, midend and frontend testing at once. I checked this list, but no one does it all. There is however one generic approach, xUnit (fully automated testing).

The major blockers are that backend testing is platform/DB specific and that midend testing is programming-language specific. And then yet to combine those limitations with frontend testing. The tool should then have to support almost all languages and platforms the world is aware of. I don't think such tool would ever be available in open source world. It's an utopia.

In theory it's indeed possible to have a testing framework with plugin capabilities, maybe based on the xUnit ideology, but one has yet to write/invent/opensource it. You? It's indeed a hole in the market.

At any way, for frontend unit testing (HTML/CSS/JS/forms) I would recommend Selenium, or if you have the money, TestComplete. I have seen it been used at IBM several years back, it was awesome to see it in action and the testers were very happy with this.

For midend unit testing (programming code, the business logic), just continue with the programming language specific unit testing tools like PHPUnit for PHP and JUnit for Java.

Regarding backend unit testing (DB, filesystem), I've used PGTap for PostgreSQL, but there are also generic DB tools available for this such as SQLUnit (which is however last updated almost 4 years back...). For the local disk file system conditions you'll have to grab platform specific scripting languages.

like image 132
BalusC Avatar answered Oct 02 '22 21:10

BalusC