From 48233b5000d6253e21f39f9c1953b2da7a9f093e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Fri, 8 Nov 2024 12:04:50 +0100 Subject: [PATCH 1/6] Fix the smoke test for packages - Fix the 'pipefail' option (had no effect) - Fix the 'mongooseimctl' command (did not work - wrong path) This command started failing after fixing 'pipefail'. --- tools/pkg/scripts/smoke_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/pkg/scripts/smoke_test.sh b/tools/pkg/scripts/smoke_test.sh index fba996dc022..ddb051228fb 100755 --- a/tools/pkg/scripts/smoke_test.sh +++ b/tools/pkg/scripts/smoke_test.sh @@ -2,7 +2,7 @@ # Use bash "strict mode" # Based on http://redsymbol.net/articles/unofficial-bash-strict-mode/ -set -eu pipefail +set -euo pipefail IFS=$'\n\t' echo "Check that print_install_dir works" @@ -74,7 +74,7 @@ mongooseimctl account registerUser --username user --domain localhost --password echo "Checking if 2 users are registered on host 'localhost'" expected=2 -registered=$(_build/mim1/rel/mongooseim/bin/mongooseimctl account countUsers \ +registered=$(mongooseimctl account countUsers \ --domain localhost | grep -o '"countUsers" : [0-9]*' | awk '{print $3}') if [ ${registered} -ne ${expected} ]; then echo "registered value is ${registered} but expected ${expected}" From e7770a7fbd52abe3320044ece37d1202340699ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Fri, 8 Nov 2024 10:52:03 +0100 Subject: [PATCH 2/6] Make sure that the package emits no errors Motivated by the fact that because of lager, there were multiple '[error] ...' lines. The regexp will also match 'level=error' lines, but not ones e.g. with 'error_logger'. --- tools/pkg/scripts/smoke_test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/pkg/scripts/smoke_test.sh b/tools/pkg/scripts/smoke_test.sh index ddb051228fb..ed4cf69faf1 100755 --- a/tools/pkg/scripts/smoke_test.sh +++ b/tools/pkg/scripts/smoke_test.sh @@ -81,6 +81,9 @@ if [ ${registered} -ne ${expected} ]; then exit 1 fi +echo "Checking if MongooseIM has logged any errors" +grep -wr 'error' /var/log/mongooseim && exit 1 || true + echo "Stopping mongooseim via 'mongooseimctl stop'" mongooseimctl stop From bd142e359537295d7d75c8ef09993f542d618c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Thu, 7 Nov 2024 18:06:13 +0100 Subject: [PATCH 3/6] Update rebar config to remove lager The only packages using lager were nksip and its deps, requried for jingle-SIP. These deps were updated separately, and now they don't depend on lager anymore. Lager causes problems in our packages, where it tries to create files in non-existent directories, leading to errors and missing logs from nksip and its deps. - Update nksip and related packages to the non-lager versions - Remove lager entirely, because it is unused --- rebar.config | 4 +--- rebar.config.script | 2 +- rebar.lock | 24 ++++++++++-------------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/rebar.config b/rebar.config index 47de0c22d3e..631438108b4 100644 --- a/rebar.config +++ b/rebar.config @@ -62,7 +62,6 @@ %%% Observability {telemetry, "1.2.0"}, - {lager, "3.9.2"}, % We're keeping this to override the dependencies {exometer_core, {git, "https://github.com/esl/exometer_core.git", {branch, "master"}}}, {exometer_report_graphite, {git, "https://github.com/esl/exometer_report_graphite.git", {branch, "master"}}}, {exometer_report_statsd, {git, "https://github.com/esl/exometer_report_statsd.git", {branch, "master"}}}, @@ -120,8 +119,7 @@ {pa, {git, "https://github.com/erszcz/pa.git", {branch, "master"}}}, {jwerl, "1.2.0"}, {cpool, "0.1.0"}, %% Do not upgrade cpool to version 0.1.1, it has bugs - {nkpacket, {git, "https://github.com/esl/nkpacket.git", {branch, "mongooseim-ranch-compatibility"}}}, - {nksip, {git, "https://github.com/arcusfelis/nksip.git", {branch, "mu-fix-dialyzer"}}}, + {nksip, {git, "https://github.com/esl/nksip.git", {branch, "mongooseim"}}}, %% knservice pulls lua. We cannot override it, because it is listed in nkservice.app file {luerl, "1.2.0"} diff --git a/rebar.config.script b/rebar.config.script index d1511fc1f2d..340cbcd7936 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -43,7 +43,7 @@ fun() -> end end, -FirstApps = [kernel, lager], +FirstApps = [kernel], RequiredApps = [mongooseim, inets, tools, compiler], OptionalApps = [{nksip, [nkservice, nkpacket, nklib]}], diff --git a/rebar.lock b/rebar.lock index 25bd617ed0f..218f24688a8 100644 --- a/rebar.lock +++ b/rebar.lock @@ -24,10 +24,6 @@ 1}, {<<"eini">>,{pkg,<<"eini">>,<<"1.2.9">>},1}, {<<"eodbc">>,{pkg,<<"eodbc">>,<<"0.2.0">>},0}, - {<<"eper">>, - {git,"http://github.com/basho/eper.git", - {ref,"fc165bf4072ecb9ce5648aab86db2baad12122f5"}}, - 2}, {<<"epgsql">>,{pkg,<<"epgsql">>,<<"4.7.1">>},0}, {<<"eredis">>,{pkg,<<"eredis">>,<<"1.7.0">>},0}, {<<"erl_csv">>,{pkg,<<"erl_csv">>,<<"0.3.1">>},0}, @@ -77,20 +73,20 @@ {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},1}, {<<"mysql">>,{pkg,<<"mysql">>,<<"1.8.0">>},0}, {<<"nklib">>, - {git,"https://github.com/michalwski/nklib.git", - {ref,"006c1b7f6b848dfa8fc2efa41eeed4fd5f2b3b34"}}, - 1}, + {git,"https://github.com/esl/nklib.git", + {ref,"3afabd183769de07f707094a64c70b1a3476b30b"}}, + 3}, {<<"nkpacket">>, - {git,"https://github.com/esl/nkpacket.git", - {ref,"29cbf9c96d85995dc88daf0b8ef09f8841aedf1d"}}, - 0}, + {git,"http://github.com/esl/nkpacket", + {ref,"734264022e295ae773c5a85c553955f7cf0f7b48"}}, + 2}, {<<"nkservice">>, - {git,"https://github.com/Nekso/nkservice", - {ref,"affbd5b9c914e2c8775dd45733a0b5c15d784e34"}}, + {git,"https://github.com/esl/nkservice", + {ref,"1919e2e22674d709212ef5d1359f4f447cd1fb1b"}}, 1}, {<<"nksip">>, - {git,"https://github.com/arcusfelis/nksip.git", - {ref,"c71265c00bd7b465b7214770895503383dbe299e"}}, + {git,"https://github.com/esl/nksip.git", + {ref,"e55adf8a54b8d9262ce157cf2d8f88b4b94b7023"}}, 0}, {<<"observer_cli">>,{pkg,<<"observer_cli">>,<<"1.7.4">>},0}, {<<"opuntia">>,{pkg,<<"opuntia">>,<<"1.1.0">>},0}, From 74087f184ce70a9a7106fa072ada244df340a36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Thu, 7 Nov 2024 18:10:33 +0100 Subject: [PATCH 4/6] Rename the shell log handler to default Before the change, our 'shell_log' handler was added to the 'default' one. To prevent duplicate logs, lager was removing the 'default' one on startup. Without lager, we can just rename 'shell_log' to 'default', so it would replace the default one. This is the simplest solution, because: - Effective removal of 'default' in the config is not possible (logger prevents this) - Removing it programmatically would need to happen before starting any applications, which is difficult. --- rel/files/app.config | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rel/files/app.config b/rel/files/app.config index 19bb8b044a0..fb91fcd3c1b 100644 --- a/rel/files/app.config +++ b/rel/files/app.config @@ -19,8 +19,10 @@ {format_term_filter, {fun mongoose_log_filter:format_term_filter/2, [toml_value]}} ]}, - %% Shell log handler: - {handler, shell_log, logger_std_h, #{ + %% Shell log handler - it replaces the default one. + %% Logger needs a handler named 'default', so if you want to silence shell logs, + %% change the level to 'none' instead of removing this handler + {handler, default, logger_std_h, #{ level => all, formatter => {mongoose_flatlog_formatter, #{ map_depth => 3, From 61fb7bdb4b7e9568ec76b6ef66da535db63cf17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 13 Nov 2024 10:00:10 +0100 Subject: [PATCH 5/6] Remove lager leftovers from rebar config --- rebar.lock | 3 --- 1 file changed, 3 deletions(-) diff --git a/rebar.lock b/rebar.lock index 218f24688a8..b1ee3cab4d1 100644 --- a/rebar.lock +++ b/rebar.lock @@ -60,7 +60,6 @@ {<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.1.1">>},0}, {<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},0}, {<<"jwerl">>,{pkg,<<"jwerl">>,<<"1.2.0">>},0}, - {<<"lager">>,{pkg,<<"lager">>,<<"3.9.2">>},0}, {<<"lasse">>,{pkg,<<"lasse">>,<<"1.2.0">>},0}, {<<"lhttpc">>,{pkg,<<"lhttpc">>,<<"1.6.2">>},1}, {<<"luerl">>,{pkg,<<"luerl">>,<<"1.2.0">>},0}, @@ -164,7 +163,6 @@ {<<"jiffy">>, <<"ACA10F47AA91697BF24AB9582C74E00E8E95474C7EF9F76D4F1A338D0F5DE21B">>}, {<<"jsx">>, <<"D12516BAA0BB23A59BB35DCCAF02A1BD08243FCBB9EFE24F2D9D056CCFF71268">>}, {<<"jwerl">>, <<"2A0EC870BE0B803BBEEE1463DC5AE05E3D64EEAE2ABC7DB4250ABC611FE7E320">>}, - {<<"lager">>, <<"4CAB289120EB24964E3886BD22323CB5FEFE4510C076992A23AD18CF85413D8C">>}, {<<"lasse">>, <<"DB8F06983B235F6C4C86AC79BCF23EDDCA16FCCCAD1EB45F222852BB133BD793">>}, {<<"lhttpc">>, <<"044F16F0018C7AA7E945E9E9406C7F6035E0B8BC08BF77B00C78CE260E1071E3">>}, {<<"luerl">>, <<"60F05F4240F0E7C148DDB79B67B8FF972734AAD237AA74C83D0748B8214C8EF0">>}, @@ -235,7 +233,6 @@ {<<"jiffy">>, <<"62E1F0581C3C19C33A725C781DFA88410D8BFF1BBAFC3885A2552286B4785C4C">>}, {<<"jsx">>, <<"0C5CC8FDC11B53CC25CF65AC6705AD39E54ECC56D1C22E4ADB8F5A53FB9427F3">>}, {<<"jwerl">>, <<"894C275CA4CF3A4F293541927CA3D7A2622B21D8BD70580EF70EACB0425F1941">>}, - {<<"lager">>, <<"7F904D9E87A8CB7E66156ED31768D1C8E26EBA1D54F4BC85B1AA4AC1F6340C28">>}, {<<"lasse">>, <<"8081769683F73D76A718319A593F8551A0D3747404C51CCE5869CFC6AEDC7EDF">>}, {<<"lhttpc">>, <<"76B5FA6149D1E10D4B1FBC4EBD51D371DB19C1AB9F0A9ECF5B526440DF064E97">>}, {<<"luerl">>, <<"9CAFD4F6094FF0F5A9D278FD81D60D3E026C820BDFB6CACD4B1BD909F21B525D">>}, From d75bf85a5df50f5b768d1458c0729b467ea0300c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 13 Nov 2024 10:02:26 +0100 Subject: [PATCH 6/6] Remove lager from big tests (it was unused) --- big_tests/Makefile | 2 +- big_tests/rebar.config | 1 - big_tests/rebar.lock | 6 ------ 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/big_tests/Makefile b/big_tests/Makefile index f3c51b7a411..144b2f17f88 100644 --- a/big_tests/Makefile +++ b/big_tests/Makefile @@ -6,7 +6,7 @@ TESTSPEC ?= default.spec PRESET ?= all CT_HOOKS ?= PREPARE ?= prepare -ADD_OPTS ?= -sasl sasl_error_logger false -lager handlers [] +ADD_OPTS ?= -sasl sasl_error_logger false TLS_DIST ?= false REPO_DIR ?= .. TEST_DIR ?= . diff --git a/big_tests/rebar.config b/big_tests/rebar.config index 1ac891729be..db15581d900 100644 --- a/big_tests/rebar.config +++ b/big_tests/rebar.config @@ -8,7 +8,6 @@ %% We use https:// instead of git:// {deps, [ - {lager, "3.9.2"}, {base16, "2.0.1"}, {exml, "3.4.1", {pkg, hexml}}, {bbmustache, "1.12.2"}, diff --git a/big_tests/rebar.lock b/big_tests/rebar.lock index 1633bd698aa..a6d7826a013 100644 --- a/big_tests/rebar.lock +++ b/big_tests/rebar.lock @@ -18,11 +18,9 @@ {<<"fast_scram">>,{pkg,<<"fast_scram">>,<<"0.6.0">>},1}, {<<"fast_tls">>,{pkg,<<"fast_tls">>,<<"1.1.21">>},0}, {<<"fusco">>,{pkg,<<"fusco">>,<<"0.1.1">>},0}, - {<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1}, {<<"gun">>,{pkg,<<"gun">>,<<"2.1.0">>},0}, {<<"jid">>,{pkg,<<"mongoose_jid">>,<<"2.1.0">>},0}, {<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.1.1">>},0}, - {<<"lager">>,{pkg,<<"lager">>,<<"3.9.2">>},0}, {<<"meck">>,{pkg,<<"meck">>,<<"0.9.2">>},1}, {<<"p1_utils">>,{pkg,<<"p1_utils">>,<<"1.0.25">>},1}, {<<"proper">>,{pkg,<<"proper">>,<<"1.4.0">>},0}, @@ -52,11 +50,9 @@ {<<"fast_scram">>, <<"70724F584A118DA147A51EE38DEE56203F217D58AD61E0BB2C2EF834C16B35B8">>}, {<<"fast_tls">>, <<"65D7D547A09EEFB37A1C0D04D8601FAC4F3E6E2C1EDE859A7787081670F9648D">>}, {<<"fusco">>, <<"3DD6A90151DFEF30EA1937CC44E9A59177C0094918388D9BCAA2F2DC5E2AE4AA">>}, - {<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>}, {<<"gun">>, <<"B4E4CBBF3026D21981C447E9E7CA856766046EFF693720BA43114D7F5DE36E87">>}, {<<"jid">>, <<"7798E7443124BF93A58E56794D6F28CDF126A1AA7B318663E762287C9CFE9397">>}, {<<"jiffy">>, <<"ACA10F47AA91697BF24AB9582C74E00E8E95474C7EF9F76D4F1A338D0F5DE21B">>}, - {<<"lager">>, <<"4CAB289120EB24964E3886BD22323CB5FEFE4510C076992A23AD18CF85413D8C">>}, {<<"meck">>, <<"85CCBAB053F1DB86C7CA240E9FC718170EE5BDA03810A6292B5306BF31BAE5F5">>}, {<<"p1_utils">>, <<"2D39B5015A567BBD2CC7033EEB93A7C60D8C84EFE1EF69A3473FAA07FA268187">>}, {<<"proper">>, <<"89A44B8C39D28BB9B4BE8E4D715D534905B325470F2E0EC5E004D12484A79434">>}, @@ -85,11 +81,9 @@ {<<"fast_scram">>, <<"771D034341599CFC6A6C5E56CF924B68D2C7478088CAF17419E3147B66914667">>}, {<<"fast_tls">>, <<"131542913937025E48CD80AA81F00359686D5501B75621E72026A87B5229505B">>}, {<<"fusco">>, <<"6343551BD1E824F2A6CA85E1158C5B37C320FD449FBFEC7450A73F192AAF9022">>}, - {<<"goldrush">>, <<"99CB4128CFFCB3227581E5D4D803D5413FA643F4EB96523F77D9E6937D994CEB">>}, {<<"gun">>, <<"52FC7FC246BFC3B00E01AEA1C2854C70A366348574AB50C57DFE796D24A0101D">>}, {<<"jid">>, <<"C2F5B32C9CE8B7B9F321E4DCFE12380CD6CB93CE2208312570D65A06CBA24837">>}, {<<"jiffy">>, <<"62E1F0581C3C19C33A725C781DFA88410D8BFF1BBAFC3885A2552286B4785C4C">>}, - {<<"lager">>, <<"7F904D9E87A8CB7E66156ED31768D1C8E26EBA1D54F4BC85B1AA4AC1F6340C28">>}, {<<"meck">>, <<"81344F561357DC40A8344AFA53767C32669153355B626EA9FCBC8DA6B3045826">>}, {<<"p1_utils">>, <<"9219214428F2C6E5D3187FF8EB9A8783695C2427420BE9A259840E07ADA32847">>}, {<<"proper">>, <<"18285842185BD33EFBDA97D134A5CB5A0884384DB36119FEE0E3CFA488568CBB">>},