test: use static balancing for dashboard backend in haproxy
This commit is contained in:
parent
b75ea08d64
commit
2682a1ee28
|
@ -10,7 +10,8 @@ set -euo pipefail
|
||||||
# ensure dir
|
# ensure dir
|
||||||
cd -P -- "$(dirname -- "$0")/.."
|
cd -P -- "$(dirname -- "$0")/.."
|
||||||
|
|
||||||
IMAGE="${1}"
|
IMAGE1="${1}"
|
||||||
|
IMAGE2="${2:-${IMAGE1}}"
|
||||||
|
|
||||||
NET='emqx.io'
|
NET='emqx.io'
|
||||||
NODE1="node1.$NET"
|
NODE1="node1.$NET"
|
||||||
|
@ -35,7 +36,7 @@ docker run -d -t --restart=always --name "$NODE1" \
|
||||||
-e EMQX_listeners__wss__default__enable=false \
|
-e EMQX_listeners__wss__default__enable=false \
|
||||||
-e EMQX_listeners__tcp__default__proxy_protocol=true \
|
-e EMQX_listeners__tcp__default__proxy_protocol=true \
|
||||||
-e EMQX_listeners__ws__default__proxy_protocol=true \
|
-e EMQX_listeners__ws__default__proxy_protocol=true \
|
||||||
"$IMAGE"
|
"$IMAGE1"
|
||||||
|
|
||||||
docker run -d -t --restart=always --name "$NODE2" \
|
docker run -d -t --restart=always --name "$NODE2" \
|
||||||
--net "$NET" \
|
--net "$NET" \
|
||||||
|
@ -47,7 +48,7 @@ docker run -d -t --restart=always --name "$NODE2" \
|
||||||
-e EMQX_listeners__wss__default__enable=false \
|
-e EMQX_listeners__wss__default__enable=false \
|
||||||
-e EMQX_listeners__tcp__default__proxy_protocol=true \
|
-e EMQX_listeners__tcp__default__proxy_protocol=true \
|
||||||
-e EMQX_listeners__ws__default__proxy_protocol=true \
|
-e EMQX_listeners__ws__default__proxy_protocol=true \
|
||||||
"$IMAGE"
|
"$IMAGE2"
|
||||||
|
|
||||||
mkdir -p tmp
|
mkdir -p tmp
|
||||||
cat <<EOF > tmp/haproxy.cfg
|
cat <<EOF > tmp/haproxy.cfg
|
||||||
|
@ -84,14 +85,17 @@ defaults
|
||||||
## API
|
## API
|
||||||
##----------------------------------------------------------------
|
##----------------------------------------------------------------
|
||||||
frontend emqx_dashboard
|
frontend emqx_dashboard
|
||||||
mode tcp
|
mode tcp
|
||||||
option tcplog
|
option tcplog
|
||||||
bind *:18083
|
bind *:18083
|
||||||
default_backend emqx_dashboard_back
|
default_backend emqx_dashboard_back
|
||||||
|
|
||||||
backend emqx_dashboard_back
|
backend emqx_dashboard_back
|
||||||
|
# Must use a consistent dispatch when EMQX is running on different versions
|
||||||
|
# because the js files for the dashboard is chunked, having the backends sharing
|
||||||
|
# load randomly will cause the browser fail to GET some chunks (or get bad chunks if names clash)
|
||||||
|
balance first
|
||||||
mode http
|
mode http
|
||||||
# balance static-rr
|
|
||||||
server emqx-1 $NODE1:18083
|
server emqx-1 $NODE1:18083
|
||||||
server emqx-2 $NODE2:18083
|
server emqx-2 $NODE2:18083
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue