uses HAPROXY under the hood.
route between your legacy and your new application using different strategies
set the following environment variables for this container:
STRATEGY=PERCENTAGE | COOKIE
OLD_DOMAIN=old.domain.com:443
NEW_DOMAIN=new.domain.com:443
COOKIE_STRATEGY_NAME="my_app_routing=new"
COOKIE_PERCENTAGE_NAME=my_app_sticky_name
PERCENTAGE_OLD=70
PERCENTAGE_NEW=30
PERCENTAGE
will route the traffic based on the percentage of the old and new applicationCOOKIE
will route the traffic based on a present cookie value (COOKIE_STRATEGY_NAME
)
the domain of the old application
the domain of the new application
this cookie will taken into account when a forced routing to the new application is wanted
this is the name of the cookie for implementing the sticky session
how much traffic should be routed to the old application
how much traffic should be routed to the new application
build the image
docker build -t statista-proxy .
run the container
docker run -p80:80 -e STRATEGY=PERCENTAGE -e OLD_DOMAIN=haproxy.com:443 -e NEW_DOMAIN=apache.org:443 -e PERCENTAGE_NEW=50 -e PERCENTAGE_OLD=50 -e COOKIE_PERCENTAGE_NAME=my_app statista_proxy
run requests (since its round robin every request should be flipped)
curl -I localhost:80
notice the
set-cookie
header which should containmy_app=new_domain
ormy_app=old_domain
further requests made by the same client will stick to this server
docker run -p80:80 -e STRATEGY=COOKIE -e OLD_DOMAIN=haproxy.com:443 -e NEW_DOMAIN=apache.org:443 -e COOKIE_STRATEGY_NAME="my_app_routing=new" statista_proxy
run requests (since its round robin every request should be flipped)
curl -I localhost:80
should be the old application
curl -I --cookie "my_app_routing=new" localhost:80
should be the new application
routing-proxy:
image: ghcr.io/statista-oss/routing-proxy:latest
environment:
STRATEGY: PERCENTAGE
OLD_DOMAIN: haproxy.com:443
NEW_DOMAIN: apache.org:443
COOKIE_PERCENTAGE_NAME: my_app
PERCENTAGE_OLD: 50
PERCENTAGE_NEW: 50
ports:
- 80:80
currently only HTTP (as it mostly will run behind an SSL loadbalancer anyways) is supported.
when defining this image in your Task-Definition
, make sure you add those systemControls
:
{
systemControls: [
{
namespace: 'net.ipv4.ip_unprivileged_port_start',
value: '0',
}
]
}
- add SSL support
- logging support?
- route based on specific users/user-groups (cookie lookups)