Skip to content

Commit ad8a983

Browse files
committed
Merge pull request #3088 from dialoghq/feature/affinity
feat(router): add optional query string affinity support
2 parents 192439b + 92a5549 commit ad8a983

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

docs/customizing_deis/router_settings.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ setting description
3737
/deis/controller/host host of the controller component (set by controller)
3838
/deis/controller/port port of the controller component (set by controller)
3939
/deis/domains/* domain configuration for applications (set by controller)
40+
/deis/router/affinityArg for requests with the indicated query string variable, hash its contents to perform session affinity (default: undefined)
4041
/deis/router/bodySize nginx body size setting (default: 1m)
4142
/deis/router/builder/timeout/connect proxy_connect_timeout for deis-builder (default: 10000). Unit in miliseconds
4243
/deis/router/builder/timeout/read proxy_read_timeout for deis-builder (default: 1200000). Unit in miliseconds

router/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ if [[ -z $DOCKER_BUILD ]]; then
1010
exit 1
1111
fi
1212

13-
export VERSION_NGINX=nginx-1.6.2
14-
export VERSION_TCP_PROXY=0.4.5
13+
export VERSION_NGINX=nginx-1.7.10
14+
export VERSION_TCP_PROXY=f2156eff9f6621aaf601eaa8dee40c6820dea0b0
1515
export VERSION_NAXSI=0d53a64ed856e694fcb4038748c8cf6d5551a603
1616

1717
export BUILD_PATH=/tmp/build
@@ -32,7 +32,7 @@ apt-get update \
3232

3333
# grab the source files
3434
curl -sSL http://nginx.org/download/$VERSION_NGINX.tar.gz -o $BUILD_PATH/$VERSION_NGINX.tar.gz
35-
curl -sSL https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/v$VERSION_TCP_PROXY.tar.gz -o $BUILD_PATH/$VERSION_TCP_PROXY.tar.gz
35+
curl -sSL https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/$VERSION_TCP_PROXY.tar.gz -o $BUILD_PATH/$VERSION_TCP_PROXY.tar.gz
3636
curl -sSL https://github.com/nbs-system/naxsi/archive/$VERSION_NAXSI.tar.gz -o $BUILD_PATH/$VERSION_NAXSI.tar.gz
3737

3838
# expand the source files

router/image/templates/nginx.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,11 @@ http {
140140

141141
## start service definitions for each application
142142
{{ $useSSL := or .deis_router_sslCert "false" }}
143+
{{ $affinityArg := .deis_router_affinityArg }}
143144
{{ $domains := .deis_domains }}{{ range $service := .deis_services }}{{ if $service.Nodes }}
144145
upstream {{ Base $service.Key }} {
146+
{{ if $affinityArg }}hash $arg_{{ $affinityArg }} consistent;
147+
{{ end }}
145148
{{ range $upstream := $service.Nodes }}server {{ $upstream.Value }};
146149
{{ end }}
147150
}

0 commit comments

Comments
 (0)