Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to provide some fail-over capacity to our web farm, so I'm looking at various open-source reverse proxy platforms (haproxy, nginx, Varnish, Cherokee, and Squid) to direct http and SSL traffic to our MS/IIS web servers. My preference would be to deploy the reverse proxy to a Linux environment (though I'm open to alternate suggestions).

Ideally, I'd like to be able to control deployments to the production environment by removing/adding hosts to the reverse proxy's configuration as a deployment is occurring.

Our development is all .NET\C#, so it would be really handy if any of the proxy packages I mentioned above have an external API that is friendly to Windows/SOAP/REST clients.

As a worst-case, I suppose I could write a Mono/C# app to listen for commands, update the required config files, then HUP the proxy service...but that seems like a lot of work for a lazy programmer like me.

Does anyone have a suggestion (or two, or three)

Thanks!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I don't know about the others but you can control HAProxy via a Unix socket or use httpchk

1. Control via unix socket

If you have stats socket /var/run/haproxy.sock level admin in you config file :

echo "disable server production/prod02" | socat stdio /var/run/haproxy.sock
echo "enable server production/prod02" | socat stdio /var/run/haproxy.sock

will do the trick

There is also a Perl module to simplify control via the socket.

All commands can be found here

2. Using httpchk

Alternatively if you have this in your backend config

backend production
  option httpchk HEAD /check.txt HTTP/1.0
  http-check disable-on-404
  server prod01 192.168.0.77:81 check
  server prod02 192.168.0.72:81 check

When you remove the check.txt file the server is removed from the LB and added back when you touch the file.

Those two methods are not really external API but should be quite easy to add to your deployment script. (I'm using capistrano for Rails, something similar should exist for you environment)

share|improve this answer
    
You could also stop the web server and wait for the load balancer to remove it from the pool. It should work with any of them (tried on haproxy and squid). However, it's not really a graceful shutdown... –  ouranos Dec 15 '11 at 0:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.