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.
Create a text file at /etc/hapee-2.4/maps/bluegreen.map with a single entry:
Modify your HAProxy Enterprise configuration to include both a blue and a green backend and add a
use_backenddirective 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.4/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
Use the Runtime API to modify the map to move traffic from blue to green as open connections to
$ echo "set map /etc/hapee-2.4/maps/bluegreen.map active be_green" | socat stdio /var/run/hapee-2.4/hapee-lb.sock