From b75ea08d6476a3c52c86d6f2adca3c07f93ae47e Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Fri, 10 Feb 2023 09:06:28 +0100 Subject: [PATCH 1/3] build: add 'make docker' --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 2cabaebcf..3d582fafd 100644 --- a/Makefile +++ b/Makefile @@ -222,6 +222,10 @@ run: $(PROFILE) quickrun quickrun: ./_build/$(PROFILE)/rel/emqx/bin/emqx console +## Take the currently set PROFILE +docker: + @$(BUILD) $(PROFILE) docker + ## docker target is to create docker instructions .PHONY: $(REL_PROFILES:%=%-docker) $(REL_PROFILES:%=%-elixir-docker) define gen-docker-target From 2682a1ee28c5f6b5973e00a6135a0de9617c1286 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Fri, 10 Feb 2023 09:06:59 +0100 Subject: [PATCH 2/3] test: use static balancing for dashboard backend in haproxy --- scripts/test/start-two-nodes-in-docker.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/test/start-two-nodes-in-docker.sh b/scripts/test/start-two-nodes-in-docker.sh index 16f46a53f..720eff0ca 100755 --- a/scripts/test/start-two-nodes-in-docker.sh +++ b/scripts/test/start-two-nodes-in-docker.sh @@ -10,7 +10,8 @@ set -euo pipefail # ensure dir cd -P -- "$(dirname -- "$0")/.." -IMAGE="${1}" +IMAGE1="${1}" +IMAGE2="${2:-${IMAGE1}}" NET='emqx.io' 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__tcp__default__proxy_protocol=true \ -e EMQX_listeners__ws__default__proxy_protocol=true \ - "$IMAGE" + "$IMAGE1" docker run -d -t --restart=always --name "$NODE2" \ --net "$NET" \ @@ -47,7 +48,7 @@ docker run -d -t --restart=always --name "$NODE2" \ -e EMQX_listeners__wss__default__enable=false \ -e EMQX_listeners__tcp__default__proxy_protocol=true \ -e EMQX_listeners__ws__default__proxy_protocol=true \ - "$IMAGE" + "$IMAGE2" mkdir -p tmp cat < tmp/haproxy.cfg @@ -84,14 +85,17 @@ defaults ## API ##---------------------------------------------------------------- frontend emqx_dashboard - mode tcp - option tcplog - bind *:18083 - default_backend emqx_dashboard_back + mode tcp + option tcplog + bind *:18083 + default_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 - # balance static-rr server emqx-1 $NODE1:18083 server emqx-2 $NODE2:18083 From 56279f63058c843a94e455af12ed42064d7ecab1 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Sat, 11 Feb 2023 10:18:07 +0100 Subject: [PATCH 3/3] docs: fix bridge status report --- apps/emqx_bridge/i18n/emqx_bridge_schema.conf | 26 ++++++++++++++++--- .../src/schema/emqx_bridge_schema.erl | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/apps/emqx_bridge/i18n/emqx_bridge_schema.conf b/apps/emqx_bridge/i18n/emqx_bridge_schema.conf index d575f09bc..901f25455 100644 --- a/apps/emqx_bridge/i18n/emqx_bridge_schema.conf +++ b/apps/emqx_bridge/i18n/emqx_bridge_schema.conf @@ -35,8 +35,18 @@ emqx_bridge_schema { desc_status { desc { - en: """The status of the bridge""" - zh: """Bridge 的状态""" + en: """The status of the bridge
+- connecting: the initial state before any health probes were made.
+- connected: when the bridge passes the health probes.
+- disconnected: when the bridge can not pass health probes.
+- stopped: when the bridge resource is requested to be stopped.
+- inconsistent: When not all the nodes are at the same status.""" + zh: """Bridge 的连接状态
+- connecting: 启动时的初始状态。
+- connected: 桥接驱动健康检查正常。
+- disconnected: 当桥接无法通过健康检查。
+- stopped: 桥接处于停用状态。
+- inconsistent: 集群中有各节点汇报的状态不一致。""" } label: { en: "Bridge Status" @@ -46,8 +56,16 @@ emqx_bridge_schema { desc_node_status { desc { - en: """The status of the bridge for each node""" - zh: """每个节点的 Bridge 状态""" + en: """The status of the bridge for each node. +- connecting: the initial state before any health probes were made.
+- connected: when the bridge passes the health probes.
+- disconnected: when the bridge can not pass health probes.
+- stopped: when the bridge resource is requested to be stopped.""" + zh: """每个节点的 Bridge 状态 +- connecting: 启动时的初始状态。
+- connected: 桥接驱动健康检查正常。
+- disconnected: 当桥接无法通过健康检查。
+- stopped: 桥接处于停用状态。""" } label: { en: "Node Bridge Status" diff --git a/apps/emqx_bridge/src/schema/emqx_bridge_schema.erl b/apps/emqx_bridge/src/schema/emqx_bridge_schema.erl index c490294eb..ed2baec8f 100644 --- a/apps/emqx_bridge/src/schema/emqx_bridge_schema.erl +++ b/apps/emqx_bridge/src/schema/emqx_bridge_schema.erl @@ -208,7 +208,7 @@ desc(_) -> undefined. status() -> - hoconsc:enum([connected, disconnected, connecting]). + hoconsc:enum([connected, disconnected, connecting, inconsistent]). node_name() -> {"node", mk(binary(), #{desc => ?DESC("desc_node_name"), example => "emqx@127.0.0.1"})}.