From 606e48560cf6893cb675c48991061ec068031232 Mon Sep 17 00:00:00 2001 From: William Yang Date: Fri, 2 Jul 2021 11:52:57 +0200 Subject: [PATCH 01/13] ci: build-package set fail-fast to false To get better overall vision --- .github/workflows/build_packages.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_packages.yaml b/.github/workflows/build_packages.yaml index 99ea45d29..0f1f8ccac 100644 --- a/.github/workflows/build_packages.yaml +++ b/.github/workflows/build_packages.yaml @@ -63,6 +63,7 @@ jobs: if: endsWith(github.repository, 'emqx') strategy: + fail-fast: false matrix: profile: ${{fromJSON(needs.prepare.outputs.profiles)}} exclude: @@ -131,6 +132,7 @@ jobs: needs: prepare strategy: + fail-fast: false matrix: profile: ${{fromJSON(needs.prepare.outputs.profiles)}} erl_otp: @@ -210,6 +212,7 @@ jobs: needs: prepare strategy: + fail-fast: false matrix: profile: ${{fromJSON(needs.prepare.outputs.profiles)}} arch: From 6adb76cf27998dbbcb0815d6c6624f560b7c1973 Mon Sep 17 00:00:00 2001 From: William Yang Date: Fri, 2 Jul 2021 12:31:35 +0200 Subject: [PATCH 02/13] ci: try 32bit fix from quicer --- apps/emqx/rebar.config | 3 ++- rebar.config | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/emqx/rebar.config b/apps/emqx/rebar.config index fbd980056..a38f4af7a 100644 --- a/apps/emqx/rebar.config +++ b/apps/emqx/rebar.config @@ -31,7 +31,8 @@ [ meck , {bbmustache,"1.10.0"} , {emqx_ct_helpers, {git,"https://github.com/emqx/emqx-ct-helpers", {branch,"hocon"}}} - , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.1"}}} + %, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.1"}}} + , {emqtt, {git, "https://github.com/emqx/emqtt", {branch, "main"}}} ]}, {extra_src_dirs, [{"test",[recursive]}]} ]} diff --git a/rebar.config b/rebar.config index fc863f7c4..93fdcfba4 100644 --- a/rebar.config +++ b/rebar.config @@ -63,7 +63,8 @@ , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.13.0"}}} , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.9.0"}}} , {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.2.1"}}} - , {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.5"}}} + %, {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.5"}}} + , {quicer, {git, "https://github.com/emqx/quic.git", {branch, "main"}}} ]}. {xref_ignores, From 1f20bae3920e6fda0caadcd5a2b1e2452d3e393a Mon Sep 17 00:00:00 2001 From: William Yang Date: Fri, 2 Jul 2021 18:28:26 +0200 Subject: [PATCH 03/13] feat(quic): conditionally build/start quicer app --- apps/emqx/rebar.config | 1 - apps/emqx/rebar.config.script | 39 +++++++++++++++++++------- apps/emqx/src/emqx.app.src | 2 +- apps/emqx/src/emqx_app.erl | 2 ++ apps/emqx/src/emqx_listeners.erl | 48 +++++++++++++++++++------------- rebar.config | 2 -- rebar.config.erl | 30 ++++++++++++++++---- 7 files changed, 86 insertions(+), 38 deletions(-) diff --git a/apps/emqx/rebar.config b/apps/emqx/rebar.config index a38f4af7a..7997f0540 100644 --- a/apps/emqx/rebar.config +++ b/apps/emqx/rebar.config @@ -20,7 +20,6 @@ , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {branch, "2.0.4"}}} , {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}} , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.13.0"}}} - , {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.5"}}} ]}. {plugins, [rebar3_proper]}. diff --git a/apps/emqx/rebar.config.script b/apps/emqx/rebar.config.script index eae18f106..2352e4a81 100644 --- a/apps/emqx/rebar.config.script +++ b/apps/emqx/rebar.config.script @@ -1,11 +1,30 @@ -Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {branch, "0.6.0"}}}, -AddBcrypt = fun(C) -> - {deps, Deps0} = lists:keyfind(deps, 1, C), - Deps = [Bcrypt | Deps0], - lists:keystore(deps, 1, C, {deps, Deps}) -end, +IsCentos6 = fun() -> + case file:read_file("/etc/centos-release") of + {ok, <<"CentOS release 6", _/binary >>} -> + true; + _ -> + false + end + end, -case os:type() of - {win32, _} -> CONFIG; - _ -> AddBcrypt(CONFIG) -end. +IsWin32 = fun() -> + win32 =:= element(1, os:type()) + end, + +IsQuicSupp = fun() -> + not (IsCentos6() orelse IsWin32() orelse + false =/= os:getenv("EMQX_BUILD_WITHOUT_QUIC") + ) + end, + +Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {branch, "0.6.0"}}}, +Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {branch, "main"}}}, + +ExtraDeps = fun(C) -> + {deps, Deps0} = lists:keyfind(deps, 1, C), + Deps = Deps0 ++ [Bcrypt || not IsWin32()] ++ + [ Quicer || IsQuicSupp()], + lists:keystore(deps, 1, C, {deps, Deps}) + end, + +ExtraDeps(CONFIG). diff --git a/apps/emqx/src/emqx.app.src b/apps/emqx/src/emqx.app.src index d9efbe82a..546b70f14 100644 --- a/apps/emqx/src/emqx.app.src +++ b/apps/emqx/src/emqx.app.src @@ -4,7 +4,7 @@ {vsn, "5.0.0"}, % strict semver, bump manually! {modules, []}, {registered, []}, - {applications, [kernel,stdlib,gproc,gen_rpc,esockd,cowboy,sasl,os_mon,quicer,jiffy]}, + {applications, [kernel,stdlib,gproc,gen_rpc,esockd,cowboy,sasl,os_mon,jiffy]}, {mod, {emqx_app,[]}}, {env, []}, {licenses, ["Apache-2.0"]}, diff --git a/apps/emqx/src/emqx_app.erl b/apps/emqx/src/emqx_app.erl index 666a704f3..d2f5ba691 100644 --- a/apps/emqx/src/emqx_app.erl +++ b/apps/emqx/src/emqx_app.erl @@ -49,6 +49,8 @@ start(_Type, _Args) -> _ = load_ce_modules(), ekka:start(), ok = ekka_rlog:wait_for_shards(?EMQX_SHARDS, infinity), + false == os:getenv("EMQX_NO_QUIC") + andalso application:ensure_all_started(quicer), {ok, Sup} = emqx_sup:start_link(), ok = start_autocluster(), % ok = emqx_plugins:init(), diff --git a/apps/emqx/src/emqx_listeners.erl b/apps/emqx/src/emqx_listeners.erl index 48e99926d..462ba9897 100644 --- a/apps/emqx/src/emqx_listeners.erl +++ b/apps/emqx/src/emqx_listeners.erl @@ -106,6 +106,8 @@ format_listen_on(ListenOn) -> format(ListenOn). start_listener(#{proto := Proto, name := Name, listen_on := ListenOn, opts := Options}) -> ID = identifier(Proto, Name), case start_listener(Proto, ListenOn, Options) of + {ok, skipped} -> + console_print("Start ~s listener on ~s skpped.~n", [ID, format(ListenOn)]); {ok, _} -> console_print("Start ~s listener on ~s successfully.~n", [ID, format(ListenOn)]); {error, Reason} -> @@ -123,7 +125,7 @@ console_print(_Fmt, _Args) -> ok. %% Start MQTT/TCP listener -spec(start_listener(esockd:proto(), esockd:listen_on(), [esockd:option()]) - -> {ok, pid()} | {error, term()}). + -> {ok, pid() | skipped} | {error, term()}). start_listener(tcp, ListenOn, Options) -> start_mqtt_listener('mqtt:tcp', ListenOn, Options); @@ -143,24 +145,32 @@ start_listener(Proto, ListenOn, Options) when Proto == https; Proto == wss -> %% Start MQTT/QUIC listener start_listener(quic, ListenOn, Options) -> - %% @fixme unsure why we need reopen lib and reopen config. - quicer_nif:open_lib(), - quicer_nif:reg_open(), - SSLOpts = proplists:get_value(ssl_options, Options), - DefAcceptors = erlang:system_info(schedulers_online) * 8, - ListenOpts = [ {cert, proplists:get_value(certfile, SSLOpts)} - , {key, proplists:get_value(keyfile, SSLOpts)} - , {alpn, ["mqtt"]} - , {conn_acceptors, proplists:get_value(acceptors, Options, DefAcceptors)} - , {idle_timeout_ms, proplists:get_value(idle_timeout, Options, 60000)} - ], - ConnectionOpts = [ {conn_callback, emqx_quic_connection} - , {peer_unidi_stream_count, 1} - , {peer_bidi_stream_count, 10} - | Options - ], - StreamOpts = [], - quicer:start_listener('mqtt:quic', ListenOn, {ListenOpts, ConnectionOpts, StreamOpts}). + IsQuicEnabled = false == os:getenv("EMQX_NO_QUIC"), + case [ A || {quicer, _, _} = A<-application:which_applications() ] of + [_] when IsQuicEnabled -> + %% @fixme unsure why we need reopen lib and reopen config. + quicer_nif:open_lib(), + quicer_nif:reg_open(), + SSLOpts = proplists:get_value(ssl_options, Options), + DefAcceptors = erlang:system_info(schedulers_online) * 8, + ListenOpts = [ {cert, proplists:get_value(certfile, SSLOpts)} + , {key, proplists:get_value(keyfile, SSLOpts)} + , {alpn, ["mqtt"]} + , {conn_acceptors, proplists:get_value(acceptors, Options, DefAcceptors)} + , {idle_timeout_ms, proplists:get_value(idle_timeout, Options, 60000)} + ], + ConnectionOpts = [ {conn_callback, emqx_quic_connection} + , {peer_unidi_stream_count, 1} + , {peer_bidi_stream_count, 10} + | Options + ], + StreamOpts = [], + quicer:start_listener('mqtt:quic', ListenOn, {ListenOpts, ConnectionOpts, StreamOpts}); + [] -> + io:format(standard_error, "INFO: quicer application is unavailable/disabled~n", + []), + {ok, skipped} + end. replace(Opts, Key, Value) -> [{Key, Value} | proplists:delete(Key, Opts)]. diff --git a/rebar.config b/rebar.config index 93fdcfba4..120029643 100644 --- a/rebar.config +++ b/rebar.config @@ -63,8 +63,6 @@ , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.13.0"}}} , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.9.0"}}} , {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.2.1"}}} - %, {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.5"}}} - , {quicer, {git, "https://github.com/emqx/quic.git", {branch, "main"}}} ]}. {xref_ignores, diff --git a/rebar.config.erl b/rebar.config.erl index de42601af..258cd0bf3 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -15,12 +15,14 @@ do(Dir, CONFIG) -> bcrypt() -> {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {branch, "0.6.0"}}}. +quicer() -> + %% @todo use tag + {quicer, {git, "https://github.com/emqx/quic.git", {branch, "main"}}}. + deps(Config) -> {deps, OldDeps} = lists:keyfind(deps, 1, Config), - MoreDeps = case provide_bcrypt_dep() of - true -> [bcrypt()]; - false -> [] - end, + MoreDeps = [bcrypt() || provide_bcrypt_dep()] ++ + [quicer() || is_quicer_supported()], {HasElixir, ExtraDeps} = extra_deps(), {HasElixir, lists:keystore(deps, 1, Config, {deps, OldDeps ++ MoreDeps ++ ExtraDeps})}. @@ -78,6 +80,24 @@ is_cover_enabled() -> is_enterprise() -> filelib:is_regular("EMQX_ENTERPRISE"). +is_quicer_supported() -> + not (false =/= os:getenv("BUILD_WITHOUT_QUIC") orelse + is_win32() orelse is_centos_6() + ). + +is_centos_6() -> + %% reason: + %% glibc is too old + case file:read_file("/etc/centos-release") of + {ok, <<"CentOS release 6", _/binary >>} -> + true; + _ -> + false + end. + +is_win32() -> + win32 =:= element(1, os:type()). + project_app_dirs() -> ["apps/*"] ++ case is_enterprise() of @@ -242,7 +262,6 @@ relx_apps(ReleaseType) -> , compiler , runtime_tools , cuttlefish - , quicer , emqx , {mnesia, load} , {ekka, load} @@ -263,6 +282,7 @@ relx_apps(ReleaseType) -> , emqx_retainer , emqx_statsd ] + ++ [quicer || is_quicer_supported()] ++ [emqx_telemetry || not is_enterprise()] ++ [emqx_license || is_enterprise()] ++ [bcrypt || provide_bcrypt_release(ReleaseType)] From 9d760ff5bda70290ce0b58f18f0bc0fedfbd19d9 Mon Sep 17 00:00:00 2001 From: William Yang Date: Fri, 2 Jul 2021 23:58:44 +0200 Subject: [PATCH 04/13] ci(build-packages): rm rebar.lock in prepare phase --- .github/workflows/build_packages.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_packages.yaml b/.github/workflows/build_packages.yaml index 0f1f8ccac..1311cdc91 100644 --- a/.github/workflows/build_packages.yaml +++ b/.github/workflows/build_packages.yaml @@ -42,6 +42,7 @@ jobs: if: endsWith(github.repository, 'emqx') run: | make -C source deps-all + rm source/rebar.lock zip -ryq source.zip source/* source/.[^.]* - name: get_all_deps if: endsWith(github.repository, 'enterprise') From 7a3330856d193a9f764313bd225d85cdf99d3192 Mon Sep 17 00:00:00 2001 From: William Yang Date: Mon, 5 Jul 2021 11:39:44 +0200 Subject: [PATCH 05/13] ci(build-packages): Don't start quic on ARM platform --- .ci/build_packages/tests.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/build_packages/tests.sh b/.ci/build_packages/tests.sh index 47994c9ad..d5517f3a3 100755 --- a/.ci/build_packages/tests.sh +++ b/.ci/build_packages/tests.sh @@ -12,13 +12,16 @@ case "$(uname -m)" in ARCH='amd64' ;; aarch64) + EMQX_NO_QUIC=0 ARCH='arm64' ;; arm*) + EMQX_NO_QUIC=0 ARCH=arm ;; esac export ARCH +export EMQX_NO_QUIC emqx_prepare(){ mkdir -p "${PACKAGE_PATH}" From 660d16e84b878b42eb9d984c0401c0bb5d4876fe Mon Sep 17 00:00:00 2001 From: William Yang Date: Mon, 5 Jul 2021 23:43:35 +0200 Subject: [PATCH 06/13] feat(config): set the endpoint to "" to disable listener --- apps/emqx/src/emqx_listeners.erl | 3 +-- apps/emqx/src/emqx_schema.erl | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/emqx/src/emqx_listeners.erl b/apps/emqx/src/emqx_listeners.erl index 462ba9897..3e688b91e 100644 --- a/apps/emqx/src/emqx_listeners.erl +++ b/apps/emqx/src/emqx_listeners.erl @@ -145,9 +145,8 @@ start_listener(Proto, ListenOn, Options) when Proto == https; Proto == wss -> %% Start MQTT/QUIC listener start_listener(quic, ListenOn, Options) -> - IsQuicEnabled = false == os:getenv("EMQX_NO_QUIC"), case [ A || {quicer, _, _} = A<-application:which_applications() ] of - [_] when IsQuicEnabled -> + [_] -> %% @fixme unsure why we need reopen lib and reopen config. quicer_nif:open_lib(), quicer_nif:reg_open(), diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl index 73a5812e8..2a58b34c3 100644 --- a/apps/emqx/src/emqx_schema.erl +++ b/apps/emqx/src/emqx_schema.erl @@ -333,7 +333,7 @@ fields("quic_listener") -> [ {"$name", ref("quic_listener_settings")}]; fields("listener_settings") -> - [ {"endpoint", t(union(ip_port(), integer()))} + [ {"endpoint", t(union([ip_port(), integer(), ""]))} , {"acceptors", t(integer(), undefined, 8)} , {"max_connections", t(integer(), undefined, 1024)} , {"max_conn_rate", t(integer())} @@ -785,6 +785,7 @@ tr_listeners(Conf) -> TcpListeners = fun(Type, Name) -> Prefix = string:join(["listener", Type, Name], "."), ListenOnN = case conf_get(Prefix ++ ".endpoint", Conf) of + "" -> []; undefined -> []; ListenOn -> ListenOn end, @@ -801,6 +802,8 @@ tr_listeners(Conf) -> SslListeners = fun(Type, Name) -> Prefix = string:join(["listener", Type, Name], "."), case conf_get(Prefix ++ ".endpoint", Conf) of + "" -> + []; undefined -> []; ListenOn -> From 16eb5da44028ff5babbc5971b81db9aa23b5c6a3 Mon Sep 17 00:00:00 2001 From: William Yang Date: Mon, 5 Jul 2021 23:45:46 +0200 Subject: [PATCH 07/13] ci: disable quic listener on arm --- .ci/build_packages/tests.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.ci/build_packages/tests.sh b/.ci/build_packages/tests.sh index d5517f3a3..3b61d9b33 100755 --- a/.ci/build_packages/tests.sh +++ b/.ci/build_packages/tests.sh @@ -12,16 +12,13 @@ case "$(uname -m)" in ARCH='amd64' ;; aarch64) - EMQX_NO_QUIC=0 ARCH='arm64' ;; arm*) - EMQX_NO_QUIC=0 ARCH=arm ;; esac export ARCH -export EMQX_NO_QUIC emqx_prepare(){ mkdir -p "${PACKAGE_PATH}" @@ -120,6 +117,7 @@ running_test(){ EMQX_MQTT__MAX_TOPIC_ALIAS=10 # sed -i '/emqx_telemetry/d' /var/lib/emqx/loaded_plugins + [[ "$ARCH" == arm* ]] && export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT="" if ! emqx start; then cat /var/log/emqx/erlang.log.1 || true cat /var/log/emqx/emqx.log.1 || true From 939f3855d509ea89b42db3bfdf1c772e5d1b675b Mon Sep 17 00:00:00 2001 From: William Yang Date: Tue, 6 Jul 2021 10:14:00 +0200 Subject: [PATCH 08/13] ci(build-packages): docker fail fast: false --- .github/workflows/build_packages.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_packages.yaml b/.github/workflows/build_packages.yaml index 1311cdc91..fcffded94 100644 --- a/.github/workflows/build_packages.yaml +++ b/.github/workflows/build_packages.yaml @@ -340,6 +340,7 @@ jobs: needs: prepare strategy: + fail-fast: false matrix: profile: ${{fromJSON(needs.prepare.outputs.profiles)}} arch: From 79d169b3fff1b477ccbd901f9dfce69e82f5711a Mon Sep 17 00:00:00 2001 From: William Yang Date: Tue, 6 Jul 2021 12:10:14 +0200 Subject: [PATCH 09/13] chore(quic): bump emqtt vsn to 1.4.2 --- apps/emqx/rebar.config | 3 +-- rebar.config | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/emqx/rebar.config b/apps/emqx/rebar.config index 7997f0540..1dd82ceaa 100644 --- a/apps/emqx/rebar.config +++ b/apps/emqx/rebar.config @@ -30,8 +30,7 @@ [ meck , {bbmustache,"1.10.0"} , {emqx_ct_helpers, {git,"https://github.com/emqx/emqx-ct-helpers", {branch,"hocon"}}} - %, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.1"}}} - , {emqtt, {git, "https://github.com/emqx/emqtt", {branch, "main"}}} + , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.2"}}} ]}, {extra_src_dirs, [{"test",[recursive]}]} ]} diff --git a/rebar.config b/rebar.config index 120029643..ae87d37bd 100644 --- a/rebar.config +++ b/rebar.config @@ -55,7 +55,7 @@ , {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.1"}}} , {replayq, {git, "https://github.com/emqx/replayq", {tag, "0.3.2"}}} , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {branch, "2.0.4"}}} - , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.1"}}} + , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.2"}}} , {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.2"}}} , {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}} , {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.1 From 9516e5047a5818db9981a74b1198f88818df2331 Mon Sep 17 00:00:00 2001 From: William Yang Date: Tue, 6 Jul 2021 16:01:20 +0200 Subject: [PATCH 10/13] ci(build-packages): start emqx as user emqx --- .ci/build_packages/tests.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.ci/build_packages/tests.sh b/.ci/build_packages/tests.sh index 3b61d9b33..dc4fbd35b 100755 --- a/.ci/build_packages/tests.sh +++ b/.ci/build_packages/tests.sh @@ -113,12 +113,11 @@ emqx_test(){ } running_test(){ - export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60 \ - EMQX_MQTT__MAX_TOPIC_ALIAS=10 # sed -i '/emqx_telemetry/d' /var/lib/emqx/loaded_plugins + start_cmd="export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60 EMQX_MQTT__MAX_TOPIC_ALIAS=10; \ + [[ $(arch) == *arm* || $(arch) == aarch64 ]] && export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT=''; emqx start" - [[ "$ARCH" == arm* ]] && export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT="" - if ! emqx start; then + if ! su - emqx -c "$start_cmd"; then cat /var/log/emqx/erlang.log.1 || true cat /var/log/emqx/emqx.log.1 || true exit 1 From 5fcdaa6afeddbf95eb914d77980b207074157641 Mon Sep 17 00:00:00 2001 From: William Yang Date: Tue, 6 Jul 2021 20:42:55 +0200 Subject: [PATCH 11/13] ci(build-packages): fix test zip --- .ci/build_packages/tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/build_packages/tests.sh b/.ci/build_packages/tests.sh index dc4fbd35b..7a77bc60e 100755 --- a/.ci/build_packages/tests.sh +++ b/.ci/build_packages/tests.sh @@ -38,7 +38,8 @@ emqx_test(){ packagename=$(basename "${PACKAGE_PATH}/${EMQX_NAME}"-*.zip) unzip -q "${PACKAGE_PATH}/${packagename}" export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60 \ - EMQX_MQTT__MAX_TOPIC_ALIAS=10 + EMQX_MQTT__MAX_TOPIC_ALIAS=10 + [[ $(arch) == *arm* || $(arch) == aarch64 ]] && export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT='' # sed -i '/emqx_telemetry/d' "${PACKAGE_PATH}"/emqx/data/loaded_plugins echo "running ${packagename} start" From 1b014b492f02fd3c825c948ad7411daa9eb391ad Mon Sep 17 00:00:00 2001 From: William Yang Date: Wed, 7 Jul 2021 00:04:53 +0200 Subject: [PATCH 12/13] ci(build-package): disable quicer listener for deb test --- .ci/build_packages/tests.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.ci/build_packages/tests.sh b/.ci/build_packages/tests.sh index 7a77bc60e..10daca56c 100755 --- a/.ci/build_packages/tests.sh +++ b/.ci/build_packages/tests.sh @@ -115,10 +115,10 @@ emqx_test(){ running_test(){ # sed -i '/emqx_telemetry/d' /var/lib/emqx/loaded_plugins - start_cmd="export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60 EMQX_MQTT__MAX_TOPIC_ALIAS=10; \ - [[ $(arch) == *arm* || $(arch) == aarch64 ]] && export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT=''; emqx start" + start_env="export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60 EMQX_MQTT__MAX_TOPIC_ALIAS=10; \ + [[ $(arch) == *arm* || $(arch) == aarch64 ]] && export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT=''" - if ! su - emqx -c "$start_cmd"; then + if ! su - emqx -c "$start_env ; emqx start"; then cat /var/log/emqx/erlang.log.1 || true cat /var/log/emqx/emqx.log.1 || true exit 1 @@ -140,6 +140,7 @@ running_test(){ if [ "$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g')" = ubuntu ] \ || [ "$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g' | sed 's/"//g')" = debian ] ;then + echo "$start_env" >> /etc/default/emqx if ! service emqx start; then cat /var/log/emqx/erlang.log.1 || true cat /var/log/emqx/emqx.log.1 || true From 2d2be45c0d32d68f5ba9c46b430076ae863e61b6 Mon Sep 17 00:00:00 2001 From: William Yang Date: Wed, 7 Jul 2021 11:15:06 +0200 Subject: [PATCH 13/13] ci(build-package): fix env setting before start emqx --- .ci/build_packages/tests.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.ci/build_packages/tests.sh b/.ci/build_packages/tests.sh index 10daca56c..9ee444cd5 100755 --- a/.ci/build_packages/tests.sh +++ b/.ci/build_packages/tests.sh @@ -115,10 +115,24 @@ emqx_test(){ running_test(){ # sed -i '/emqx_telemetry/d' /var/lib/emqx/loaded_plugins - start_env="export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60 EMQX_MQTT__MAX_TOPIC_ALIAS=10; \ - [[ $(arch) == *arm* || $(arch) == aarch64 ]] && export EMQX_LISTENER__QUIC__EXTERNAL__ENDPOINT=''" + emqx_env_vars=$(dirname "$(readlink "$(command -v emqx)")")/../releases/emqx_vars - if ! su - emqx -c "$start_env ; emqx start"; then + if [ -f "$emqx_env_vars" ]; + then + tee -a "$emqx_env_vars" <> /etc/default/emqx if ! service emqx start; then cat /var/log/emqx/erlang.log.1 || true cat /var/log/emqx/emqx.log.1 || true