This page will explain how to make a health check page where HAProxy is used to check the status for each one of our platforms.
Ruby on Rails/Mongrel
- Copy mongrel_health_check.rb (attached below) into your server or svn
- Add "config_script: /path/to/file" to /etc/mongrel_cluster/mongrel_cluster.yml
- Set OPT_HEALTH_CHECK_URI to "/mongrel-status"
Tomcat
- Create a file named health_check.jsp in your application with the following contents.
<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
</HEAD>
<BODY>
<H1>Hello World</H1>
Today is: <%= new java.util.Date().toString() %>
</BODY>
</HTML>
- Set OPT_HEALTH_CHECK_URI to "/health_check.jsp"
PHP
- Create a file named health_check.php in your application with the following contents.
<?php
phpinfo():
?>
- Set OPT_HEALTH_CHECK_URI to "/health_check.php"
HAProxy
- If your sit'e permissions allow it, you can simply add 'haproxy-status' to your domain to check the status of HAProxy.
ex: http://www.mysite.com/haproxy-status