HAProxy Enterprise Documentation 2.1r1

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.

Examples

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

  1. Create a text file at /etc/hapee-2.1/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-2.1/maps/bluegreen.map)]
    
    backend backend_blue
        server server1 10.0.0.3:80 check
        server server2 10.0.0.4:80 check
    
    backend backend_green
        server server1 10.0.0.5:80 check
        server server2 10.0.0.6:80 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-2.1/maps/bluegreen.map active be_green" | socat stdio /var/run/hapee-2.1/hapee-lb.sock

Next up

Rewrites