HAProxy Enterprise Documentation 1.6r1

Blue-Green Deployments

In the blue-green deployment release model, traffic is gradually transferred from a production backend, referred to as blue, to a nearly-identical new release referred to as green.


Use an HAProxy Enterprise map file and the Runtime API to manage this type of deployment.

  1. Create a text file at /etc/hapee-1.6/maps/bluegreen.map with a single entry:

    active backend_blue
  2. Modify your HAProxy Enterprise configuration to include both a blue and a green backend and add a use_backend directive to your frontend to reference the map file.

    The backend currently set in the map file will be selected for all traffic.

    frontend fe_main
        bind :80
        use_backend %[str(active),map(/etc/hapee-1.6/maps/bluegreen.map)]
    backend backend_blue
        server server1 check
        server server2 check
    backend backend_green
        server server1 check
        server server2 check
  3. Use the Runtime API to modify the map to move traffic from blue to green as open connections to be_blue close:

    $  echo "set map /etc/hapee-1.6/maps/bluegreen.map active be_green" | socat stdio /var/run/hapee-1.6/hapee-lb.sock

Next up