Compare commits

...

998 Commits

Author SHA1 Message Date
Xinyu Liu ff1d91a2f3
Merge pull request #7602 from EMQ-YangM/fix_rule-engine
fix: fix behavior of rule-engine when selection field does not exist
2022-04-13 17:41:26 +08:00
EMQ-YangM 0dc26ba483 fix: create new version 2022-04-13 15:01:47 +08:00
EMQ-YangM 6600de710a fix: fix behavior of rule-engine when selection field does not exist
when the selection field does not exist, it should output field => undefined
2022-04-13 14:55:43 +08:00
Zaiming (Stone) Shi 69b9be13cc
Merge pull request #7584 from zmstone/0411-allow-space-in-path
fix: make possible to have white spaces in root path
2022-04-13 06:09:27 +01:00
Zaiming (Stone) Shi d8cad2cc6c refactor(bin/emqx_ctl): simplify emqx_ctl
There is no need to duplicate the node name/cookie resolution
in another script, everything is ready in bin/emqx
2022-04-12 23:05:52 +02:00
Zaiming (Stone) Shi 2da27392f7 chore: refine boot script with more readable help info 2022-04-12 23:05:17 +02:00
Zaiming (Stone) Shi 5e652217c8 fix: make possible to have white spaces in root path 2022-04-12 00:05:26 +02:00
DDDHuang 116c04560d
Merge pull request #7576 from DDDHuang/bad_delete_resource
fix: random id ensure do not delete resource
2022-04-11 19:38:15 +08:00
DDDHuang 73ac4c1ff8 fix: random id ensure do not delete resource 2022-04-11 18:33:20 +08:00
Xinyu Liu 54d5dbec7c
Merge pull request #7555 from DDDHuang/disable_sni
fix: disable server_name_indication suport
2022-04-11 09:27:06 +08:00
DDDHuang a483f5ffa4 fix: bad appup 2022-04-10 12:57:50 +08:00
DDDHuang 4a692f0c2e fix: config schema sni disable 2022-04-10 12:57:50 +08:00
DDDHuang af4250dcf4 fix: mqtt bridge config schema sni disable spelling 2022-04-10 12:57:50 +08:00
DDDHuang 2464c110af fix: add fix sni change log 2022-04-10 12:57:50 +08:00
DDDHuang 3e9b91e53a fix: disable server_name_indication suport 2022-04-10 12:57:50 +08:00
Zaiming (Stone) Shi 4390c58ebb
Merge pull request #7564 from zmstone/0408-4.3-build-make-centos6-happy
build: make centos6 happy
2022-04-08 13:28:12 +01:00
Zaiming (Stone) Shi d205cb6fc0 build: make centos6 happy 2022-04-08 14:26:03 +02:00
Xinyu Liu beb5b5fada
Merge pull request #7560 from HJianBo/changes
chore: improve changes
2022-04-08 18:38:14 +08:00
JianBo He f7d8f16067 chore: improve changes 2022-04-08 18:23:03 +08:00
Shawn 4c34df4f06 chore: release 4.3.14-rc.1 2022-04-08 18:18:19 +08:00
Xinyu Liu 0a77e1a9b1
Merge pull request #7558 from lafirest/fix/empty_topic_with_alias
fix(frame): fix empty topic check error
2022-04-08 18:07:42 +08:00
firest eec204517f fix(frame): fix empty topic check error 2022-04-08 16:26:07 +08:00
Shawn d155c3adb5 fix: add emqx_app into appup.src 2022-04-08 16:09:10 +08:00
JianBo He 731c3271a6
Merge pull request #7553 from JimMoen/update-dashboard-4.3
chore: update dashboard version
2022-04-08 15:49:17 +08:00
JimMoen 7f5abdfd5b chore: update dashboard version 2022-04-08 14:22:53 +08:00
Xinyu Liu 82657017f9
Merge pull request #7549 from HJianBo/typos-fixes
chore: eliminate some compiling warnings and improve change logs
2022-04-08 14:13:21 +08:00
Xinyu Liu e317043109
Merge pull request #7552 from EMQ-YangM/fix_kafka_resource_update
fix: delete a resource before updating it
2022-04-08 13:46:56 +08:00
JianBo He 016ca6823b chore: disable configure shared_subscription_strategy for a group 2022-04-08 13:32:20 +08:00
JianBo He 6c39fd5696
Merge pull request #7544 from JimMoen/update-eredis-cluster
chore: update eredis_cluster version to 0.7.1
2022-04-08 11:50:07 +08:00
EMQ-YangM 8530ecec4d fix: delete a resource before updating it 2022-04-08 11:46:10 +08:00
Yang Miao 70e29b08e6
Merge pull request #7550 from EMQ-YangM/add_try_catch
fix: discard rpc call failed data
2022-04-08 11:28:01 +08:00
JianBo He 1ff371bdea test(dashboard): avoid to start useless plugins
The #7520 causes the default load_{plugins,modules} file to be used when
starting the slave node. In this case, the slave will automatically start
the emqx-dashbord plugin with the default configuration when it re-join
cluster, which will cause the applications to fail to start.
2022-04-08 11:16:39 +08:00
JianBo He bf1a3fe1eb chore: eliminate some compiling warnings and improve change logs 2022-04-08 11:16:37 +08:00
EMQ-YangM adf7d53ca5 fix: use concat replace flatten 2022-04-08 10:27:28 +08:00
EMQ-YangM 7606f55673 fix: update emqx_rule_engine.appup.src 2022-04-08 10:17:18 +08:00
EMQ-YangM 96b26bf4ce fix: discard rpc call failed data 2022-04-08 10:12:40 +08:00
DDDHuang f80a2e345c
Merge pull request #7545 from DDDHuang/start_mongo_auth
fix: start auth & acl mongo with availability check
2022-04-08 09:42:53 +08:00
Zaiming (Stone) Shi b294bad88e
Merge pull request #7462 from gsychev/bridge_local_forwards
feat(shared_sub): per group strategies and local strategy
2022-04-07 16:30:05 +01:00
Zaiming (Stone) Shi 9694c3277d fix(appup): re-generate emqx.appup.src 2022-04-07 15:17:02 +02:00
JianBo He 2b28b5f8c6
Merge pull request #7524 from JimMoen/exhook-cluster-name
Exhook provide `request_meta` to distinguish `cluster_name`
2022-04-07 19:21:51 +08:00
DDDHuang 3c34cb3b6a fix: start auth & acl mongo with availability check 2022-04-07 18:27:04 +08:00
Zaiming (Stone) Shi a791459e55
Merge pull request #7530 from qzhuyan/dev/william/mnesia-wait-for-table-diagnosis
feat: mnesia wait_for_table diagnosis logging
2022-04-07 11:21:01 +01:00
Georgy Sychev 0c74227995 feat(shared_sub): per group strategies and local strategy
Adds backward compatible per group strategy for shared subscriptions
Adds local shared subscription strategy
2022-04-07 13:40:02 +04:00
JimMoen 258ff284af chore: update eredis_cluster version to 0.7.1 2022-04-07 17:37:34 +08:00
JimMoen 1910249058 chore: update CHANGES-4.3.md and appup 2022-04-07 17:26:59 +08:00
JimMoen bdea05f022 test(exhook): other cluster_name only handle 'cilent.*' hooks 2022-04-07 17:26:59 +08:00
JimMoen e7f5372fae feat(exhook): add field `meta` for grpc proto 2022-04-07 17:26:59 +08:00
JimMoen 0297dd723e feat(emqx): provide cluster_name api 2022-04-07 17:21:37 +08:00
William Yang cb6b20c720 feat: mnesia wait_for_table diagnosis logging
bump ekka to 0.8.1.9
2022-04-07 08:40:47 +02:00
Yang Miao 16dc0d6555
Merge pull request #7536 from EMQ-YangM/reset_cluster_metrics
feat: impl reset cluster metrics
2022-04-07 11:31:49 +08:00
Yang Miao 75486efb11
Merge pull request #7534 from EMQ-YangM/dev/v4.3.14
fix: change rule_speed record type
2022-04-07 10:37:27 +08:00
EMQ-YangM 1c32b08b21 feat: impl reset cluster metrics 2022-04-07 10:32:58 +08:00
EMQ-YangM 0e02e8df9d fix: change rule_speed record type 2022-04-07 09:50:31 +08:00
Thales Macedo Garitezi 5abe0a91dd
Merge pull request #7520 from thalesmg/fix-default-loaded-modules-43
fix: ensure default values for `loaded_{plugins,modules}`
2022-04-06 14:31:57 -03:00
Thales Macedo Garitezi d99d531b8f
chore: update changelog 2022-04-06 09:19:19 -03:00
Thales Macedo Garitezi 11c61a7085
fix: silence grep/sed warnings in docker entrypoint 2022-04-06 09:19:19 -03:00
Thales Macedo Garitezi a1705f5653
fix: flaky test 2022-04-06 09:11:09 -03:00
Thales Macedo Garitezi 63146cb148
chore: update appup files and bump emqx_modules app vsn 2022-04-06 09:11:07 -03:00
Thales Macedo Garitezi aa19283ff2
fix: ensure default values for `loaded_{plugins,modules}`
Fixes #7455 .

This tries to populate `loaded_{plugins,modules}` files with default
values before loading them, in case they don't exist.
2022-04-06 09:08:21 -03:00
JianBo He bbda2e4dfa
Merge pull request #7427 from HJianBo/fix-psk-cipher
Fix psk cipher suites
2022-04-06 16:04:53 +08:00
JianBo He c603b2c7e3 chore: update appup.src files 2022-04-06 10:44:08 +08:00
JianBo He 18a084017a chore: update CHANGES-4.3.md 2022-04-06 10:44:06 +08:00
JianBo He 43a000b7fd chore: add the otp vsn limitation 2022-04-06 10:43:27 +08:00
JianBo He 759b1dacdf chore(schema): check tls_version if psk_cipher configured 2022-04-06 10:43:27 +08:00
JianBo He 024c7c59b7 chore: unify all psk cipher suites 2022-04-06 10:43:27 +08:00
JianBo He f1ff80fc16 test(psk): test psk file reading and handshake 2022-04-06 10:43:27 +08:00
JianBo He d2684a25c8 chore(psk): update psk_cipher default ciphers 2022-04-06 10:43:27 +08:00
Zaiming (Stone) Shi a35e0adf51
Merge pull request #7518 from zmstone/dashboard_password_reset_after_leaving_cluster
Dashboard password reset after leaving cluster
2022-04-05 23:15:36 +01:00
Zaiming (Stone) Shi c422edd977 test(emqx_dashboard_SUITE): add init/end_per_testcase 2022-04-05 23:41:35 +02:00
Zaiming (Stone) Shi 164209b576 test: use end_per_testcase to restore default admin password 2022-04-05 22:29:43 +02:00
Zaiming (Stone) Shi d219e475fb fix(emqx_dashboard_admin): put changed default user pwd in pt
plugin app envs are all unloaded when the app reboots
2022-04-05 13:59:58 +02:00
Zaiming (Stone) Shi 155befe418 chore: no duplicated reads and some comment/message rewording
Co-authored-by: Dmitrii <99872536+ieQu1@users.noreply.github.com>
2022-04-05 13:31:24 +02:00
Zaiming (Stone) Shi 6cc55f5c34 chore: add back the default password warning 2022-04-05 12:22:04 +02:00
Zaiming (Stone) Shi 0d4822ba78 refactor(emqx_dashboard_admin): simplify default pwd read/write 2022-04-05 11:50:18 +02:00
Georgy Sychev 1a715c8708 feat(emqx_dashboard): subsciption to update password
emqx_dashboard restarted in ekka hook
Closes #3155
2022-04-05 10:40:09 +02:00
Zaiming (Stone) Shi 4b42da53e7
Merge pull request #7498 from zmstone/0401-4.3-docs-fix-cli-example-type-add-forward-not-forwards
docs: fix typos in CLI doc, add-froard not add-forwards
2022-04-04 20:09:35 +01:00
Zaiming (Stone) Shi 12d0176bad
Merge pull request #7508 from zmstone/0402-4.3-fix-certs-file-path-when-not-uploaded
fix(ssl): try to guess cert file paths
2022-04-04 20:03:38 +01:00
Zaiming (Stone) Shi 5b58eaa203 refactor(emqx_rule_engine): return not raise error for known reasons 2022-04-04 19:10:52 +02:00
Zaiming (Stone) Shi 65e2c1390e fix(ssl): try to guess cert file paths
The GUI has "etc/certx/..." hard coded as defaults.
However this relative path only works when it's a zip package
or when running in docker.

The other two possible abs paths are:
1. the upload dir
2. "/etc"
2022-04-04 19:10:52 +02:00
Zaiming (Stone) Shi 8798a5160c fix: ensure install_upgrace.escript always restore cwd 2022-04-04 19:10:52 +02:00
Zaiming (Stone) Shi 5b36ec8cb2
Merge pull request #7510 fix get-distro.sh for windows
chore: fix get-distro.sh for windows
2022-04-04 15:03:21 +01:00
Zaiming (Stone) Shi 4c1cca2769
Merge pull request #7511 from zmstone/0404-4.3-upgrade-dependency-lc-to-0.2.1
chore: upgrade app lc from 0.2.0 to 0.2.1
2022-04-04 13:57:14 +01:00
Zaiming (Stone) Shi d6d232a7dd chore: make get-distro.sh aware of windows 2022-04-04 14:35:11 +02:00
Zaiming (Stone) Shi d7ebd1040c chore: upgrade app lc from 0.2.0 to 0.2.1
0.2.1 contains a minior fix to avoid flag process getting
force killed if beam file force purged
2022-04-04 10:33:21 +02:00
Zaiming (Stone) Shi 84651d5b07 chore: no error when delete rebar.lock using make clean-all command 2022-04-04 09:52:41 +02:00
Zaiming (Stone) Shi d49c8b61e6
Merge pull request #7425 from emqx/dev/v4.3.14
dev/v4.3.14 -> main-v4.3
2022-04-03 18:06:14 +02:00
Zaiming (Stone) Shi 2e7a741022 chore: bump dashboard app version 2022-04-03 08:43:34 +02:00
Xinyu Liu 7b4d3ecb3a
Merge pull request #7504 from EMQ-YangM/update_mongodb_driver
fix: update mongodb driver to fix potential process leak
2022-04-03 11:59:09 +08:00
Zaiming (Stone) Shi 67ce53b5fc fix(appup): re-generated emqx_rule_engine.appup.src 2022-04-02 23:25:36 +02:00
Zaiming (Stone) Shi a54813dd69 fix(appup): re-generate appup from 4.3.13 2022-04-02 23:00:41 +02:00
Zaiming (Stone) Shi 19bf4c3b17 Merge remote-tracking branch 'origin/main-v4.3' into dev/v4.3.14 2022-04-02 22:34:37 +02:00
Yang Miao 851bfcfd76
Merge pull request #7503 from EMQ-YangM/dev/v4.3.14
feat: enhanced rule engine error handling when json parsing error
2022-04-02 17:18:00 +08:00
EMQ-YangM 9d25c58bb1 fix: move mongodb-erlang to top level rebar.config 2022-04-02 16:54:48 +08:00
EMQ-YangM 299c369d80 feat: enhanced rule engine error handling when json parsing error 2022-04-02 16:24:07 +08:00
Shawn 4a57c10f61 chore: release 4.3.13 2022-04-02 11:41:00 +08:00
zhouzb 3b886035cc
Merge pull request #7501 from tigercl/chore/release-vsn
chore: bump release vsn
2022-04-02 10:31:52 +08:00
zhouzb 3610f931cf chore: bump release vsn 2022-04-02 10:29:32 +08:00
EMQ-YangM c84a4b2b6b fix: update mongodb driver to fix potential process leak 2022-04-02 10:27:44 +08:00
zhouzb 383d2966ef
Merge pull request #7500 from Rory-Z/main-v4.3
ci: push docker image when tag event
2022-04-02 10:26:39 +08:00
zhanghongtong e183ae2499 ci: push docker image when tag event 2022-04-02 10:13:37 +08:00
Zaiming (Stone) Shi 25dc4ab14f docs: fix typos in CLI doc, add-froard not add-forwards 2022-04-01 18:28:25 +02:00
Shawn 1d2aa1c8c1 chore: release 4.3.13 2022-04-01 17:55:43 +08:00
zhongwencool 5454f0ce04
Merge pull request #7493 from zhongwencool/pin-ehttpc-0.1.15
fix: force delete ehttpc pool.
2022-04-01 17:48:06 +08:00
zhongwencool fa8a222b38 fix: force delete ehttpc pool. 2022-04-01 17:41:12 +08:00
Yang Miao 5d3caf3b1f
Merge pull request #7474 from EMQ-YangM/dev/v4.3.14
feat: impl api PUT /rules/{id}/reset_metrics
2022-04-01 13:25:11 +08:00
Shawn ec0d43bcf7 chore: release 4.3.13-rc.4 2022-04-01 10:01:48 +08:00
Xinyu Liu b84ef11935
Merge branch 'dev/v4.3.14' into dev/v4.3.14 2022-04-01 09:32:42 +08:00
Xinyu Liu 39a928f85e
Merge pull request #7459 from EMQ-YangM/fix_patter_match_v4.3
fix: use maps:get/3 to avoid crash after match failure
2022-04-01 09:15:59 +08:00
Xinyu Liu 3cc0bb8284
Merge branch 'dev/v4.3.14' into fix_patter_match_v4.3 2022-04-01 09:14:34 +08:00
Xinyu Liu 5290e93ef1
Merge pull request #7488 from emqx/4.3-update-erlang-for-windows
ci: upgrade erlang for windows
2022-04-01 08:48:21 +08:00
Xinyu Liu 79b6b881ec
Merge pull request #7482 from zmstone/4.3-upgrader-node-hidden-connect
fix(relup): upgrader node hidden connect target node
2022-04-01 08:45:06 +08:00
Zaiming (Stone) Shi 5467262b0f Merge remote-tracking branch 'origin/main-v4.3' into dev/v4.3.14 2022-04-01 00:37:59 +02:00
Zaiming (Stone) Shi 8785f87473 ci: upgrade erlang for windows 2022-03-31 23:29:53 +02:00
Zaiming (Stone) Shi cd06edf8c8 fix(relup): upgrader node hidden connect target node 2022-03-31 18:30:20 +02:00
zhongwencool 6e544606ef
Merge pull request #7469 from zhongwencool/remove-st-from-catch
chore: remove useless stacktrace from catch.
2022-03-31 22:16:00 +08:00
EMQ-YangM ea17dd776c fix: update CHANGES-4.3.md 2022-03-31 18:21:40 +08:00
EMQ-YangM 326634c287 feat: impl api PUT /rules/{id}/reset_metrics 2022-03-31 18:00:57 +08:00
Xinyu Liu 34f1f697ff
Merge pull request #7476 from terry-xiaoyu/release_4.3.13-rc.3
chore: release 4.3.13-rc.3
2022-03-31 17:57:59 +08:00
Shawn c037c2cf6c chore: release 4.3.13-rc.3 2022-03-31 17:54:20 +08:00
Xinyu Liu e1dfa3eed2
Merge pull request #7471 from zmstone/fix-script-reset-before-clean
chore(appup): fix update-appup.sh
2022-03-31 17:51:23 +08:00
Zaiming (Stone) Shi bbe6209539
Merge pull request #7472 from zmstone/docs-update-4.3-changelog
docs: Update CHANGES-4.3.md to cover changes made in build env
2022-03-31 10:43:39 +02:00
Zaiming (Stone) Shi b9c02bff1e ci: delete yum install openssl11 in test 2022-03-31 10:39:30 +02:00
Zaiming (Stone) Shi 9cd63c87fc docs: Update CHANGES-4.3.md to cover changes made in build env 2022-03-31 10:25:57 +02:00
Zaiming (Stone) Shi 38447ff187 chore(appup): fix update-appup.sh
git reset before clean
2022-03-31 10:10:12 +02:00
zhongwencool fe6af95f88 chore: remove useless stacktrace from catch. 2022-03-31 16:01:20 +08:00
EMQ-YangM 510e4d31e4 fix: load_module emqx_rule_events 2022-03-31 13:48:12 +08:00
JianBo He 1a302b1914
Merge pull request #7460 from lafirest/fix/empty_topic_4.3.14
fix(frame): forbidden empty topic in strict mode
2022-03-31 11:48:56 +08:00
firest ea8ddcef60 fix: fix spell error in CHANGES-4.3.md 2022-03-31 10:34:06 +08:00
DDDHuang e801f5b3a2
Merge pull request #7453 from DDDHuang/re_source_test_4314
fix(rule): connection test when creating a resource
2022-03-30 15:21:48 +08:00
firest 22beba8ebd chore: update changes-4.3.md 2022-03-30 11:12:33 +08:00
firest bf68735664 fix(frame): forbidden empty topic in strict mode 2022-03-30 10:42:56 +08:00
EMQ-YangM cead8c9056 fix: use masp:get/3 to avoid crash after match failure 2022-03-30 09:44:06 +08:00
DDDHuang 6ab0934674 fix(rule): connection test when creating a resource 2022-03-30 09:23:51 +08:00
zhongwencool 3303b987a1
Merge pull request #7447 from zhongwencool/export-test-function
test: Export test function
2022-03-29 22:56:41 +08:00
zhongwencool 16b8fc6edc fix: emqx.appup.src 2022-03-29 21:39:44 +08:00
Xinyu Liu c3d3a5a464
Merge pull request #7450 from emqx/revert-7392-re_source_test
fix(revert): connection test when creating a resource
2022-03-29 19:17:55 +08:00
DDDHuang 47e807b2ac
Revert "fix(rule): connection test when creating a resource" 2022-03-29 19:16:06 +08:00
DDDHuang 0684b4f716
Merge pull request #7392 from DDDHuang/re_source_test
fix(rule): connection test when creating a resource
2022-03-29 19:09:10 +08:00
zhongwencool 8c6cd2e92f
Merge pull request #7443 from zhongwencool/export-test-case-v4.3.14
Export test function for CT v4.3.14
2022-03-29 18:02:30 +08:00
DDDHuang d297e883c2 fix: appup 2022-03-29 17:37:00 +08:00
zhongwencool 4ee586a738 fix: appup.src 2022-03-29 17:12:35 +08:00
zhongwencool 06adcb9126 Merge branch 'dev/v4.3.14' into export-test-case-v4.3.14 2022-03-29 15:55:24 +08:00
zhongwencool b47aef63a1 fix: emqx.appup.src 2022-03-29 15:16:57 +08:00
zhongwencool 517f8a7c9b chore: add validator schema function 2022-03-29 14:53:03 +08:00
zhongwencool f9a85614d4 chore: export test function for ee's hot-conf 2022-03-29 14:52:35 +08:00
DDDHuang 46cfcf662e fix(rule): safe apply & test resource in cluster 2022-03-29 13:37:32 +08:00
DDDHuang 63616c5e93 Merge branch 'main-v4.3' of https://github.com/emqx/emqx into re_source_test 2022-03-29 09:07:58 +08:00
Zaiming (Stone) Shi bb240e8f91 Merge remote-tracking branch 'origin/main-v4.3' into dev/v4.3.14 2022-03-28 17:40:54 +02:00
Zaiming (Stone) Shi 4991dcbe3b
Merge pull request #7426 from zmstone/chore-fix-appup-update-script
chore: fix appup update script
2022-03-28 17:39:55 +02:00
Zaiming (Stone) Shi 59fae1714b chore: use shorter path 2022-03-28 14:10:33 +02:00
JianBo He 22573ff294
Merge pull request #7408 from JimMoen/exhook-priority
Support exhook customize hook priority
2022-03-28 18:29:25 +08:00
Zaiming (Stone) Shi 6ca0e63599 chore: fix appup update script
so it can handle switch between tags
2022-03-28 09:58:03 +02:00
JimMoen a168f08850 chore: update CHANGES-4.3.md 2022-03-28 15:54:38 +08:00
JimMoen b17fd40091 chore(exhook): update appup.src, add field when updating module 2022-03-28 15:54:38 +08:00
JimMoen 1a57d0d2ca test(exhook): customized hooks priority 2022-03-28 15:54:38 +08:00
JimMoen b7f10b67a8 feat(exhook): support customize hook_priority 2022-03-28 15:54:38 +08:00
Chris Hicks d255be2d51
Merge pull request #7424 from mononym/EMQX-3885-e-4-3-9-support-new-mongo-db-bjson-date
feat: Add mongo_date function to support saving timestamp as MongoDB …
2022-03-25 17:50:49 +01:00
Chris a1a37bcbee feat: Add mongo_date function to support saving timestamp as MongoDB Date object 2022-03-25 17:43:32 +01:00
JimMoen 38c515908f feat(hook): put emqx_hook with more fields 2022-03-25 09:58:13 +08:00
JimMoen 09b9015c51 chore: rm rebar.lock when make target `clean-all` 2022-03-25 09:58:13 +08:00
Zaiming (Stone) Shi d3bcc201d6
Merge pull request #7401 from zmstone/ci-add-build-base-option-to-appup-update-script
chore: update-appup.sh always rebuild baseline
2022-03-24 15:58:25 +01:00
Zaiming (Stone) Shi b8afa16b53 chore: fix shellcheck 2022-03-24 12:28:34 +01:00
Zaiming (Stone) Shi 3944888a19 chore: update-appup.sh always rebuild baseline
Reasons
* OTP version might be different in developer's env and build env
* For some tags, we do not build release. e.g. rel-v4.4.X
2022-03-24 11:23:47 +01:00
JianBo He 242035139e
Merge pull request #7394 from HJianBo/update-dashboard-vsn
Pre-release v4.3.13: Update dashboard vsn
2022-03-24 17:11:33 +08:00
JianBo He 61d3ed31e8 chore: bump vsn to 4.3.13-rc.2 2022-03-24 14:23:19 +08:00
JianBo He 5e42a67c8d chore: update dashboard vsn 2022-03-24 14:22:19 +08:00
DDDHuang c3237b6281 fix(rule): connection test when creating a resource 2022-03-24 10:39:54 +08:00
JianBo He 0a63de9277
Merge pull request #7378 from HJianBo/refine_webhook_appups
Pre-release v4.3.13: Fix some app.src and appup.src files
2022-03-23 21:28:54 +08:00
Zaiming (Stone) Shi 3868fb088c chore: bump emqx_web_hook to 4.3.10 2022-03-23 13:35:05 +01:00
JianBo He b76372e621 chore: remove duplicated emqx_rule_funcs in appup.src 2022-03-23 19:29:58 +08:00
JianBo He 5492ab2cc9 chore(bridge-mqtt): use `VSN` placeholder instead of vsn number 2022-03-23 18:37:40 +08:00
JianBo He a4d2aa1dd4 chore: correct the app.src & appup.src 2022-03-23 18:37:40 +08:00
JianBo He 0309302c42
Merge pull request #7376 from lafirest/fix/flaky_test
fix(mod_subscription): fix test case error
2022-03-23 18:37:24 +08:00
Xinyu Liu 0a98086329
Merge pull request #7379 from terry-xiaoyu/update_changes2
fix(doc): update CHANGES-4.3.md for #7374
2022-03-23 18:31:49 +08:00
Shawn ac8bb41ea8 fix(doc): update CHANGES-4.3.md for #7374 2022-03-23 18:31:09 +08:00
Xinyu Liu 0348707aca
Merge pull request #7374 from terry-xiaoyu/resource_get_status_timeout
fix(rule): get the cached status when calling emqx_rule_engine:get_resource_status/1
2022-03-23 18:00:07 +08:00
Xinyu Liu 0d55b9242d
Merge branch 'main-v4.3' into resource_get_status_timeout 2022-03-23 17:59:59 +08:00
Xinyu Liu c9ed3cb657
Merge pull request #7367 from zhongwencool/fix-bad-authorization-500-crash
fix: bad authorization format crash with 500
2022-03-23 17:58:19 +08:00
firest a2085555e9 fix(mod_subscription): fix test case error 2022-03-23 17:37:06 +08:00
Shawn e8c7388aa4 chore: update appup file for emqx_rule_engine 2022-03-23 16:21:27 +08:00
zhongwencool b993595c6d fix: add emqx_rule_funcs to appup.src 2022-03-23 15:42:53 +08:00
zhongwencool 99dfd8504c fix: bad authorization format crash with 500 2022-03-23 15:34:23 +08:00
Shawn 5275e6a30f fix(rule): get the cached status when calling emqx_rule_engine:get_resource_status/1 2022-03-23 15:33:50 +08:00
lafirest ce2e4f51ac
Merge pull request #7353 from lafirest/fix/auto_sub_empty_topic_4.3
fix(auto_subscribe): make log if the topic is empty when auto subscribe
2022-03-23 11:20:19 +08:00
firest b12b72df99 chore: update changes-4.3.md 2022-03-23 10:55:19 +08:00
Yang Miao d4fdbb3020
Merge pull request #7364 from EMQ-YangM/feat_add_zip_gzip
feat(emqx_rule_funcs): add functions gzip, gunzip, zip, unzip
2022-03-22 18:44:37 +08:00
firest c43f179204 fix(mod_subscription): improve the log information 2022-03-22 18:09:06 +08:00
Rory Z 479d0bf5a4
Merge pull request #7210 from Rory-Z/fix/fix-helm-upgrade-error
fix(helm): delete needless labels for support helm upgrade
2022-03-22 15:20:21 +08:00
EMQ-YangM 62eff94249 feat(emqx_rule_funcs): add functions gzip, gunzip, zip, unzip 2022-03-22 15:16:31 +08:00
firest 4fe9275103 chore(modules): update appup file 2022-03-22 10:08:52 +08:00
firest c2b1571134 fix(auto_subscribe): make log if the topic is empty when auto subscribe 2022-03-21 18:32:42 +08:00
JianBo He e4b5001a57
Merge pull request #7309 from HJianBo/send_disconnect_pkt_while_kicked
fix(channel): send DISCONNECT packet if connection has been kicked
2022-03-21 11:56:18 +08:00
JianBo He 706c7725f9 test: update test/emqx_channel_SUITE.erl
Co-authored-by: Thales Macedo Garitezi <thalesmg@gmail.com>
2022-03-21 10:56:55 +08:00
JianBo He 604c384660 fix(channel): send will_msg if client has been kicked 2022-03-21 10:56:55 +08:00
JianBo He 75239c1388 chore: update changes-4.3.md 2022-03-21 10:56:54 +08:00
JianBo He 8d3e953eef fix(channel): send DISCONNECT packet if connection has been kicked
fix #7241
2022-03-21 10:56:37 +08:00
zhongwencool bce4ca2fbd
Merge pull request #7345 from zhongwencool/subscribe-crash-with-bad-qos
fix: subscribe api crash with bad qos.
2022-03-21 10:40:09 +08:00
zhongwencool 2be97a24dd fix: subscribe api crash with bad qos. 2022-03-21 09:19:28 +08:00
DDDHuang 479507b96a
Merge pull request #7344 from DDDHuang/up_jmeter_43x
fix(ci): update jmeter to 5.4.3
2022-03-20 23:44:52 +08:00
DDDHuang ece789b58e fix(ci): update jmeter to 5.4.3 2022-03-20 13:07:43 +08:00
Zaiming (Stone) Shi 552e7d175a
Merge pull request #7342 from zmstone/chore-fix-update-appup.sh-for-bash-3.2
chore: fix update-appup.sh for bash 3.2
2022-03-19 09:41:08 +01:00
Zaiming Shi 13086e7259 chore: fix update-appup.sh for bash 3.2 2022-03-19 08:42:52 +01:00
Xinyu Liu 3a89a6a1fe
Merge pull request #7336 from terry-xiaoyu/float_precision_10
fix(rules): enlarge precisions of floats to maximum 17 decimal places.
2022-03-18 18:28:58 +08:00
Shawn 5823751d7d chore: bump emqx_rule_engine to 4.3.9 2022-03-18 18:28:30 +08:00
Shawn 81ae2be760 fix(rules): enlarge precisions of floats to maximum 17 decimal places.
When printing floats to strings, we have to define a small decimal
limits to avoid print a too long and "inaccurate" float number:

```
2> float_to_binary(0.3).
<<"2.99999999999999988898e-01">>
```

This fix sets precision of floats to 17 digits after the decimal point.

This precision is larger than precision of most `double` data type used by
databases(14 digits for mysql and 15 digits for pgsql).
2022-03-18 15:42:01 +08:00
JianBo He 72e37dd144
Merge pull request #7300 from HJianBo/mqtt-sn-resume-subs
feat(mqttsn): introduce subs_resume option
2022-03-17 17:51:41 +08:00
zhongwencool b8afd2760c
Merge pull request #7318 from zhongwencool/fix-bad-str
fix: Add name string legitimacy check.
2022-03-17 17:49:25 +08:00
lafirest 2133f8c4a3
Merge pull request #7320 from lafirest/fix/delayed_terminate
Fix/delayed terminate
2022-03-17 10:05:31 +08:00
JianBo He b09b6ca6d2
Merge branch 'main-v4.3' into mqtt-sn-resume-subs 2022-03-17 09:39:21 +08:00
William Yang e8bbfc3806
Merge pull request #7303 from qzhuyan/dev/william/add-olp
feat: add load control app
2022-03-16 15:36:53 +01:00
zhongwencool f0a81d593d fix: dashboard ct failed 2022-03-16 16:48:03 +08:00
zhongwencool 8cf97a93af fix: urldecode appid and username. 2022-03-16 16:33:03 +08:00
firest 3e6249a8b7 fix: bump emqx_modules version 2022-03-16 15:28:44 +08:00
zhongwencool bfadcebb9c chore: remind the user to delete bad appid/username. 2022-03-16 15:23:10 +08:00
firest 186ff243ed fix(delayed): cancel stats timer when terminate 2022-03-16 14:57:17 +08:00
zhongwencool f70d777623 chore: update appup 2022-03-16 11:19:25 +08:00
zhongwencool 0555bce47e chore: add more doc for dashboard.default_user 2022-03-16 10:54:09 +08:00
zhongwencool 6b91a80712 chore: update changelog-4.3 2022-03-16 10:47:18 +08:00
zhongwencool b44512cdab fix: Add string legitimacy check. 2022-03-16 10:31:41 +08:00
William Yang 81ed61b001 feat: add load control app 2022-03-15 14:02:42 +01:00
JianBo He a3d8981635 refactor(mqttsn): assign subs_resume to mqtt-sn client process state 2022-03-15 11:28:40 +08:00
JianBo He af65310ce7 chore(script): update_appup.escript support the update cmd
We often use the advanced directive `update` when hot upgrading
gen_server, gen_statem, and other such processes, and it will be
parsed as:
```
{suspend,[Mod]},
{load,{Mod,brutal_purge,brutal_purge}},
{code_change,up,[{Mod,[Extra]}]},
{resume,[Mod]},
```
So, we should treat the update instruction as having completed the
upgrade of this module.
2022-03-15 10:51:30 +08:00
JianBo He 3823ab8693 fix: typos in emqx_sn.appup.src 2022-03-15 10:51:30 +08:00
JianBo He f8b7b9415d chore(mqttsn): update appup.src 2022-03-15 10:51:30 +08:00
JianBo He fcf1178f3b chore: update CHANGES-4.3.md 2022-03-15 10:51:29 +08:00
JianBo He d4c1b3acc6 test(mqttsn): more tests for topic register and subs_resume 2022-03-15 10:51:05 +08:00
JianBo He 3201d11212 feat(mqttsn): introduce subs_resume option
As the mqtt-sn v1.2 spec metioned, the gateway will be able to sync the
subscriptions topic-name registry to client when the client resume it's
session

port from: https://github.com/emqx/emqx-sn/pull/195
2022-03-15 10:51:05 +08:00
Chris Hicks eb5d9fa501
Merge pull request #7298 from mononym/fix-mongodb-timeout-crash
fix: prevent crash when mongodb connection times out
2022-03-14 17:01:09 +01:00
Chris 440523138b fix: prevent crash when mongodb connection times out 2022-03-14 15:09:49 +01:00
Zaiming (Stone) Shi c4f609eb42
Merge pull request #7295 from zmstone/fix-ensure-bash-for-systemd-service
chore: ensure bash wraper in emqx.service, restart wait 60 seconds
2022-03-14 13:28:35 +01:00
Chris Hicks 32fac8b67b
Merge pull request #7299 from mononym/fix-typo-in-log-message
fix: typo in log message
2022-03-14 12:55:04 +01:00
Chris 55eddfa16c fix: typo in log message 2022-03-14 10:18:18 +01:00
Zaiming (Stone) Shi 223642e62b chore: ensure bash wraper in emqx.service, restart wait 60 seconds 2022-03-14 08:08:04 +01:00
JianBo He 59bae0a27a
Merge pull request #7274 from zhongwencool/dashboard-login-warning
chore: Prompt user how to change the dashboard default password when emqx start
2022-03-11 12:41:56 +08:00
zhongwencool f82550ddc6 chore: Prompt user how to change the dashboard default password when emqx start 2022-03-10 23:01:58 +08:00
JianBo He ecc2f069f6
Merge pull request #7261 from JimMoen/mqtt-frame-utf8-check
feat(frame): utf-8 string check in `strict_mode`
2022-03-10 13:21:14 +08:00
JimMoen 892600f43f docs: update CHANGES-4.3.md 2022-03-10 13:13:07 +08:00
JimMoen 8ea84e4a01 chore(appup): update appup.src 2022-03-10 12:12:42 +08:00
JimMoen dce513df0e test(frame): malformed utf-8 packet 2022-03-10 11:39:44 +08:00
JimMoen c0b688b51f feat(frame): utf-8 string check in `strict_mode` 2022-03-10 11:23:44 +08:00
Rory Z 96695bcec5
Merge pull request #7245 from Rory-Z/build/update-helm
build(helm): add preStop command for container
2022-03-10 09:20:38 +08:00
Chris Hicks 2a4aa5a8b5
Merge pull request #7249 from mononym/fix-mongodb-deadloop
fix: update mongodb client to include deadloop fix
2022-03-09 11:49:23 +01:00
Zaiming (Stone) Shi cedeff4dab build(appup): fix module delete instructions
when there is a application_restart instruction, there is no
need to add module delete instructions
2022-03-09 11:18:02 +01:00
Chris ca5637b4a3 fix: update mongodb client to include deadloop fix 2022-03-09 10:57:29 +01:00
zhanghongtong 8057282d7d build(helm): add preStop command for container
update probe for container
2022-03-09 11:26:03 +08:00
Zaiming (Stone) Shi 04fa1980c0
Merge pull request #7229 from zmstone/build-fix-update_appup
build(update_appup): refactor appup update scripts
2022-03-08 15:20:44 +01:00
Zaiming (Stone) Shi d8e29f19cb refactor(appup): always generate appup from script 2022-03-08 13:24:54 +01:00
Xinyu Liu 9fbc211fd0
Merge pull request #7196 from DDDHuang/usort_plugins
fix(plugins): usort plugin list
2022-03-08 11:03:00 +08:00
Zaiming (Stone) Shi f8004fdd26
Merge pull request #7221 from zmstone/build-exclude-gpb-in-appup-update
build(appup): exclude gpb from appup checks
2022-03-07 06:47:00 +01:00
DDDHuang fbd70b02bc fix: override plugins list 2022-03-07 10:32:49 +08:00
DDDHuang 7884238073
fix(doc): better change log
Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
2022-03-07 09:53:19 +08:00
Zaiming (Stone) Shi 111b93b4ea fix(update-appup): pass in --repo option even when download bin package
the repo url is NOT used to clone the source,
but used to determin the sub-dir name when extracting the zip package
2022-03-05 17:24:49 +01:00
Zaiming (Stone) Shi 1ae46cc22a build(appup): exclude gpb from appup checks 2022-03-05 16:49:58 +01:00
Zaiming (Stone) Shi 8df4fb98af
Merge pull request #7220 from zmstone/fix-appup-update-for-ee
build: fix update-appup for ee
2022-03-05 12:03:42 +01:00
Zaiming (Stone) Shi 0a6e2d596b build: fix update-appup for ee 2022-03-05 11:49:44 +01:00
Zaiming (Stone) Shi 67c6206718
Merge pull request #7218 from zmstone/fix-unclosed-action-issue-credit-mohammadiahmad
fix(helm): fix unclosed action issue
2022-03-05 10:38:53 +01:00
Zaiming (Stone) Shi b4d5b722fd
Merge pull request #7217 from zmstone/ci-simplify-dashboard-download
ci: simplify dashboard download
2022-03-05 10:37:50 +01:00
ahmad.mohammadi 27be2197c0 fix(helm): fix unclosed action issue 2022-03-05 10:05:16 +01:00
Zaiming (Stone) Shi 7ba3d32bac ci: remove git-token file since EE dashboard is opensource now 2022-03-05 09:44:12 +01:00
Zaiming (Stone) Shi c6660084f8 build: one place for dashboard version 2022-03-05 09:44:12 +01:00
Zaiming (Stone) Shi 2f5982e6e2
Merge pull request #7209 from zmstone/chore-refine-boot-message
chore: refine boot message on missing dynlibs
2022-03-04 13:53:06 +01:00
Zaiming (Stone) Shi 1a02e60640
docs: fix message typo in bin/emqx 2022-03-04 13:52:11 +01:00
Zaiming (Stone) Shi 560be9a23a
Merge pull request #7212 from zmstone/fix-appup-update-handle-add-module
fix(appup_update): handle add module
2022-03-04 13:31:02 +01:00
Zaiming (Stone) Shi 3b22efeb9c build(update_appup): handle add_module instruction 2022-03-04 12:30:46 +01:00
zhanghongtong b45bbf676c fix(helm): delete needless labels for support helm upgrade 2022-03-04 18:06:12 +08:00
Zaiming (Stone) Shi a0de86f327 chore: refine boot message on missing dynlibs 2022-03-04 09:31:33 +01:00
DDDHuang 278fa96bc1 fix(plugins): usort plugin list 2022-03-04 10:46:09 +08:00
Rory Z d0b5b262fe
Merge pull request #7115 from Rory-Z/ci/update-build
ci(cross build): splitting cross builds and upload assets
2022-03-04 09:20:15 +08:00
Zaiming (Stone) Shi c6ee8097da
Merge pull request #7189 from zmstone/fix-build-arch-resolution
Fix build arch resolution
2022-03-02 21:04:29 +01:00
Zaiming (Stone) Shi 558748dab2 build(update_appup): only download package if not exist 2022-03-02 19:38:25 +01:00
Zaiming (Stone) Shi b0900fe25a build(update-appup): fix ARCH resolution 2022-03-02 19:37:11 +01:00
Zaiming (Stone) Shi 89809e84f9
Merge pull request #7172 from zmstone/chore-add-appup-update-script
chore: add appup update script
2022-03-02 18:46:24 +01:00
Zaiming (Stone) Shi 8029670741 ci: add appup update check to ci 2022-03-01 17:04:09 +01:00
Zaiming (Stone) Shi ef382bf34c chore: add --make-command to update_appup script args 2022-03-01 17:04:05 +01:00
Zaiming (Stone) Shi 0996b79d96 chore: add a script to simplify appup update 2022-03-01 17:02:29 +01:00
Zaiming (Stone) Shi 52ff180e55 chore: pin esockd 5.8.5 2022-03-01 17:02:29 +01:00
Zaiming (Stone) Shi cca9e52c9a chore(appup): add missing appup instructions 2022-03-01 11:41:52 +01:00
Zaiming (Stone) Shi 02aa665e54 chore: bump version to prepare the next release 2022-03-01 11:41:52 +01:00
Xinyu Liu 0c2a7e1a7c
Merge pull request #7165 from terry-xiaoyu/improve_install_upgrade_escript
fix(relup): release upgrade failed if release dir is removed
2022-03-01 17:41:16 +08:00
Zaiming (Stone) Shi b9f0e3a351
Merge pull request #7150 from qzhuyan/main-v4.3
fix(helm): fix configmap.env template
2022-03-01 10:29:24 +01:00
Dmitrii e5d5e2ca97
Merge pull request #7164 from ieQu1/fix-log-message
fix(auth_mnesia): Fix error message
2022-03-01 08:42:16 +01:00
zhongwencool 55aac202aa
Merge pull request #7137 from zhongwencool/get-node-info-rpc-crash
fix: rpc get node info maybe crash when emqx_sys process is not start yet.
2022-03-01 15:08:25 +08:00
zhongwencool 2c47d2c391 chore: update changelog-4.3 2022-03-01 14:19:37 +08:00
zhongwencool b1816a6647 fix: add uptime/1 for CT test. 2022-03-01 14:19:37 +08:00
zhongwencool ed41a66c6e fix: rpc get node info maybe crash when emqx_sys process is not start yet. 2022-03-01 14:19:35 +08:00
Shawn 71100427dd fix(relup): release upgrade failed if release dir is removed
If the target vsn is in `unpacked` state, but the release dir
`releases/<vsn>` is removed, then installing the target vsn
again will fail with error `{error,enoent}`.

In this case we should extract the tar ball again and then continue
to install the release.
2022-03-01 10:13:17 +08:00
ieQu1 06db325b5f fix(auth_mnesia): Fix error message 2022-02-28 18:11:55 +01:00
William Yang 0c2ba9fe50 fix(helm): fix configmap.env template
fix: #7070
2022-02-26 21:30:32 +01:00
gsychev 3af36378dd
Merge pull request #7014 from gsychev/bridge_config_topic_node_template_43
Bridge config topic node template
2022-02-25 11:56:23 +00:00
gsychev 19fcd6a4f6
Merge branch 'main-v4.3' into bridge_config_topic_node_template_43 2022-02-25 10:05:36 +00:00
Zaiming (Stone) Shi a147f82b7c
Merge pull request #7135 from thalesmg/fix-sys-mon-portinfo-43
fix(sys_mon): guard before calling `erlang:port_info` [4.3]
2022-02-25 10:52:56 +01:00
Thales Macedo Garitezi cf1cc7e9db
chore(appup): update appup files 2022-02-24 17:14:47 -03:00
Thales Macedo Garitezi 6b93127ecb
fix(sys_mon): guard before calling `erlang:port_info`
Port of #7108 .

Sometimes, the `emqx_sys_mon:procinfo/1` might be called with
something that is not a port, like `[]`.  Not sure on the conditions
for this to happen.

```
2022-02-18T20:05:02.671592+00:00 [error] Generic server emqx_sys_mon terminating. Reason: {badarg,[{erlang,port_info,[[]],[{error_info,#{module => erl_erts_errors}}]},{emqx_sys_mon,portinfo,1,[{file,"/emqx/apps/emqx/src/emqx_sys_mon.erl"},{line,205}]},{emqx_sys_mon,'-handle_info/2-fun-5-',2,[{file,"/emqx/apps/emqx/src/emqx_sys_mon.erl"},{line,150}]},{emqx_sys_mon,suppress,3,[{file,"/emqx/apps/emqx/src/emqx_sys_mon.erl"},{line,184}]},{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,695}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,771}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]}. Last message: {monitor,<0.7796.0>,busy_dist_port,[]}. State: #{events => [{busy_dist_port,#Port<0.127>}],timer => #Ref<0.2758388682.1853620226.133920>}.
```
2022-02-24 16:28:35 -03:00
JianBo He 456fcd6a54
Merge pull request #7124 from HJianBo/force-kill-takover-failure-proc
refactor(cm): rename takeover -> request_stepdown
2022-02-24 17:46:09 +08:00
JianBo He f121f9616e chore: rename testcase name 2022-02-24 17:26:17 +08:00
JianBo He b2093409b6
Merge pull request #6970 from HJianBo/fix-no-register-msg-replaying
Fix the MQTT-SN message replay when the topic is not registered to the client
2022-02-24 16:14:27 +08:00
Xinyu Liu 75b322cc2a
Merge pull request #7121 from terry-xiaoyu/fix_rel_upgrade_failed_on_eexists
fix(relup): release upgrade failed on symlink already exists
2022-02-24 16:10:10 +08:00
Shawn 815096063a chore: update the change logs 2022-02-24 16:09:23 +08:00
Shawn 63fbf8d9f8 fix(CI): add cases for relup to downgrade to old versions 2022-02-24 15:24:06 +08:00
JianBo He d622eb848f refactor(cm): rename takeover -> request_stepdown
see: https://github.com/emqx/emqx/pull/7026#pullrequestreview-891954135
2022-02-24 14:43:46 +08:00
JianBo He b22e341c67
Merge pull request #7026 from HJianBo/force-kill-takover-failure-proc
Force kill takover failure proc
2022-02-24 14:12:12 +08:00
Shawn 7dbb5b1032 fix(CI): don't guarantee not to lose a single message during relup 2022-02-24 12:52:57 +08:00
JianBo He d943cc2f1c chore(exproto): update appup.src 2022-02-24 11:51:00 +08:00
JianBo He 7236206373 fix(exproto): handle discard call 2022-02-24 11:51:00 +08:00
JianBo He bf565efc99 chore: update CHANGES-4.3.md 2022-02-24 11:51:00 +08:00
JianBo He 4673ca43a0 chore(emqx): update appup.src 2022-02-24 11:51:00 +08:00
JianBo He bfd0fd9019 refactor(cm): rename call_or_kill to takeover 2022-02-24 11:50:57 +08:00
JianBo He 2c512c2097 docs: update CHANGES-4.3.md 2022-02-24 11:30:15 +08:00
JianBo He 76d0835e4f chore(mqttsn): update appup.src 2022-02-24 11:30:12 +08:00
JianBo He e9031ea4c1 fix(mqttsn): cache and replay the invaild-topic-id delivery 2022-02-24 11:28:04 +08:00
JianBo He 96a86061c2 refactor(sn): pretty frame print formation 2022-02-24 11:28:04 +08:00
JianBo He 66807f17df test(cm): cover {takeover, 'begin'/'end'} action 2022-02-24 09:53:17 +08:00
JianBo He 6dd0b49dd2 feat(cm): force shutdown of processe that cannot answer takeover event
Related PR: #6030
2022-02-24 09:53:17 +08:00
William Yang c9ff263e59
Merge pull request #7117 from qzhuyan/bugfix/william/sys-mem-false-alarm
bugfix: sys mem false alarm
2022-02-23 15:17:28 +01:00
Shawn 442a1290a8 fix(relup): release upgrade failed on symlink already exists 2022-02-23 19:14:59 +08:00
William Yang 2c4fc6f6f7 docs(changelog): system mem false alarm 2022-02-23 11:47:19 +01:00
William Yang 372ea29d96 fix: upgrade code, system mem false alarm 2022-02-23 09:38:54 +01:00
William Yang 841d6d5036 fix: system mem false alarm 2022-02-23 09:14:28 +01:00
zhanghongtong b6e57b1789 ci(cross build): splitting cross builds and upload assets 2022-02-23 15:27:32 +08:00
JianBo He ddf2022542
Merge pull request #6983 from HJianBo/fix-exproto-online-clients-v4.3
Improve ExProto client management
2022-02-23 10:59:19 +08:00
Zaiming (Stone) Shi 42f7110a2d
Merge pull request #7107 from zmstone/fix-update-webhook-app-vsn
fix: bump emqx_web_hook app version
2022-02-22 23:41:24 +01:00
Zaiming (Stone) Shi 1fa27b28e4 fix: bump emqx_web_hook app version 2022-02-22 16:15:15 +01:00
Zaiming (Stone) Shi c1513d6faf
Merge pull request #7101 from zmstone/chore-rename-more-descriptive-info-emqx
chore: rename more descriptive EQM X to EMQX
2022-02-22 14:20:09 +01:00
Zaiming (Stone) Shi f87d262fbc
Merge pull request #7102 from zmstone/fix-docker-no-volume-for-etc
fix(docker): allow config changes in docker rebuild
2022-02-22 13:59:12 +01:00
Zaiming (Stone) Shi b4836a01fd fix(docker): allow config changes in docker rebuild 2022-02-22 12:42:13 +01:00
Zaiming (Stone) Shi 43c900bb5a chore: rename more descriptive EQM X to EMQX 2022-02-22 11:16:38 +01:00
JianBo He 7adc5fb158
Merge branch 'main-v4.3' into fix-exproto-online-clients-v4.3 2022-02-22 15:46:27 +08:00
JianBo He 3be4f30f8c
Merge pull request #7096 from JimMoen/fix-stomp-conn_props
Fix stomp conn props
2022-02-22 13:33:35 +08:00
JimMoen d98d7e77c8 chore: update CHANGES.md 2022-02-22 11:47:04 +08:00
JimMoen 3cc2f0e2d3 fix(stomp): `conn_props` should be map 2022-02-22 11:31:14 +08:00
JianBo He 9300d6636d docs: update CHANGES-4.3.md 2022-02-22 10:30:53 +08:00
JianBo He a2d8405f99 chore: update appup.src 2022-02-22 10:30:52 +08:00
JianBo He b802bcb6fc refactor(exproto): pre-register the anonymous client 2022-02-22 10:23:16 +08:00
JimMoen f42c04d6fc
Merge pull request #7085 from JimMoen/fix-server-keepalive
fix(frame): `server_keepalive` only for MQTT v5.0
2022-02-21 22:25:31 +08:00
Zaiming (Stone) Shi 5e3543e282
Merge pull request #7073 from zmstone/fix-find-command-for-4.3-and-4.4
build: fix find command for windows
2022-02-21 12:23:42 +01:00
JimMoen 31b006a0d1 fix(frame): `server_keepalive` only for MQTT v5.0 2022-02-21 18:46:53 +08:00
Ilya Averyanov 9648cd92e9
Merge pull request #7066 from savonarola/no-elvis-4.3
chore(codestyle): remove Elvis
2022-02-21 11:29:40 +03:00
Zaiming (Stone) Shi 107e447de4 build: fix find command for windows
windows has its own find command
2022-02-21 09:17:45 +01:00
Zaiming (Stone) Shi 60c3df5dee
Merge pull request #7076 from zmstone/chore-4.3-ensure-remsh-node-name-for-upgrader
chore: ensure remsh node name prefix for upgrader
2022-02-20 21:31:39 +01:00
Zaiming (Stone) Shi 2325e8cfb3 chore: ensure remsh node name prefix for upgrader
for remsh prefixed nodes, ekka pick a random port to listen on
instead of following the conventional port mapping rule:
ekka listens on 4370 for emqx or emqx0 and 4371 for
emqx1 and so on
2022-02-20 19:57:56 +01:00
Ilya Averyanov 557c52dd8a chore(codestyle): remove Elvis 2022-02-18 20:35:19 +03:00
Shawn 3bd961ca73 fix(CI): remove e|v from downloading urls of emqx packages 2022-02-18 23:05:35 +08:00
Shawn 3690d1951e chore: add more debug info for relup-base-packages.sh 2022-02-18 22:41:03 +08:00
DDDHuang c3cb04c229
Merge pull request #7041 from DDDHuang/mb_doc
fix(doc): code spelling
2022-02-18 16:38:21 +08:00
Georgy Sychev 0bd080c063 feat(emqx_bridge_mqtt): ${node} in topic config
Adds ${node} interpolation in topic option of configuration
Just like the clientid already works

Closes: #6431

feat(emqx_bridge_mqtt): bumped versions the right way

chore(appup): appups for mqtt bridge

feat(mqtt_bridge): test for bridge config

And also bumped one small version

chore(mqtt_bridge): updated CHANGES-4.3.md

fix(mqtt_bridge): conditional export

chore(mqtt_bridge): appup
2022-02-17 16:05:34 +03:00
DDDHuang 42c70cd2a5 fix(doc): code spelling 2022-02-17 14:06:17 +08:00
Zaiming (Stone) Shi 8f9b351da8
Merge pull request #7031 from zmstone/chore-rename-var-name-to-avoid-confusion
4.3 fix upgrade base package download
2022-02-17 06:05:14 +01:00
Rory Z 545abe2d52
Merge pull request #7006 from Rory-Z/ci/update-target-event
ci(build_packages): add target event
2022-02-17 09:33:17 +08:00
Zaiming (Stone) Shi 62dd815807 chore(scripts): make shellcheck happy 2022-02-16 16:16:35 +01:00
Zaiming (Stone) Shi 538f843f14 fix(relup-base-packages.sh): download per release edition 2022-02-16 16:16:10 +01:00
Zaiming (Stone) Shi f7135433be chore(relup-base-vsns.sh): rename PROFILE to EDITION
to avoid confusion with rebar profile
2022-02-16 14:10:43 +01:00
Rory Z 149fe7bcdf
Merge pull request #7010 from Rory-Z/build/add-new-script
build(relup): add new script for download relup base packages
2022-02-16 15:57:25 +08:00
zhanghongtong 2acdc64b9d style(script): rename variable name 2022-02-16 14:52:31 +08:00
Zaiming (Stone) Shi 2c3ad3cb2d
Merge pull request #7019 from zmstone/docs-remove-space-from-product-name
docs: remove space from product name
2022-02-16 07:18:39 +01:00
Zaiming (Stone) Shi d2840a8aa1 docs: change EMQ X to EMQX in more descriptive info 2022-02-15 22:18:25 +01:00
Zaiming (Stone) Shi a5f6e94467 docs: EMQ X -> EMQX 2022-02-15 22:12:46 +01:00
Zaiming (Stone) Shi c766087812
Merge pull request #7016 from zmstone/docs-delete-space-in-EMQX-product-name
docs(README): EMQ X -> EMQX
2022-02-15 19:05:42 +01:00
Zaiming (Stone) Shi e09e5673eb docs(README): EMQ X -> EMQX 2022-02-15 16:15:25 +01:00
zhanghongtong 091398d863 build(relup): add new script for download relup base packages 2022-02-15 17:57:31 +08:00
JianBo He cb5fe77706
Merge pull request #7009 from HJianBo/fix-lwm2m-api-node-badmatch
fix(lwm2m): fix querying lwm2m client list on the another node
2022-02-15 14:58:18 +08:00
JianBo He 9fb53cb47d docs: update CHANGES-4.3.md 2022-02-15 11:59:46 +08:00
JianBo He 74aa209207 chore(lwm2m): update app.src & appup.src 2022-02-15 11:59:43 +08:00
JianBo He 425546864d fix(lwm2m): fix querying lwm2m client list on the another node 2022-02-15 11:23:44 +08:00
zhanghongtong 88769bc23b ci(build_packages): cancel repeating actions 2022-02-15 10:15:25 +08:00
zhanghongtong c1f77da3b9 ci(build_packages): add target event 2022-02-15 10:11:34 +08:00
Thales Macedo Garitezi e1592c41d0
Merge pull request #6979 from thalesmg/bugfix-find-alias-clause
fix(channel): wrong case clause when alias is inexistent
2022-02-14 15:24:54 -03:00
Thales Macedo Garitezi 3f31df2297
docs: add comment explaining application and release vsn discrepancy 2022-02-14 13:18:53 -03:00
Thales Macedo Garitezi b6e9043c49
chore(changelog): update changelog 2022-02-14 13:18:51 -03:00
Thales Macedo Garitezi acf3b8cbe9
chore(emqx): update appup 2022-02-14 13:18:07 -03:00
Thales Macedo Garitezi 8302cac329
fix(channel): wrong case clause when alias is inexistent
Fixes #6978 .
2022-02-14 13:18:07 -03:00
Zaiming (Stone) Shi 206b7ac4a9
Merge pull request #6996 from zmstone/feat-add-cli-to-clean-pem-cache
feat: add cli to clean pem cache
2022-02-14 16:22:13 +01:00
Zaiming (Stone) Shi 91180595d0 refactor(cli): simplify ACL cache CLI logging 2022-02-14 14:52:34 +01:00
Zaiming (Stone) Shi f6ca64c76d feat: add pem cache CLI 2022-02-14 14:52:34 +01:00
Zaiming (Stone) Shi 2a5de6a872
Merge pull request #6995 from zmstone/ci-exclude-instead-of-include
ci: use exclude instead of include for build matrix
2022-02-13 07:18:29 +01:00
Zaiming (Stone) Shi dfb591cac7 ci: use exclude instead of include for build matrix
include is unconditional, as a result, it brins in emqx profile
to enterprise repo
2022-02-12 14:32:54 +01:00
Zaiming (Stone) Shi 5171d3811c ci: revert to openssl digest for sha256 sum on mac 2022-02-12 12:24:48 +01:00
Zaiming (Stone) Shi 9ff0899b75
Merge pull request #6994 from emqx/fix-sha256sum-on-windows
ci: fix sha256sum in windows
2022-02-12 11:04:23 +01:00
Zaiming (Stone) Shi 857e9aee52 ci: fix sha256sum in windows
for some reason Get-FileHash (or maybe later piped tools) produced
non-text content
2022-02-12 10:48:28 +01:00
Zaiming (Stone) Shi 71a9489cfe
Merge pull request #6993 from zmstone/ci-fix-action-typo
ci: fix action typo repository -> registry
2022-02-11 21:41:54 +01:00
Zaiming (Stone) Shi 257f6cc589 ci: fix action typo repository -> registry 2022-02-11 21:24:40 +01:00
Zaiming (Stone) Shi 17fa49738f
Merge pull request #6991 from emqx/test-debian10-ci
wait longer for emqx stop in relup test
2022-02-11 17:21:46 +01:00
Zaiming (Stone) Shi 2df43f8b5f ci: add more time to allow stop 2022-02-11 16:19:02 +01:00
Zaiming (Stone) Shi a42403e046 ci: quite unzip 2022-02-11 15:56:25 +01:00
Zaiming (Stone) Shi 28508e23ec ci: dump logs when failed to stop 2022-02-11 15:20:15 +01:00
Shawn 992e7e66cf
Merge pull request #6957 from thalesmg/fix-ctl-print-43
fix(ctl): fix formatting when printing messages without arguments (4.3)
2022-02-10 22:09:06 +08:00
Thales Macedo Garitezi fdef292ef7
fix(appup): rm redundant `load_module` instruction after `update` 2022-02-10 09:31:36 -03:00
Shawn 646ef25d96
Merge branch 'main-v4.3' into fix-ctl-print-43 2022-02-10 19:13:29 +08:00
JianBo He d7c432f57c
Merge pull request #6928 from Rory-Z/ci/push-multiarch-image-for-aws-ecr
ci(build_packages): push muilt arch image for aws ecr
2022-02-10 18:58:20 +08:00
Shawn b09a38d53f chore: update release to 4.3.12 2022-02-10 18:30:22 +08:00
JianBo He 175d6969d4
Merge pull request #6963 from HJianBo/fix_stomp_unexpected_linefeed
fix(stomp): fix unexpected_linefeed error if the packet truncated on …
2022-02-10 17:41:51 +08:00
Shawn 40594f9713
Merge pull request #6968 from terry-xiaoyu/ekka_0.8.1.8
update changes doc for printable message id
2022-02-10 15:31:18 +08:00
Shawn 475f0be959 docs(CHANGES): update changes doc for #6961 2022-02-10 15:30:34 +08:00
JianBo He cdfeb46951 test(mqttsn): remove unused vars 2022-02-10 15:30:10 +08:00
JianBo He 289904bbcf fix(stomp): fix unexpected_linefeed error if the packet truncated on headers 2022-02-10 14:48:45 +08:00
Zaiming (Stone) Shi 3fb5e19cc9
Merge pull request #6959 from zmstone/upgrade-to-ekka-0.8.1.8
[4.3] Upgrade to ekka 0.8.1.8
2022-02-10 07:12:35 +01:00
Shawn 967b2e4a74
Merge pull request #6965 from terry-xiaoyu/log_printable_mqtt_msg_id2
fix: emqx_message:format/1 failed on undefined message id
2022-02-10 12:45:08 +08:00
Shawn 8cf268dffb fix: emqx_message:format/1 failed on undefined message id 2022-02-10 12:43:39 +08:00
Shawn 3e962bf5ba
Merge pull request #6962 from terry-xiaoyu/log_printable_mqtt_msg_id2
fix(appup): update appup file for module emqx_message
2022-02-10 11:12:59 +08:00
Shawn 038136fc83 fix(appup): update appup file for module emqx_message 2022-02-10 11:04:25 +08:00
Shawn 0a2fa7c17c
Merge pull request #6961 from terry-xiaoyu/log_printable_mqtt_msg_id
fix(log): format the message id to hexstring before printing
2022-02-10 10:40:55 +08:00
JimMoen 130b455752
Merge pull request #6960 from JimMoen/update-dashboard
chore(dashboard): update dashboard version
2022-02-10 10:37:40 +08:00
JimMoen 5b71ca6ad5 chore(dashboard): update dashboard version 2022-02-10 10:00:37 +08:00
Shawn 3b5b4b99ed fix(log): format the message id to hexstring before printing 2022-02-10 09:47:33 +08:00
zhanghongtong ec0843633c chore: change step name to match the actual commands 2022-02-10 09:36:16 +08:00
zhanghongtong c316cc464f ci(build_packages): push muilt arch image for aws ecr 2022-02-10 09:34:15 +08:00
Zaiming (Stone) Shi 12fbcc1330 chore: upgrade to ekka 0.8.1.8
print client status before killing due to holding lock for too long
2022-02-09 22:54:57 +01:00
Thales Macedo Garitezi e053700441
style: please elvis checks 2022-02-09 11:02:05 -03:00
Thales Macedo Garitezi 5e223ac64f
chore(appup): update appup files 2022-02-09 09:54:39 -03:00
Thales Macedo Garitezi b968d4c416
fix(ctl): fix formatting when printing messages without arguments (4.3)
Without passing an empty argument list to `emqx_ctl:print`, formatting
instructions like `~n` are being printed literally.

```
Ignore.~nJoin the cluster successfully.~nCluster status: #{running_nodes =>
                      ['emqx@emqx-0.int.thalesmg','emqx@emqx-1.int.thalesmg',
                       'emqx@emqx-2.int.thalesmg','emqx@emqx-3.int.thalesmg',
                       'emqx@emqx-4.int.thalesmg'],
                  stopped_nodes => []}
```
2022-02-09 09:36:27 -03:00
Ilya Averyanov ca5c34ba96
Merge pull request #6932 from savonarola/rebar3-vs-make-4.3
chore(ci): use make apps/emqx_auth_ldap-ct instead of rebar command
2022-02-08 14:38:20 +03:00
Ilya Averyanov 1480efde19 chore(ci): use make apps/emqx_auth_ldap-ct instead of rebar command 2022-02-07 21:55:30 +03:00
Zaiming (Stone) Shi a18f3bc971
Merge pull request #6860 from fernando-almeida/main-v4.3
Updated Helm chart to support new features and updated README
2022-02-07 17:30:36 +01:00
Zaiming (Stone) Shi e613843ce8
Merge pull request #6930 from zhongwencool/ci-pin-pytest
ci(pytest): pin pytest version at 6.2.5.
2022-02-07 17:14:51 +01:00
zhongwencool 51ed6abcd6 ci(pytest): pin pytest version at 6.2.5. 2022-02-07 17:23:13 +08:00
zhongwencool 3036f02963
Merge pull request #6893 from zhongwencool/watemark-limit-check
fix(watermark): hight watermark should greater than low watermark.
2022-01-28 19:06:44 +08:00
zhongwencool 579905b92a fix(watermark): hight watermark should greater than low watermark. 2022-01-28 17:58:11 +08:00
Zaiming (Stone) Shi 570bc5023b
Merge pull request #6879 from zmstone/fix-stop-command-defunct-detection
fix: stop command should detect defunct pid
2022-01-27 08:25:06 +01:00
zhongwencool ef82287634
Merge pull request #6883 from zhongwencool/fix-watermark-4.3
fix(alarm): watermark replace >= =< with > <
2022-01-27 14:32:16 +08:00
zhongwencool e2dec09b0d fix(alarm): watermark replace >= =< with > < 2022-01-27 11:59:48 +08:00
JianBo He 4cdd529b5a
Merge pull request #6866 from HJianBo/remove_connected_at_feild
fix(webhook): remove the connected_at field for client.connect
2022-01-27 10:41:53 +08:00
JianBo He 34c489da40
Merge pull request #6868 from HJianBo/fix-stomp-frame-parser
Fix the sticky tcp stream parsing
2022-01-27 10:40:37 +08:00
Zaiming (Stone) Shi 72c909051b fix: stop command should detect defunct pid 2022-01-26 23:48:31 +01:00
Zaiming (Stone) Shi 61e9fd5f04
Merge pull request #6875 from zmstone/ci-find-upgrade-base-with-script
ci: find relup base version using script scripts/relup-base-vsns.sh
2022-01-26 20:52:09 +01:00
Zaiming (Stone) Shi e5d196569c ci: find relup base version using script scripts/relup-base-vsns.sh 2022-01-26 18:26:43 +01:00
Zaiming (Stone) Shi f65cd003c0
Merge pull request #6872 from zmstone/update-windows-build-instructions
Update windows build instructions
2022-01-26 13:33:32 +01:00
Zaiming (Stone) Shi 99712d3521 ci: debug windows build 2022-01-26 12:08:32 +01:00
Fernando Almeida b91dc1c13d fix(helm-chart): revised software name to match conventioned name
fix(helm-chart): added missing new-line from resource templates
2022-01-26 09:01:25 +00:00
zhongwencool d9e7868d64
Merge pull request #6865 from zhongwencool/sys-mem-alarm
fix(appup): add emqx.erl to appup.src
2022-01-26 16:40:22 +08:00
JianBo He 18ed00e57e test(stomp): add testcase for sticky tcp strem 2022-01-26 15:49:51 +08:00
JianBo He fd88f484d2 fix(stomp): fix the sticky tcp stream parsing 2022-01-26 15:41:14 +08:00
JianBo He 85652aa373 fix(webhook): remove the connected_at field for client.connect 2022-01-26 15:01:36 +08:00
zhongwencool 9d633507f5 fix(appup): add emqx.erl to appup.src 2022-01-26 14:32:00 +08:00
Fernando Almeida 73c452c64d fix(helm-chart): replace envFromSecret with more broad extraEnvFrom
fix(helm-chart): refactored Stateful set for readability.
fix(helm-chart): added missing extra* variables to StatefulSet and README.
fix(helm-chart): added sensible defaults for extra* settings.
2022-01-25 23:43:35 +00:00
Fernando Almeida 86887e8559 fix(helm-chart): fix indentation bug in env configmap 2022-01-25 23:43:35 +00:00
Fernando Almeida 36b5982630 feat(helm-chart): fix value in WSS example 2022-01-25 23:43:35 +00:00
Fernando Almeida 43624d6407 feat(helm-chart): revised emqx env ConfigMap to allow specifying settings also using the namespaced dot notation
feat(helm-chart): updated README to include description of previous change and fix value in WSS example
2022-01-25 23:43:35 +00:00
Fernando Almeida a24e765351 feat(helm-chart): added support for shared ingress annotations
feat(helm-chart): revised README to include image.tag setting
2022-01-25 23:43:35 +00:00
Fernando Almeida 6bb2fa666d feat(helm-chart): added explicit example for enable Websocket SSL. 2022-01-25 23:43:35 +00:00
Fernando Almeida 6a5dc485e2 feat(helm-chart): split configs into multiple files for readability
feat(helm-chart): added conditional volumes in StatefulSet
feat(helm-chart): revised checksum logic to include all config
2022-01-25 23:43:35 +00:00
Fernando Almeida ec902871cf feat(helm-chart): split ingress into separate files for readability
feat(helm-chart): fix ingress to allow custom user path as need (eg. mgmt)
feat(helm-chart): revised README to include missing contents
2022-01-25 23:43:35 +00:00
Zaiming (Stone) Shi 1fe91221ac docs: remove powershell from Windows build doc
Had trouble to make it work
2022-01-25 23:18:13 +01:00
Zaiming (Stone) Shi 268b1ded50
Merge pull request #6857 from zmstone/ci-fix-base-version-match-pattern
ci: fix base version match pattern
2022-01-25 22:26:05 +01:00
Zaiming (Stone) Shi 95f950ae00 ci: fix relup base version match pattern 2022-01-25 19:04:55 +01:00
zhongwencool 27392bcf1e
Merge pull request #6846 from zhongwencool/sys-mem-alarm
fix: sys_mem alarm is not triggered after reboot.
2022-01-25 18:46:45 +08:00
zhongwencool 78f294cda2 fix: sys_mem alarm is not triggered after reboot. 2022-01-25 16:12:17 +08:00
JianBo He 549e36c681
Merge pull request #6842 from JimMoen/update-dashboard
chore(dashboard): update dashboard version
2022-01-24 17:45:17 +08:00
JimMoen 0f1e85a8ad chore(dashboard): update dashboard version 2022-01-24 17:41:42 +08:00
JianBo He 680339ff14
Merge pull request #6840 from zhongwencool/auth-default-user-warnring
fix(auth_mnesia): don't force update default user.
2022-01-24 15:24:13 +08:00
zhongwencool efa3e32ee5 fix(auth_mnesia): don't force update default user. 2022-01-24 13:58:37 +08:00
JianBo He 7c31de7c55
Merge pull request #6839 from JimMoen/chore-mgmt-app-vsn
chore(app_vsn): revert management app.src repetitive increased
2022-01-24 12:08:52 +08:00
JianBo He 0dee156185
Merge pull request #6838 from EMQ-YangM/main-v4.3
fix(emqx_rule_engine_metrics): fix code_change vsn value
2022-01-24 11:39:33 +08:00
JimMoen 287b48d49a chore(app_vsn): revert management app.src repetitive increased 2022-01-24 11:38:25 +08:00
EMQ-YangM 03d240c59e fix(emqx_rule_engine_metrics): fix code_change vsn value 2022-01-24 11:14:31 +08:00
Zaiming (Stone) Shi fcb3ba6cc8
Merge pull request #6828 from JimMoen/fix-typo
ci: fix a typo in fvt_tests
2022-01-21 15:14:51 +01:00
JimMoen cb6f7cb496 ci: fix a typo in fvt_tests 2022-01-21 19:53:49 +08:00
JianBo He b19441df70
Merge pull request #6822 from HJianBo/more-fields-for-webhook
Ensure connected_at field for connect/connack/disconnected event
2022-01-21 16:09:04 +08:00
JianBo He 3b4ddd6f51 chore: bump emqx_modules vsn 2022-01-21 15:05:13 +08:00
JianBo He 8f517cebf7
Merge branch 'main-v4.3' into more-fields-for-webhook 2022-01-21 15:01:38 +08:00
JianBo He c5f9bfc305
Merge pull request #6811 from HJianBo/acl-metrics-fixes
refactor(metrics): more clear for acl metrics
2022-01-21 15:00:56 +08:00
JianBo He 4af01bb601
Merge pull request #6814 from zhongwencool/subscribe-api-meta
fix(api): sub api return meta
2022-01-21 14:57:21 +08:00
JianBo He 09002c4cd2 revert: revert #6797 due to the acl metrics refactor 2022-01-21 14:24:03 +08:00
JianBo He f86c1316e7 chore(auth): bump version & update appup.src 2022-01-21 14:24:03 +08:00
JianBo He f0a3b7754e refactor: remove the acl metrics for all auth plugins 2022-01-21 14:24:03 +08:00
JianBo He 14538e5f6d chore(emqx): update appup.src 2022-01-21 14:24:01 +08:00
JianBo He 77609ebd96 chore: bump vsn and update appup.src 2022-01-21 13:52:07 +08:00
JianBo He ad996afe47 chore: ensure connected_at field for connect/connack/disconnected event 2022-01-21 13:52:05 +08:00
JianBo He d535d44845 revert: revert #6797 due to the acl metrics refactor 2022-01-21 11:32:10 +08:00
JianBo He c56be7dcd7 refactor(metrics): more clear for acl metrics
For clarity in the meaning of metrics, we put `client.acl.allow`,
`client.acl.deny` into emqx_metrics and increased after a acl checking
returned.
2022-01-21 11:21:25 +08:00
zhongwencool 140a1c0276 chore(api): add api_sub http api test 2022-01-21 10:56:41 +08:00
zhongwencool f36791bab9 fix(api): sub api return meta 2022-01-20 18:40:25 +08:00
zhongwencool 964a77510d
Merge pull request #6797 from zhongwencool/internal-acl-metrics
feat(acl): internal acl should support metrics[client.acl.ignore/allow/deny]
2022-01-20 10:36:59 +08:00
Shawn 668aa0ac12
Merge pull request #6800 from terry-xiaoyu/rule_empty_ids
fix(rule): deny POST rules or resources with empty ids
2022-01-19 19:58:54 +08:00
Shawn 2d00373e49 fix(appup): update appup file for emqx_rule_engine_api 2022-01-19 19:51:25 +08:00
zhongwencool 4317845482 fix(test): test case failed by unload 2022-01-19 19:48:07 +08:00
Shawn 70c6ac4e0d fix(rule): deny POST rules or resources with empty ids 2022-01-19 19:22:25 +08:00
zhongwencool 6378cd1f9a chore(version): bump emqx_modules to 4.3.4 2022-01-19 18:05:51 +08:00
zhongwencool e1274e1117 feat(acl): internal acl should support metrics(client.acl.ignore/allow/deny). 2022-01-19 18:00:54 +08:00
William Yang ab7d6def9d
Merge pull request #6782 from qzhuyan/backport/william/ci-macbuild-reduce-build-cache-size-4.3
ci(mac): cache otp install only
2022-01-19 09:01:15 +01:00
zhongwencool 30e07307e9
Merge pull request #6785 from zhongwencool/auth-acl-data-import
fix(auth_mnesia): import auth acls data according to different data format
2022-01-19 11:07:33 +08:00
zhongwencool 506be21aa2 fix(auth_mnesia): bump up emqx_mgmt to 4.3.10 2022-01-19 10:36:12 +08:00
lafirest 0486fb96be
Merge pull request #6778 from lafirest/fix/limiter
feat(emqx_limiter): add support for update overall limiter
2022-01-19 09:45:48 +08:00
zhongwencool 19fc143f41 fix(auth_mnesia): import auth acls data according to different data format 2022-01-19 00:12:30 +08:00
William Yang afa4c7d341 ci(mac): cache otp install only
only cache otp installation instead of the entire kerl dir to save cache spaces
2022-01-18 11:49:53 +01:00
lafirest deada0ea44 chore(appup): update appup file and esockd version 2022-01-18 16:26:01 +08:00
lafirest eb003e3305 feat(emqx_limiter): add support for update overall limiter 2022-01-18 14:06:26 +08:00
zhongwencool 51e62468ed
Merge pull request #6717 from zhongwencool/auth-mnesia-default-import
fix(auth): force update default mqtt_user when password or hash_type changed.
2022-01-14 15:35:10 +08:00
zhongwencool 5481723513 chore(docs): update changes-4.3.md 2022-01-14 14:55:31 +08:00
zhongwencool 4ba43d3aea fix(auth): move log outside of transaction 2022-01-14 11:38:28 +08:00
Shawn cffbe46f0b
Merge pull request #6748 from terry-xiaoyu/fix_restore_action_metrics_in_cluster
fix(rule): restore the metrics for actions in cluster
2022-01-14 11:34:08 +08:00
zhongwencool 729ab6f60d
Merge branch 'main-v4.3' into auth-mnesia-default-import 2022-01-14 11:29:41 +08:00
zhongwencool ab18020eea
Merge pull request #6736 from zhongwencool/support-license-alarm-type
chore(alarm): support license alarm type
2022-01-14 11:19:48 +08:00
zhongwencool 9a17bcfcc9 chore(appup): update eqmx.appup.src 2022-01-14 11:03:27 +08:00
Shawn eec566fe40 fix(rule): restore the metrics for actions in cluster 2022-01-14 10:33:32 +08:00
Shawn 0af912f8a9
Merge pull request #6734 from terry-xiaoyu/hook_delivery_drop
New Hook: delivery drop
2022-01-14 09:39:32 +08:00
zhongwencool e96c9ada52 chore(test): fix typo error 2022-01-14 00:43:27 +08:00
zhongwencool 7c0d70cfde feat(license): license expriy early alarm. 2022-01-14 00:31:56 +08:00
Shawn 4abcab8d52 fix(appup): update appup files for emqx,emqx_sn,rule_engine 2022-01-13 18:37:22 +08:00
Zaiming (Stone) Shi dac0e824c8 build: fix package version regexp match pattern 2022-01-13 18:37:22 +08:00
JianBo He a46ea363f6 chore: rename CHANGES.md to CHANGES-4.3.md 2022-01-13 18:37:22 +08:00
Zaiming (Stone) Shi adbb067a91 ci: skip dialyzer race_condition checks
backported from 5.0
race_condition check is very RAM demanding
2022-01-13 18:37:22 +08:00
zhongwencool c6a571c207 chore(alarm): support license alarm type 2022-01-13 17:41:16 +08:00
Shawn a63799742f fix(channel): update testcases for emqx_channel 2022-01-13 16:10:03 +08:00
Shawn a6408cee4f fix(session): update testcases for emqx_session 2022-01-13 15:28:18 +08:00
zhongwencool 27f5e765b5 fix(export): emqx_auth_mnesia import failed after 4.3.x 2022-01-13 13:53:37 +08:00
Shawn 9f7f5070b2 fix(channel): update the calls to emqx_session APIs 2022-01-13 13:33:27 +08:00
Zaiming (Stone) Shi 720c730baf
Merge pull request #6724 from zmstone/build-fix-version-regexp-pattern
build: fix package version regexp match pattern
2022-01-12 23:23:51 +01:00
Zaiming (Stone) Shi cfc3c076bb build: fix package version regexp match pattern 2022-01-12 21:50:50 +01:00
Zaiming (Stone) Shi 41ed507f63
Merge pull request #6719 from HJianBo/rename-changes.md
chore: rename CHANGES.md to CHANGES-4.3.md
2022-01-12 13:39:14 +01:00
Zaiming (Stone) Shi 5fc3105afc
Merge pull request #6721 from zmstone/ci-skip-dialyzer-race-condition-check
ci: skip dialyzer race_condition checks
2022-01-12 13:38:33 +01:00
Shawn 217acc0154 feat(rule): add new event 'delivery_dropped' 2022-01-12 20:11:08 +08:00
zhongwencool 85d568be60 chore(test): clean up auth_mnesia_SUITE:t_boot config 2022-01-12 19:03:44 +08:00
Zaiming (Stone) Shi d7b0e753da ci: skip dialyzer race_condition checks
backported from 5.0
race_condition check is very RAM demanding
2022-01-12 11:57:02 +01:00
JianBo He 6de114f822 chore: rename CHANGES.md to CHANGES-4.3.md 2022-01-12 18:49:18 +08:00
Shawn 9434c0fa6c feat(hook): new emqx hook 'delivery.dropped' 2022-01-12 18:34:20 +08:00
zhongwencool 88060c0f9b chore(auth): bump emqx_auth_mnesia version:4.3.5 2022-01-12 17:34:32 +08:00
zhongwencool 5521b7fa71 fix(auth): force update default mqtt_user when password or hashtype changed. 2022-01-12 17:26:27 +08:00
Shawn 449854fa11
Merge pull request #6647 from EMQ-YangM/main4.3
feat(rule_metrics): add more metrics to the rule engine
2022-01-12 14:52:46 +08:00
EMQ-YangM da8cd5d103 fix(rule_engine_metrics): fxi string:to_integer pattern match error 2022-01-11 22:09:38 -08:00
EMQ-YangM de58c8e7bc refactor(rule_engine_metrics): refactor code_change 2022-01-11 22:09:38 -08:00
EMQ-YangM 7605fa5e64 fix(rule_engine_metric): remove unused metrics 'overall_metrics' 2022-01-11 22:09:38 -08:00
JianBo He c52db52cf8
Merge pull request #6709 from JimMoen/fix-mgmt-appup
chore(appup): app version updated after last tag
2022-01-12 11:18:20 +08:00
JianBo He ccd645b574
Merge pull request #6695 from HJianBo/fix-stomp-frame-tailed-byte
Fix stomp frame tailed byte
2022-01-12 11:17:00 +08:00
JimMoen 556a81a80e chore(appup): app version updated after last tag 2022-01-12 10:09:51 +08:00
JimMoen 92f1b5b01a
Merge pull request #6699 from JimMoen/fix-sub-info
fix(mgmt): fix subscription info format
2022-01-11 18:26:43 +08:00
JimMoen 47ba72729f chore(appup): update appup.src 2022-01-11 16:23:25 +08:00
JimMoen f2cfde7421 fix(mgmt): fix subscription info format 2022-01-11 15:54:37 +08:00
JianBo He 9efab7d5df chore(stomp): update appup & app.src 2022-01-11 14:49:40 +08:00
JianBo He 9aa178b51d fix(stomp): fix parsing rear frame split byte crash
fix: https://github.com/emqx/emqx/issues/6693
2022-01-11 14:49:20 +08:00
JimMoen 43442577ae
Merge pull request #6494 from JimMoen/fix-os-info
fix(telemetry): use required fields, rolling distro use PRETTY_NAME
2022-01-10 17:32:16 +08:00
JimMoen 2fba756aea chore(telemetry): update appup.src 2022-01-10 17:01:20 +08:00
JimMoen 5c29c20426 fix(telemetry): use required fields, rolling distro use PRETTY_NAME 2022-01-10 17:01:20 +08:00
Shawn 82c6eaa3aa
Merge branch 'main-v4.3' into main4.3 2022-01-10 12:31:12 +08:00
Shawn 2ee683d2f9
Merge pull request #6670 from terry-xiaoyu/restore_action_metrics
fix(rule): restore metrics for actions
2022-01-10 12:24:41 +08:00
EMQ-YangM 3956eaddd7 fix(rule_engine_metrics): add more rulge_engine version to emqx_rule_engine.appup.src 2022-01-09 19:27:49 -08:00
Shawn fbeba39f0d fix(rule): compare to null variables should return false 2022-01-06 20:36:01 +08:00
Shawn b7bcb37eab fix(rule): restore metrics for actions 2022-01-06 20:18:05 +08:00
EMQ-YangM be81c65eda feat(rule_engine_metics): add hot upgrade feat 2022-01-06 00:47:17 -08:00
EMQ-YangM 2074dd63f9 test(rule_engine_metrics): add more test 2022-01-05 21:11:52 -08:00
EMQ-YangM 1211c658fc fix(emqx_rule_engine): change vsn to 4.3.7 2022-01-05 19:18:16 -08:00
EMQ-YangM fae49ad228 fix(rule_engine_metrics): remove more space 2022-01-05 19:03:28 -08:00
EMQ-YangM d7a3ade200 fix(rule_engine_matrics): remove more space 2022-01-05 19:00:59 -08:00
EMQ-YangM 2608798826 fix(rule_engine_metrics): fix RuleID reference 2022-01-05 18:56:34 -08:00
EMQ-YangM c214af2ac0 fix(rule_engine_metics): centralized statistics exception 2022-01-05 18:51:28 -08:00
Zaiming (Stone) Shi c761b1aa3c
Merge pull request #6644 from Rory-Z/ci/do-not-static-check-for-4.3
ci(static checks): do not run static check
2022-01-05 17:25:16 +01:00
JianBo He be12e179f5
Merge pull request #6639 from HJianBo/fix-client-fuzzy-matching
fix(mgmt): fix substring matching alg
2022-01-05 18:14:14 +08:00
EMQ-YangM e5993c9f72 refactor(rule_engine_metrics): remove function 'message()' 2022-01-05 02:08:40 -08:00
EMQ-YangM c2870b3322 test(rule_engint_metrics): add test for 'FOREACH' 2022-01-05 01:57:18 -08:00
EMQ-YangM 88913a9144 test(rule_engine_metrics): add test 't_metrics' 2022-01-05 01:20:53 -08:00
JianBo He d6f56cbcbe fix(mgmt): convert timestamp to milliseconds 2022-01-05 16:38:27 +08:00
JianBo He 9cf03bb18a fix(mgmt): fix substring matching alg 2022-01-05 16:38:22 +08:00
EMQ-YangM a5a8aa3b6d feat(rule_metrics): add more metrics to the rule engine 2022-01-05 00:20:06 -08:00
Rory Z a9f37f139d
Merge pull request #6638 from Rory-Z/ci/fix-push-error
ci(build_packages): only push emqx broker to aws ecr
2022-01-05 15:47:46 +08:00
zhanghongtong ced2a4a117 ci(static checks): do not run static check 2022-01-05 11:13:26 +08:00
zhanghongtong 0b12a7e3a2 ci(build_packages): only push emqx broker to aws ecr 2022-01-05 10:12:27 +08:00
Rory Z 6b02d93b73
Merge pull request #6630 from emqx/ci/fix-its-error
ci(its): fix error
2022-01-04 22:04:34 +08:00
zhanghongtong 6a5c37dab7 ci(its): fix error 2022-01-04 21:03:46 +08:00
Rory Z afc0fcd0b6
Merge pull request #6628 from Rory-Z/chore/ignore-ldap-error
chore(cts): ignore ldap error
2022-01-04 18:21:56 +08:00
Rory Z ba7b93083e
Merge pull request #6614 from Rory-Z/chore/fix-spelling-errors
chore(helm): fix spell errors
2022-01-04 17:59:04 +08:00
zhanghongtong 387af5295c chore(cts): ignore ldap error 2022-01-04 17:56:58 +08:00
Rory Z 7cd80c25fa
Merge pull request #6620 from Rory-Z/chore/fix-docker-build-error
Chore/fix docker build error
2022-01-04 17:50:44 +08:00
zhanghongtong 514634e541 ci(build_packages): if it's enterprise, use Dockerfile.enterprise 2022-01-04 16:32:32 +08:00
zhanghongtong 6d0b6d2896 chore: delete needless docker.mk 2022-01-04 15:00:15 +08:00
zhanghongtong 1627ef78e7 ci(build_packages): update docker build
Signed-off-by: zhanghongtong <rory-z@outlook.com>
2022-01-04 14:27:39 +08:00
zhanghongtong 90a2ebfb02 build(docker): update docker build 2022-01-04 11:16:35 +08:00
tigercl 38a46e1af3
Merge pull request #6519 from Rory-Z/ci/update-cts-4.3
ci(cts): use makefile target instead of the rebar command
2022-01-04 10:40:34 +08:00
zhanghongtong 9662eebae8 chore(helm): fix spell errors 2022-01-04 10:08:02 +08:00
JimMoen bec742b1be
Merge pull request #6505 from JimMoen/v4.x-fix-node-info-format
fix(mgmt): fix node info format for specific node
2021-12-31 13:39:43 +08:00
k32 2240c3e790
Merge pull request #6573 from k32/fix-retainer-topic-printing
fix(retainer): Fix topic printing
2021-12-29 19:22:20 +01:00
k32 5addf91873 fix(retainer): Fix topic printing
Fixes: #6559
2021-12-29 18:27:47 +01:00
Thales Macedo Garitezi 5a6225d397
Merge pull request #6480 from emqx/improve-update-appup-43
chore(update_appup): Improve `update_appup.escript`
2021-12-28 09:54:52 -03:00
Zaiming (Stone) Shi 4a7b1bb7d8
Merge pull request #6551 from zmstone/fix-portable-shebang
fix: portable shebang
2021-12-28 11:04:22 +01:00
Zaiming (Stone) Shi 967dc7d55e fix: portable shebang 2021-12-27 15:40:25 +01:00
JianBo He 98b9eb9fe1
Merge pull request #6489 from HJianBo/fix-receive-maximum
fix: disconnect the client due to exceed receive-maximum packets
2021-12-23 14:02:59 +08:00
JianBo He 02dc216173 chore: update appup.src 2021-12-23 08:48:24 +08:00
JianBo He cb8a3725b4 fix: disconnect the client due to exceed receive-maximum packets
As described in the 5.0 specification, we should disconnect clients that
exceed the receive-maximum limit.

> If it receives more than Receive Maximum QoS 1 and QoS 2 PUBLISH packets
where it has not sent a PUBACK or PUBCOMP in response, **the Server uses a
DISCONNECT packet with Reason Code 0x9**

fix: #6447
2021-12-23 08:48:24 +08:00
zhanghongtong 5fbd999ef8 ci(cts): fix env error 2021-12-22 16:48:42 +08:00
zhanghongtong a560174ad9 ci(cts): use makefile target instead of the rebar command 2021-12-22 16:46:58 +08:00
JimMoen 7e9870cc3f chore(mgmt): update appup.src 2021-12-21 01:12:17 -05:00
JimMoen 0ee589ca61 fix(mgmt): fix node info format for specific node 2021-12-21 01:07:01 -05:00
Thales Macedo Garitezi 62ff6a8b30
chore(update_appup): rm unused value 2021-12-20 13:41:14 -03:00
Thales Macedo Garitezi b2396438a0
chore(update_appup): add expected versions check
For apps inside emqx umbrella, we try to bump only the patch part of
their version numbers, and use only 3-part version
numbers (`Major.Minor.Patch`).  With those assumptions, we may infer
all versions that need to be covered in a given upgrade, and check if
those are covered in regexes.
2021-12-20 13:38:08 -03:00
Thales Macedo Garitezi ce4a193cbb
chore(update_appup): rm unused fn 2021-12-20 13:21:01 -03:00
Thales Macedo Garitezi af3a1326d1
chore(update_appup): bugfix: variable not pinned in lambda 2021-12-20 13:21:01 -03:00
JianBo He b972c2aec1
Merge pull request #6490 from terry-xiaoyu/update_vsn 2021-12-20 22:10:02 +08:00
Shawn 23e4e101a4 chore(dashboard): bump lib-ce/emqx_dashboard to 4.3.8 2021-12-20 15:42:16 +08:00
Shawn 22814dc161 chore(coap): update gen_coap to v0.4.2 2021-12-20 15:07:29 +08:00
tigercl 2966f4a09b
Merge pull request #6487 from Rory-Z/ci/fix-update-error
ci(release): only push emqx broker image to aws ecr
2021-12-20 10:58:10 +08:00
zhanghongtong f78be5a4be ci(release): only push emqx broker image to aws ecr 2021-12-20 10:25:23 +08:00
Thales Macedo Garitezi fef8a18bfb
chore(update_appup): insert `load_module`s after `application:stop`
If there is already any `application:stop(Application)` call in the
appup instructions, we prefer to add `load_module` instructions after
it, so we can be sure that the load is replaced safely.
2021-12-17 16:53:56 -03:00
Thales Macedo Garitezi 42ca5ab5a9
chore(update_appup): do not force appup render if contents are the same
To avoid losing comments and/or manual indentation in appup files that
are already up to date, we now check whether the contents have the
exact same terms as those we are about to write to an existint .appup
file.
2021-12-17 16:53:56 -03:00
Thales Macedo Garitezi e1e72c144a
chore(update_appup): do not use load_module if restart_application
Since the appup instruction `restart_application` already loads all
modules of a given application, there is no need to introduce those
instructions if a restart is already present.
2021-12-17 16:53:56 -03:00
Thales Macedo Garitezi 3ff6661a58
chore(update_appup): take regexes into account when comparing vsns
This change makes the `update_appup.escript` check whether the new
version of an application (the _current_ one) is already contained in
entries in the _new_ .appup file for that application if such .appup
file contains regexes.

NOTE: this does not cover the case in which we calculate the
difference between _old_ and _new_ appup entries, and those consist of
regexes.  In such case, we would need to check if one regex is
"contained" in the other, which is not currently supported by this
patch.
2021-12-17 16:53:55 -03:00
Zaiming (Stone) Shi ccca1f53fa chore: add details about ekka fix 2021-12-17 19:51:09 +01:00
Zaiming (Stone) Shi 5066be2385
Merge pull request #6477 from zmstone/fix-changes.md-typos
chore: fix CHANGES.md typos
2021-12-17 16:43:00 +01:00
Zaiming (Stone) Shi caa6134e3b chore: fix CHANGES.md typos 2021-12-17 16:42:37 +01:00
tigercl fcca7f84f3
Merge pull request #6476 from zmstone/chore-introduce-CHANGE.md
chore: add CHANGE.md
2021-12-17 23:34:46 +08:00
Zaiming (Stone) Shi 83734612a2 chore: add CHANGE.md 2021-12-17 16:18:23 +01:00
tigercl e443225af6
Merge pull request #6475 from zmstone/fix-emqx-appup
fix(appup): add missing beams to emqx.appup.src
2021-12-17 21:03:46 +08:00
tigercl e756eb99fb
Merge pull request #6474 from tigercl/chore/vsns
chore(vsn): bump ehttpc and ekka version
2021-12-17 20:49:18 +08:00
Zaiming (Stone) Shi c1cbf39552 fix(appup): add missing beams to emqx.appup.src
also re-formated emqx_sn.appup.src
2021-12-17 13:41:25 +01:00
zhouzb dc9631514d chore: ensure version bump for dashboard app 2021-12-17 20:28:54 +08:00
zhouzb 49bfabc4dc chore(vsn): bump ehttpc and ekka version 2021-12-17 19:41:41 +08:00
tigercl 865d999e39
Merge pull request #6466 from emqx/improve_pgsql
chore(autotest): Improve pgsql script and change file path in emqx-fvt warehouse
2021-12-17 11:24:18 +08:00
xiangfangyang-tech 2da7f91c42 chore(autotest): improve jmeter installation mode 2021-12-17 10:50:58 +08:00
xiangfangyang-tech 0e9b608737 chore(autotest): improve pgsql script and change file path in emqx-fvt warehouse 2021-12-17 10:33:33 +08:00
JimMoen 812d123453
Merge pull request #6416 from JimMoen/log-for-proxy-protocol
feat(frame): better log for proxy_protocol config disabled
2021-12-10 18:37:49 +08:00
JimMoen 24060285c5 chore(appup): update appup.src 2021-12-10 18:08:47 +08:00
JimMoen bad314ae08 chore(gitignore): update gitignore 2021-12-10 18:08:47 +08:00
JimMoen 3ecc79e1bc test(frame): test packet proxy_protocol config disabled 2021-12-10 18:08:47 +08:00
JimMoen b9acf94fd7 feat(frame): better log for proxy_protocol config disabled 2021-12-10 18:08:47 +08:00
tigercl f1c707e4de
Merge pull request #6368 from Spycsh/main-v4.3
chore: fix main-v4.3 support for networking.k8s.io/v1
2021-12-10 18:07:11 +08:00
JimMoen 9a43125c9b
Merge pull request #6420 from JimMoen/revert-topic-level-default-conf
revert(emqx_conf): zone.external.max_topic_levels
2021-12-10 09:43:14 +08:00
Spycsh 5c497975a6 chore: fix main-v4.3 support for networking.k8s.io/v1 2021-12-09 21:41:55 +01:00
tigercl 832700b0ff
Merge pull request #6418 from tigercl/chore/webhook-appup
chore(webhook): update appup
2021-12-09 20:27:01 +08:00
JimMoen db8131d2a5 revert(emqx_conf): zone.external.max_topic_levels
revert part of changes in 289415b5aa
2021-12-09 20:13:40 +08:00
zhongwencool f3fffb6156
Merge pull request #6417 from zhongwencool/fix-sn-appup-file
fix(emqx_sn): appup.src miss 4.3.2
2021-12-09 18:54:33 +08:00
zhouzb b6ffacc062 chore(appup): fix appup for webhook 2021-12-09 18:46:13 +08:00
zhouzb aa04df4d1b chore(webhook): update appup 2021-12-09 18:40:45 +08:00
zhongwencool 7477615324 fix(emqx_sn): appup.src miss 4.3.2 2021-12-09 17:26:57 +08:00
Zaiming (Stone) Shi a81f2ce315
Merge pull request #6414 from tigercl/chore/ehttpc-vsn
perf(http): bump ehttpc version
2021-12-09 09:38:30 +01:00
zhouzb 63a6ac2f5f perf(http): bump ehttpc version 2021-12-09 15:26:41 +08:00
Tobias Lindahl 756a256137
Merge pull request #6396 from emqx/fix-takeover-race-on-enqueued-messages-v4.3 2021-12-08 11:01:25 +01:00
Rory Z cdc70d8ccc
Merge pull request #6271 from Rory-Z/ci/add-push-ecr-for-4.3
ci: add new steps for push ecr image when release
2021-12-08 17:30:44 +08:00
tigercl a92712e429
Merge pull request #6399 from tigercl/fix/webhook-path
fix(webhook): fix the issue that the path field does not support rule engine variables
2021-12-08 14:22:51 +08:00
zhouzb 83981e7c87 fix(webhook): fix the issue that the path field does not support rule engine variables 2021-12-08 11:27:58 +08:00
William Yang ac5307a3a5
Merge pull request #6389 from qzhuyan/backport/william/4.3/systemd-restart-on-failure
Backport/william/4.3/systemd restart on failure
2021-12-07 19:54:43 +01:00
Tobias Lindahl 2348e612fa fix(emqx_channel): fix race condition in session takeover
Sessions must not enqueue messages when another process is taking over
the client id, since it already passed on the message queue in the
session state.

Without this fix, messages arriving after `{takeover, 'begin'} to a
channel with no connection (i.e., a persistent session) would be lost.
2021-12-07 16:05:49 +01:00
William Yang bcbb0822cf build(deb): fix postrm for checking systemd 2021-12-07 13:30:08 +01:00
William Yang 55893dbf5c ci(deb): remove systemV test 2021-12-07 12:49:40 +01:00
William Yang 517aa39542 build(deb): deb pkg enable/disable emqx system 2021-12-07 12:48:51 +01:00
William Yang be8284666a build(deb): remove System V init 2021-12-07 12:43:07 +01:00
William Yang 16e39ffee7 build: rpm and deb use the same systemd service file 2021-12-07 12:42:59 +01:00
William Yang 79f1b8651a build(deb): drop systemV init 2021-12-07 12:42:49 +01:00
William Yang 51f1a48983 fix(systemd-start): /usr/bin/emqx is bash not sh 2021-12-07 12:42:44 +01:00
William Yang eba8c08853 fix(systemd): add restart on failure 2021-12-07 12:42:32 +01:00
JimMoen 72a7f353c6
Merge pull request #6379 from JimMoen/v4.3/fix-vm-mem-info
fix(vm): memory info calc and display
2021-12-07 17:54:39 +08:00
JimMoen dc2c17826e chore(appup): update appup.src 2021-12-07 14:23:40 +08:00
JimMoen 14aa408b5e style: make elvis happy 2021-12-07 14:17:33 +08:00
JimMoen c5e28bd32b fix(vm): add literal_alloc memory calculation 2021-12-07 14:17:33 +08:00
JimMoen ceed9678e3 fix(mgmt): node memory usage info 2021-12-07 14:17:33 +08:00
Thales Macedo Garitezi 462955e6bc
Merge pull request #6381 from emqx/bump-ekka-0-8-1-6-v43
chore(ekka): bump ekka to 0.8.1.6

We're doing this to remove some missing change warnings when updating
emqx v4.3.10.  Ekka's appup was updated in emqx/ekka#140 .

<details>
<summary> `update_appup.escript` output after update (running against 4.3.10) </summary>

```
Found the previous appup file: _build/emqx/rel/emqx/lib/ekka-0.8.1.6/ebin/ekka.appup
INFO: Application 'ekka' has been updated: "0.8.1.4" -> "0.8.1.6"
... elided ...
ERROR: Appup file for the external dependency 'ehttpc' is not complete.
       Missing changes: #{down =>
                              [{"0.1.10",
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]},
                               {<<"0\\.1\\.0">>,
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]},
                               {<<"0\\.1\\.[1-7]">>,
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]}],
                          up =>
                              [{"0.1.10",
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]},
                               {<<"0\\.1\\.[0-7]">>,
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]}]}
NOTE: Some changes above might be already covered by regexes.

ERROR: Incomplete appups found. Please inspect the output for more details.
```

</details>
2021-12-06 13:18:03 -03:00
Thales Macedo Garitezi 3d308cf5a2
chore(ekka): bump ekka to 0.8.1.6
We're doing this to remove some missing change warnings when updating
emqx v4.3.10.  Ekka's appup was updated in emqx/ekka#140 .
2021-12-06 09:21:13 -03:00
zhongwencool 9f7db2eacb
Merge pull request #6357 from zhongwencool/4.3-sn-registry
fix: e4.4.0 failed to join e4.3.0 cluster
2021-12-03 09:32:46 +08:00
Zaiming (Stone) Shi f7d6cc12ce
Merge pull request #6358 from HJianBo/change_terminate_log_level_to_debug
chore(conn): change terminated print to debug level
2021-12-02 13:10:58 +01:00
JianBo He ef6f867304 chore(conn): change terminated print to debug level 2021-12-02 18:01:36 +08:00
zhongwencool f14a9d7da6 chore: bump emqx_sn to 4.3.4 2021-12-02 16:46:57 +08:00
zhongwencool 41a547d36d fix: e4.4.0 failed to join e4.3.0 cluster 2021-12-02 16:19:36 +08:00
JianBo He fdacb9040d
Merge pull request #6343 from HJianBo/drop-empty-retain-msg
[4.3][Retainer] Allow to stop publish clear message
2021-12-02 11:16:30 +08:00
Shawn 0cec0cff95
Merge pull request #6323 from terry-xiaoyu/stop_ecpool_failed_v4.3
chore(appup): bump ecpool to 0.5.2
2021-12-01 18:37:21 +08:00
Shawn 0d1b194906
Merge pull request #6286 from terry-xiaoyu/mqtt_bridge_hangs
MQTT bridge hangs with an unreachable IP
2021-12-01 18:33:42 +08:00
JianBo He 10ffe11ba0 chore(retainer): update appup.src 2021-12-01 17:11:40 +08:00
JianBo He e323b66285 test(retainer): testcase for stop_publish_clear_msg 2021-12-01 17:11:40 +08:00
JianBo He 8aaa2e8333 feat(retainer): add option to stop publish clear message 2021-12-01 17:11:38 +08:00
Thales Macedo Garitezi c16d5e4bb5
Merge pull request #6307 from emqx/update-appup-ext-deps-diff
chore(appup): make update_appup.escript output only differences for external dependencies

Currently, the update_appup.escript outputs as an error the full appup
file for external dependencies, even if all the changes are already
contained in the depency.  Here, we make it only output the missing
actions to be inserted, to aid in seeing what are the differences.

<details>
<summary> Output before: </summary>

```
ERROR: Appup file for the external dependency 'ekka' is not complete.
       Missing changes: [{"0.8.1.4",
                          [{load_module,ekka_cluster_dns,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_node_monitor,brutal_purge,
                               soft_purge,[]}]},
                         {"0.8.1.3",
                          [{load_module,ekka_node_monitor,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_autocluster,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_autoheal,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_locker,brutal_purge,soft_purge,
                               []},
                           {load_module,ekka_cluster_dns,brutal_purge,
                               soft_purge,[]}]},
                         {"0.8.1.2",
                          [{load_module,ekka_ring,brutal_purge,soft_purge,[]},
                           {load_module,ekka_cluster_dns,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_node_monitor,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_autocluster,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_autoheal,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_locker,brutal_purge,soft_purge,
                               []},
                           {load_module,ekka_httpc,brutal_purge,soft_purge,
                               []}]},
                         {"0.8.1.1",
                          [{load_module,ekka_cluster_dns,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_ring,brutal_purge,soft_purge,[]},
                           {load_module,ekka_node_monitor,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_httpc,brutal_purge,soft_purge,[]},
                           {load_module,ekka_autocluster,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_autoheal,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_locker,brutal_purge,soft_purge,
                               []}]},
                         {"0.8.1",
                          [{load_module,ekka_cluster_dns,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_ring,brutal_purge,soft_purge,[]},
                           {load_module,ekka_node_monitor,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_autocluster,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_autoheal,brutal_purge,
                               soft_purge,[]},
                           {load_module,ekka_locker,brutal_purge,soft_purge,
                               []},
                           {load_module,ekka_httpc,brutal_purge,soft_purge,[]},
                           {load_module,ekka_mnesia,brutal_purge,soft_purge,
                               []}]}]
ERROR: Appup file for the external dependency 'ehttpc' is not complete.
       Missing changes: [{"0.1.10",
                          [{load_module,ehttpc_pool,brutal_purge,soft_purge,
                               []},
                           {load_module,ehttpc,brutal_purge,soft_purge,[]}]},
                         {<<"0\\.1\\.[0-7]">>,
                          [{load_module,ehttpc_pool,brutal_purge,soft_purge,
                               []},
                           {load_module,ehttpc,brutal_purge,soft_purge,[]},
                           {update,ehttpc,{advanced,[]}}]},
                         {<<"0\\.1\\.([8-9]|(1[0-1]))">>,
                          [{load_module,ehttpc,brutal_purge,soft_purge,[]},
                           {load_module,ehttpc_pool,brutal_purge,soft_purge,
                               []}]},
                         {<<".*">>,[]}]
```

</details>


<details>
<summary> Output after: </summary>

```
ERROR: Appup file for the external dependency 'ekka' is not complete.
       Missing changes: #{down =>
                              [{"0.8.1.4",
                                [{load_module,ekka_cluster_dns,brutal_purge,soft_purge,[]}]}],
                          up => []}
NOTE: Some changes above might be already covered by regexes.ERROR: Appup file for the external dependency 'ehttpc' is not complete.
       Missing changes: #{down =>
                              [{"0.1.10",
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]},
                               {<<"0\\.1\\.0">>,
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]},
                               {<<"0\\.1\\.[1-7]">>,
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]}],
                          up =>
                              [{"0.1.10",
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]},
                               {<<"0\\.1\\.[0-7]">>,
                                [{load_module,ehttpc_pool,brutal_purge,soft_purge,[]},
                                 {load_module,ehttpc,brutal_purge,soft_purge,[]}]}]}
NOTE: Some changes above might be already covered by regexes.
ERROR: Incomplete appups found. Please inspect the output for more details.
```

</details>
2021-11-29 16:38:53 -03:00
Thales Macedo Garitezi 93caddd448
refactor(review): factor out common functionality 2021-11-29 10:23:54 -03:00
Shawn 6eb919ea66 chore(appup): bump ecpool to 0.5.2 2021-11-29 14:20:57 +08:00
Thales Macedo Garitezi 2e93ec0f3d
Merge pull request #6290 from emqx/sys-mon-more-info-43
feat(sys_mon): Add proc_lib:initial_call/1 and current_stacktrace (4.3)

(Same as #6289 )

This adds the information from `proc_lib:initial_call/1` and the
current stacktrace from the process info to `emqx_sys_mon:procinfo/1`
to aid in debugging some warnings with no context such as the
following:

```
2021-11-23T12:33:59.387818+00:00 [warning] info: [{old_heap_block_size,45988046},{heap_block_size,22177879},{mbuf_size,0},{stack_size,40},{old_heap_size,22354134},{heap_size,7106339}], line: 130, mfa: emqx_sys_mon:handle_info/2, msg: large_heap, procinfo: [{pid,<0.2667.0>},{memory,579763664},{total_heap_size,68510672},{heap_size,22177879},{stack_size,40},{min_heap_size,233},{initial_call,{proc_lib,init_p,5}},{current_function,{gen,do_call,4}},{registered_name,[]},{status,running},{message_queue_len,360945},{group_leader,<0.1660.0>},{priority,normal},{trap_exit,false},{reductions,16493271},{last_calls,false},{catchlevel,4},{trace,0},{suspending,[]},{sequential_trace_token,[]},{error_handler,error_handler}]
```
2021-11-25 17:06:16 -03:00
Thales Macedo Garitezi 0932920d36
chore(appup): make update_appup.escript output only differences for
external dependencies

Currently, the update_appup.escript outputs as an error the full appup
file for external dependencies, even if all the changes are already
contained in the depency.  Here, we make it only output the missing
actions to be inserted, to aid in seeing what are the differences.
2021-11-25 15:21:25 -03:00
Thales Macedo Garitezi 5c693beadd
chore(appup): remove `load_module` instructions if `restart_application`
> the restart_application instruction will be translated into module
load instructions by otp release handler.
2021-11-25 12:08:02 -03:00
Thales Macedo Garitezi 64ce2eea1c
chore(appup): run ./scripts/update_appup.escript to bump vsns 2021-11-25 12:08:02 -03:00
Thales Macedo Garitezi 0260db6640
feat(sys_mon): Add proc_lib:initial_call/1 and current_stacktrace (4.3)
(Same as #6289 )

This adds the information from `proc_lib:initial_call/1` and the
current stacktrace from the process info to `emqx_sys_mon:procinfo/1`
to aid in debugging some warnings with no context such as the
following:

```
2021-11-23T12:33:59.387818+00:00 [warning] info: [{old_heap_block_size,45988046},{heap_block_size,22177879},{mbuf_size,0},{stack_size,40},{old_heap_size,22354134},{heap_size,7106339}], line: 130, mfa: emqx_sys_mon:handle_info/2, msg: large_heap, procinfo: [{pid,<0.2667.0>},{memory,579763664},{total_heap_size,68510672},{heap_size,22177879},{stack_size,40},{min_heap_size,233},{initial_call,{proc_lib,init_p,5}},{current_function,{gen,do_call,4}},{registered_name,[]},{status,running},{message_queue_len,360945},{group_leader,<0.1660.0>},{priority,normal},{trap_exit,false},{reductions,16493271},{last_calls,false},{catchlevel,4},{trace,0},{suspending,[]},{sequential_trace_token,[]},{error_handler,error_handler}]
```
2021-11-25 12:08:02 -03:00
JimMoen 18a9c0e177
fix:change default configuration of `max_topic_levels` #6294 2021-11-25 16:16:54 +08:00
JimMoen 289415b5aa fix(conf): change `max_topic_levels` default configuration 2021-11-25 09:52:12 +08:00
Shawn f5ac6fb714 chore(appup): bump emqx_bridge_mqtt to 4.3.3 2021-11-25 09:46:06 +08:00
Thales Macedo Garitezi 15b71c118b
Merge pull request #6291 from emqx/fix-update-appup-script
chore(appup): minor fixes to update_appup.escript

- Fixes clause error on `create_stub/1`.
- Small optimization: do not download the same file multiple times
  with `wget`.
- Fix: remove old file extension (`.app.src`) and preserve dirname 
  when creating stubs for apps.
2021-11-24 17:10:00 -03:00
Thales Macedo Garitezi 29f982385d
chore(appup): remove old file extension and preserve dirname for apps 2021-11-24 15:09:25 -03:00
Thales Macedo Garitezi c950566294
chore(appup): minor fixes to update_appup.escript
- Fixes clause error on `create_stub/1`.
- Small optimization: do not download the same file multiple times
  with `wget`.
2021-11-24 14:22:51 -03:00
Shawn 3b9bb1d66c fix(ecpool): update ecpool to 0.5.2 2021-11-24 18:57:23 +08:00
Shawn a54668e83b fix(mqtt_bridge): the mqtt bridge hangs with an unreachable IP 2021-11-24 17:11:04 +08:00
Zaiming (Stone) Shi 2e26b8dfed
Merge pull request #6246 from zmstone/upgrade-otp-to-23.2.7.2-emqx-3
build: upgrade to otp sed 23.2.7.2-emqx-3
2021-11-23 21:38:19 +01:00
Zaiming Shi c4b0008ebd build: delete arch suffix from alpine build-env image tag 2021-11-23 17:06:46 +01:00
zhanghongtong 5a3169b83a ci: add new steps for push ecr image when release 2021-11-23 17:36:27 +08:00
Zaiming (Stone) Shi b6064ce2c0
Merge pull request #6259 from zmstone/build-do-not-pack-glibc
build: copy only libcrypto and libtinfo
2021-11-22 17:20:20 +01:00
Zaiming Shi 122842a656 build: copy only libcrypto and libtinfo 2021-11-22 15:46:19 +01:00
Zaiming Shi 1cb6cdbd76 build: upgrade to otp sed 23.2.7.2-emqx-3
There was a typo fix in ssl app for ecdsa_secp512r1_sha512
to ecdsa_secp521r1_sha512.

Hot-beam upgrade is supported when upgrading from OTP 23.2.7.2-emqx-2
just a 'ssl_cipher' module reload.
2021-11-20 23:28:12 +01:00
Zaiming (Stone) Shi efcdcc555f
Merge pull request #6239 from zmstone/build-ensure-openssl11
build: ensure openssl11
2021-11-20 17:12:07 +01:00
Zaiming (Stone) Shi ef41361753
Merge pull request #6233 from zmstone/ci-do-not-sync-master-branch
ci: do not sync master branch
2021-11-19 13:46:11 +01:00
Zaiming Shi 0b3037a571 build: ensure openssl11 2021-11-19 12:39:59 +01:00
Zaiming Shi f1aaed9276 ci: do not sync master branch 2021-11-19 08:46:53 +01:00
tigercl 35e32acf4a
Merge pull request #6195 from tigercl/fix/multi-http-headers
fix(http): fix duplicate http headers
2021-11-19 11:32:43 +08:00
Zaiming (Stone) Shi 747c609ec8
Merge pull request #6214 from zmstone/build-delete-potentially-broken-symlinks
build: ensure symlinks in _build dir are deleted after fetching deps
2021-11-18 13:35:00 +01:00
k32 df8fe88ac8
Merge pull request #6225 from k32/update-appup-ekka
fix(update_appup): Fix warnings, add support for external repos
2021-11-18 13:32:25 +01:00
Zaiming Shi ef36774189 build: use find command's -delete option 2021-11-18 13:20:53 +01:00
k32 113cfa6422 fix(update_appup): Fix warnings, add support for external repos 2021-11-18 12:31:02 +01:00
k32 b45296680d
Merge pull request #6221 from k32/ekka
chore(ekka): Bump version to 0.8.1.5
2021-11-18 12:28:31 +01:00
k32 5dc2e04e55 chore(ekka): Bump version to 0.8.1.5 2021-11-18 10:24:03 +01:00
zhouzb b460172649 chore(appup): fix wrong version 2021-11-18 14:39:46 +08:00
Zaiming Shi 5db4607815 build: ensure symlinks in _build dir are deleted after fetching deps
In CI, the source code is downloaded with make deps-all
zipped and uploaded as an GitHub action artifact to be
downloaded in later steps to build packages

The symlinks are abs paths, meaning it might be broken
when unziped (inside docker containers)

This fix adds a `make clean` step after the deps-all target
and the `clean` target also removes rebar.lock and symlinks
2021-11-17 23:27:10 +01:00
William Yang a0fb78a38d
Merge pull request #6209 from qzhuyan/backport/william/4.3/node_dump-log-dir 2021-11-17 21:36:11 +01:00
William Yang 59656b3c3a fix: source emqx_vars in node_dump tool 2021-11-17 13:19:05 +01:00
William Yang 4f0d86dd57 fix(node_dump): locate log dir for package installation 2021-11-17 13:18:59 +01:00
zhouzb 3b25df9b47 fix(appup): fix multiply defined module in appup 2021-11-17 15:18:16 +08:00
zhouzb f948eb927d chore(appup): add appup.src 2021-11-17 14:31:37 +08:00
zhouzb 5e3fe6714e fix(http): fix duplicate http headers 2021-11-17 14:14:12 +08:00
Zaiming Shi e34055b6ef chore: pin OTP-23.2.7.2-emqx-3 2021-11-16 06:21:12 +01:00
Zaiming (Stone) Shi 7dc944a154
Merge pull request #6160 from zmstone/chore-check-version-before-build
build: ensure git tag matches release version
2021-11-15 09:07:37 +01:00
Zaiming Shi 0971567cff build: ensure git tag matches release version 2021-11-14 18:23:30 +01:00
Zaiming (Stone) Shi 5f8d9db64b
Merge pull request #6142 from HJianBo/put-message-headers
Fill the message headers
2021-11-12 12:51:48 +01:00
JianBo He 54bb3ddaf2
Merge branch 'main-v4.3' into put-message-headers 2021-11-12 19:25:39 +08:00
Zaiming Shi d512c474be Merge tag 'v4.3.10' into main-v4.3 2021-11-12 11:52:54 +01:00
JianBo He d8f37be210 chore(lwm2m): fix bad appup.src 2021-11-12 15:38:49 +08:00
tigercl 0003b05247
Merge pull request #6138 from emqx/chore/release
chore(release): update version to 4.3.10
2021-11-12 11:34:45 +08:00
JianBo He 8e4c2c88c3 chore: use PROTO_VER marco 2021-11-12 10:45:26 +08:00
JianBo He 439fb3a403 chore: fix elvis warnings 2021-11-12 10:43:21 +08:00
JianBo He 0c5cb1b9ac chore: update appup.src 2021-11-12 10:43:21 +08:00
JianBo He 4c29c3a5e5 chore: fill message headers 2021-11-12 10:43:21 +08:00
zhouzb 04a4462f1e chore(release): update version to 4.3.10 2021-11-12 10:36:27 +08:00
JianBo He edb2793180
Merge pull request #6126 from zmstone/test-fix-flaky-emqx-cm-test
Test fix flaky emqx cm test
2021-11-11 18:20:48 +08:00
Zaiming (Stone) Shi 1d20a8b720
Merge pull request #6116 from zmstone/4.3-chore-ehttpc-pin-0.1.12
chore(ehttpc): pin 0.1.12
2021-11-11 10:47:01 +01:00
Zaiming Shi 21898e1daf chore(emqx_dashboard): bump version after v4.3.10 release 2021-11-11 10:34:29 +01:00
Zaiming Shi 74b6b5214a test(emqx_cm_SUITE): add a gen_server call sync 2021-11-11 10:33:31 +01:00
JianBo He cc7b1aa93e
Merge pull request #6121 from HJianBo/ensure-start-listeners-before-plugin
Ensure starting listeners before plugins loading
2021-11-11 14:52:15 +08:00
JianBo He 86b8d88165 chore(emqx): update appup.src 2021-11-11 11:55:57 +08:00
JianBo He 8f07f26744 fix: ensure starting listeners before plugins 2021-11-11 11:37:54 +08:00
Zaiming Shi 98136ff119 chore(ehttpc): pin 0.1.12 2021-11-10 14:41:37 +01:00
zhongwencool fa34d8353e
fix(test): flaky mqtt expiry test case. (#6112) 2021-11-10 15:40:46 +08:00
JianBo He a81140fd00
Merge pull request #6110 from HJianBo/force-clear-stomp-listener
fix(emqx_stomp): fix hot-upgrade stopping listener failed
2021-11-10 11:43:51 +08:00
Shawn 133609a040 fix(relup): configs for plugins are missing after relup 2021-11-10 11:10:23 +08:00
JianBo He fefadbcd17 fix(emqx_stomp): fix hot-upgrade stopping listener failed
When the upgrade is executed, all envs of plugins are cleared,
which causes the listener of stomp to stop failing.

This is only a temporary modification to ensure that the upgrade
can be executed successfully.

following fixes: https://github.com/emqx/emqx/pull/6105
2021-11-10 10:02:37 +08:00
Zaiming (Stone) Shi 6b06142562
Merge pull request #6077 from zmstone/sync-exproto-code
Sync exproto code from ee to ce
2021-11-08 16:43:01 +01:00
Zaiming Shi 83ecdb242f fix(appup): delete module load from app restart instruction group 2021-11-08 16:17:54 +01:00
Zaiming Shi ed171b8e60 chore: ensure version bump for dashboard app 2021-11-08 16:17:54 +01:00
Zaiming Shi 4f3790a6f5 style: fix code style for emqx_exproto 2021-11-08 16:17:54 +01:00
Zaiming Shi f1f2e51c99 fix: update appup 2021-11-08 16:17:54 +01:00
Zaiming Shi 412a68ac75 chore: bump version for emqx_proto 2021-11-08 16:17:54 +01:00
Zaiming Shi 325c5e5a97 chore: sync ce code added only to ee back to ce 2021-11-08 16:17:54 +01:00
Zaiming (Stone) Shi 1e47dbf14b
Merge pull request #6089 from k32/emqx-4-bump-version
chore(emqx): Update version and appup file
2021-11-08 16:17:16 +01:00
Zaiming (Stone) Shi e33c0a3b09
Merge pull request #6087 from emqx/patch-v4.3.9
fix(bin/emqx): ensure NAME is set
2021-11-08 16:13:07 +01:00
k32 7d07e8d948 chore(emqx): Update version and appup file 2021-11-08 14:24:37 +01:00
k32 4ebb65e5d5
Merge pull request #6065 from k32/remove-nosuspend
fix(emqx_connection): Introduce backpressure while sending data
2021-11-08 13:39:01 +01:00
Zaiming Shi f5a2421fdb fix(bin/emqx): ensure NAME is set 2021-11-08 13:27:38 +01:00
tigercl 26bc3ca0b4
Merge pull request #6063 from HJianBo/refactor-stomp-gw
fix(stomp): fix bad_return_value
2021-11-05 09:31:45 +08:00
Zaiming (Stone) Shi 5f4c6a23ab
Merge pull request #6069 from zmstone/v4-build-reenable-elvis-check
build: fix elvis check and ensure newline at EOF
2021-11-04 21:50:20 +01:00
Zaiming Shi 37edb03866 build: fix elvis check and ensure newline at EOF 2021-11-04 21:07:45 +01:00
k32 27afecb3ac fix(emqx_connection): Introduce backpressure while sending data
Fixes #5494
2021-11-04 15:25:34 +01:00
tigercl 4c4993fa25
Merge pull request #6062 from terry-xiaoyu/fix_mc_hungs
fix(ekka): add timeout to rpc:multicall/4
2021-11-04 21:59:09 +08:00
JianBo He ef9fe12825 fix(stomp): fix bad_return_value 2021-11-04 21:35:16 +08:00
Shawn a406c4f470 fix(ekka): add timeout to rpc:multicall/4 2021-11-04 16:30:46 +08:00
zhanghongtong d7aec58370 ci(relup): fix old vsn error
Signed-off-by: zhanghongtong <rory-z@outlook.com>
2021-11-04 11:54:06 +08:00
tigercl e79085c259
Merge pull request #6040 from HJianBo/refactor-stomp-gw
Refactor stomp gw
2021-11-04 10:22:21 +08:00
JianBo He f36abc281a chore(types): add comment for ver type 2021-11-04 09:11:02 +08:00
JianBo He 981f74d458 test(stomp): refine stomp test cases 2021-11-03 21:13:38 +08:00
JianBo He e4e8590a77 fix(stomp): backoff outgoung hear-beat timer interval 2021-11-03 20:37:07 +08:00
tigercl 8dfafc464e
Merge pull request #6049 from tigercl/chore/webhook-version
chore(version): skip the version occupied by enterprise
2021-11-03 16:09:46 +08:00
xiangfangyang-tech cee9b39b2d
Merge pull request #6050 from xiangfangyang-tech/improve_autotest_script
Improve autotest script
2021-11-03 16:00:53 +08:00
xiangfangyang-tech 9faab7cc9b chore(autotest): improve git_action script with emqx-fvt tag 2021-11-03 16:00:02 +08:00
xiangfangyang-tech 8fb9d27aa1
Merge pull request #1 from emqx/main-v4.3
Main v4.3
2021-11-03 15:34:08 +08:00
zhouzb e5f30a4d28 chore(version): skip the version occupied by enterprise 2021-11-03 15:26:04 +08:00
JianBo He f7760232e4 fix(stomp): parse heartbeat EOL frame 2021-11-03 14:01:05 +08:00
JianBo He af7b5704ab fix(stomp): counting packets and messages 2021-11-03 14:01:05 +08:00
Zaiming (Stone) Shi 818bde1820
Merge pull request #6044 from zmstone/use-profile-name-as-default-docker-image-tag
Use profile name as default docker image tag
2021-11-03 06:21:34 +01:00
JianBo He 0a7f04caa3 fix(stomp): enrich sub-opts if sub-id/ack absent 2021-11-03 09:19:19 +08:00
Zaiming Shi 2fb8ffa8c2 test: add git credentials for enterprise tests 2021-11-02 23:12:30 +01:00
Zaiming Shi c6c9ba400e test: parameterise emqx image name in automated integration tests 2021-11-02 22:54:52 +01:00
Zaiming Shi 42695a2f9a chore: remove external contributors as maintainers
Big thank you to Raymond M Mouthaan and Huang Rui
2021-11-02 18:25:25 +01:00
Zaiming Shi 1d0c8a4eef fix: use of default profile name as default docker image name 2021-11-02 18:25:25 +01:00
JianBo He 14515e680e fix(stomp): fix stats_timer not working 2021-11-02 21:37:22 +08:00
Turtle f00e254bdf chore(release): update version to 4.3.9 2021-11-02 18:26:57 +08:00
JianBo He 2c4d3d1d24 chore(stomp): fix dialyzer warnings 2021-11-02 17:09:57 +08:00
JianBo He cc6ea6e4dd chore(stomp): remove needless properties 2021-11-02 13:56:31 +08:00
JianBo He fa2e97b1c5 chore(stomp): update appup.src 2021-11-02 13:48:03 +08:00
JianBo He 7734d6969c fix(stomp): support pub/sub operations 2021-11-02 13:31:27 +08:00
JianBo He d2924e82ab fix(stomp): fix kick/discard crash errors 2021-11-02 13:31:27 +08:00
JianBo He ed505ee120 refactor(stomp): compatible hooks system 2021-11-02 13:31:27 +08:00
JianBo He d2b6a95484 fix(stomp): fix anonymous not working 2021-11-02 13:31:27 +08:00
zhouzb 3d9054d25e fix(typo): fix typo in webhook resource 2021-11-02 13:28:46 +08:00
Shawn 0ab1b7c95d fix(mongo): update mongodb to 3.0.10 2021-11-02 09:23:07 +08:00
Zaiming (Stone) Shi 2a3d1fcb78
Merge pull request #6023 from xiangfangyang-tech/main-v4.3
chore(autotest): add mysql&pgsql&http test flow in git_action flow
2021-11-01 16:24:20 +01:00
Zaiming (Stone) Shi fa92e61440
Merge pull request #6031 from HJianBo/ignore-duplicated-sock-error
Ignore log duplicated sock error
2021-11-01 14:36:14 +01:00
JianBo He 763f567f7d chore(appup): update appup.src 2021-11-01 18:35:41 +08:00
JianBo He c9d39b4d35 chore(channel): remove redundant logs
Multiple sock_closed events may be generated,
so we need to allow sock_closed events to be reentrant
2021-11-01 18:17:38 +08:00
Zaiming (Stone) Shi 8526032200
Merge pull request #6012 from Rory-Z/chore/change-ci-helper-version
ci: change emqx-ci-helper version for build workflows
2021-11-01 10:18:49 +01:00
xiangfangyang-tech d28f913b94 chore(autotest): update redis ssl cert file 2021-11-01 16:34:37 +08:00
Zaiming (Stone) Shi 3175d59e7b
Merge pull request #6033 from zmstone/fix-find-missing-dyn-lib-before-boot
best-effort portable for zip packages
2021-11-01 08:08:26 +01:00
Zaiming Shi 9832a2ed00 build: show linux distro in BUILT_ON info 2021-10-31 17:21:47 +01:00
Zaiming Shi ecb6c1c59e build: copy dynamic libs for zip package 2021-10-31 17:21:26 +01:00
Zaiming (Stone) Shi 831f2eda0c
Merge pull request #6030 from zmstone/fix-force-kill-after-kick-or-discard-timeout
fix(session): force kill session for 'kick' and 'discard'
2021-10-31 09:48:04 +01:00
Zaiming Shi fb62487801 fix(emqx/appup): add emqx_cm to appup 2021-10-30 16:39:04 +02:00
Zaiming Shi 765a76fa80 fix(emqx_mgmt_cli): idempontent kick. now it always returns ok 2021-10-30 16:38:36 +02:00
Zaiming Shi 7f4809f61a fix(session): force kill session for 'kick' and 'discard'
Prior to this fix, 'kick' and 'discard' calls may timeout (or
fail for other reason), failures lead to only a log, then
continue to allow the new session to get registered.

As a result, in case a client is stuck, there is no way to
force it to step down, end up with multiple connections (sessions)
for the client ID in dashboard.

After this fix, the stale pids are notified to shutdown
via a gen_server:call, and forced with a exit(Pid, kill) for any
exception happend to the gen_server:call
2021-10-30 16:38:36 +02:00
xiangfangyang-tech 2ce592040e
Merge branch 'main-v4.3' into main-v4.3 2021-10-29 15:12:22 +08:00
xiangfangyang-tech afd6fe181c chore(autotest): add git action script for v4.3
chore(autotest): change git site of autemate script

chore(autotest): improve git action script with Stones advises

chore(autotest): improve trigger condition

chore(autotest): add mysql&pgsql&http test flow in git_action script
2021-10-29 15:00:42 +08:00
Zaiming (Stone) Shi b50f0b67d4
Merge pull request #6021 from zmstone/fix-boot-handle-vmarg-flags
fix: boot handle vmarg flags
2021-10-29 08:32:43 +02:00
Zaiming Shi cb3d2fd6c3 chore: refine -heart option document 2021-10-28 21:15:54 +02:00
Zaiming Shi 18fc82855b fix(bin/emqx): handle flags in vm.args
prior to this fix, the flags such as -heart in vm.args file were taken
as KEY="", VALUE="-heart"
as a result, the sed replacement replaces all lines with "-heart"
causing beam to crash at boot
2021-10-28 21:09:06 +02:00
Zaiming (Stone) Shi dd4e307753
Merge pull request #5995 from Spycsh/main-v4.3
chore: add cluster script for local machine
2021-10-28 14:20:07 +02:00
Spycsh ec30fb346a chore: add cluster script for local machine 2021-10-28 12:07:23 +08:00
zhanghongtong ba3e7841e5 ci: change emqx-ci-helper version for build workflows 2021-10-27 17:21:17 +08:00
Ilya Averyanov 49c7eae211
Merge pull request #5885 from savonarola/fix-acl-schema
fix(mnesia_acl): introduce optimized schema and migration process
2021-10-27 10:41:05 +03:00
Ilya Averyanov 6d48bbf34c fix(mnesia_acl): added acl migration test scripts 2021-10-27 09:58:21 +03:00
Ilya Averyanov ba319e1159 fix(mnesia_acl): upgrade snabbkaffe and use ?check_trace 2021-10-27 09:58:21 +03:00
Ilya Averyanov 43ac315444 fix(mnesia_acl): do not use matchspec terms in external APIs 2021-10-27 09:58:21 +03:00
Ilya Averyanov 8341a4d4a7 fix(mnesia_acl): introduce optimized schema and migration process 2021-10-27 09:58:12 +03:00
xiangfangyang-tech 67b543f01e chore(autotest): improve trigger condition 2021-10-25 15:19:05 +08:00
xiangfangyang-tech 3e1abbddd2 chore(autotest): improve git action script with Stones advises 2021-10-25 15:19:05 +08:00
xiangfangyang-tech 48d932af83 chore(autotest): change git site of autemate script 2021-10-25 15:19:05 +08:00
xiangfangyang-tech a198158bfb chore(autotest): add git action script for v4.3 2021-10-25 15:19:05 +08:00
JianBo He 99453df637 fix(api-clients): escape the searching string 2021-10-25 09:40:56 +08:00
Zaiming (Stone) Shi fd34eb1f4e
Merge pull request #5970 from zmstone/fix-lwm2m-psk-ciphers
fix(lwm2m): add support for new cipher suites
2021-10-21 16:56:28 +02:00
Zaiming Shi 224cc0d5c7 fix(lwm2m): bump version in appup and add upgrade instructions 2021-10-21 14:31:59 +02:00
Zaiming Shi 4896c03881 fix(lwm2m): add support for new cipher suites
prior to this change, the schema does not allow newer
cipher suites, and the default ciperhs given in the conf file
is likely not supported by some clients (which only supports dtls v1.2)
2021-10-20 23:10:46 +02:00
Zaiming (Stone) Shi d2f4c55fd7
Merge pull request #5940 from savonarola/mqtt-http-api-validations-fix
fix(mgmt api): allow empty clientid in publish
2021-10-18 12:12:39 +02:00
Ilya Averyanov 3cae4437fa fix(mgmt api): allow empty clientid in publish 2021-10-18 12:10:21 +03:00
Zaiming (Stone) Shi 1984e5b68c
Merge pull request #5927 from zmstone/fix-relup-test-env-overrides
test(relup): fix env overrides
2021-10-16 06:38:52 +02:00
Zaiming (Stone) Shi 51d2fa1359
Merge pull request #5932 from zmstone/chore-scripts-skip-appup-file-app-vsn-check
chore: skip appup file in vsn check script
2021-10-15 12:59:18 +02:00
Zaiming Shi 08c2907d44 chore: skip appup file in vsn check script 2021-10-15 12:10:37 +02:00
Zaiming Shi 9038da0bd2 fix(ws_connection): check origin failure should return 403 not 500 2021-10-15 15:49:26 +08:00
Zaiming Shi 51bc9c83c3 fix: ignore unused var 2021-10-15 15:49:26 +08:00
Zaiming Shi f7d70d05ab chore: pin otp version for 4.3 2021-10-15 15:49:26 +08:00
k32 44d666f62b
Merge pull request #5923 from k32/update-appup-binary
feat(update_appup): Support binary releases (.zip)
2021-10-14 17:14:11 +02:00
Zaiming Shi d2649eea81 test(relup): fix env overrides
these are for 5.0
2021-10-14 15:53:44 +02:00
k32 14aaa4affe fix(update_appup): Fix dependency check 2021-10-14 14:18:09 +02:00
k32 cb5db8059b fix(update_appup): Use a different syntax for substitution 2021-10-14 13:47:04 +02:00
k32 703f52cec7 feat(update_appup): Support binary releases (.zip) 2021-10-13 17:25:29 +02:00
k32 4b098ce3af
Merge pull request #5907 from k32/mechanical-appup-update
chore(appup): Update appup scripts
2021-10-13 09:44:10 +02:00
k32 7e1f3c5882 revert(appup): Revert changes to management and dashboard 2021-10-13 09:19:49 +02:00
k32 b60e33ca41 fix(appup): Always run appup actions for management and dashboard 2021-10-12 19:19:26 +02:00
k32 4643415b0b chore(appup): Update appup scripts 2021-10-12 17:45:10 +02:00
Ilya Averyanov 6dca349435
Merge pull request #5878 from savonarola/fix-emqx-rpc
fix(emqx_rpc): removed unnecessary call wrapper
2021-10-12 11:18:30 +03:00
Ilya Averyanov 85723e4a35 fix(emqx_rpc): removed unnecessary call wrapper 2021-10-11 15:20:31 +03:00
zhanghongtong 75fac32c12 docs(docker): fix invalid links 2021-10-09 09:16:45 +08:00
k32 5ca28749ed
Merge pull request #5886 from k32/dev/bump-ekka-4.3
chore(ekka): Bump version
2021-10-08 13:15:02 +02:00
k32 b88674e876 chore(ekka): Bump version to 0.8.1.3
Fixes: #5367
2021-10-07 19:33:25 +02:00
Zaiming (Stone) Shi 58b5d3709d
Merge pull request #5882 from zmstone/fix-flaky-tests-cm-session-race-condition-4.3
chore: fix flaky test cm_SUITE open session racecondition
2021-10-07 17:26:24 +02:00
k32 230af7990d
Merge pull request #5868 from k32/appup-script-beams
feat(update_appup): Compare beam files
2021-10-07 17:00:02 +02:00
Zaiming Shi 7c1ce8bc70 chore: fix flaky test cm_SUITE open session racecondition 2021-10-07 11:53:53 +02:00
k32 668bcad4e0 fix(update_appup): Add forgotten CLI parameter 2021-10-07 09:59:32 +02:00
k32 20ee42be87 chore(update-appup): s/Pred/Prev/g 2021-10-06 23:45:52 +02:00
k32 29ad2c04da fix: Use application version instead of the release version 2021-10-06 23:45:52 +02:00
k32 ecf4d196eb feat(update_appup): Return error when missing appup.src 2021-10-06 23:45:52 +02:00
k32 89fbf5fea2 feat(update_appup): Add a warning message 2021-10-06 23:45:52 +02:00
k32 ca77749281 feat(update_appup): Add a full description of the algorithm 2021-10-06 23:45:52 +02:00
k32 6bee6279f8 feat(update_appup): Make the script more generic 2021-10-06 23:45:52 +02:00
k32 c50c72b18e fix(update_appup): Fix downgrade module loading 2021-10-06 23:45:52 +02:00
k32 f793883e35 refactor(update_appup): Minor code cleanup 2021-10-06 23:45:52 +02:00
k32 aca6367561 feat(update_appup): Create stubs 2021-10-06 23:45:52 +02:00
k32 4020db8fc1 feat(update_appup): Compare beam files 2021-10-06 23:45:52 +02:00
Zaiming (Stone) Shi c8dda45c55
Merge pull request #5879 from zmstone/chore-always-force-dashboard-vsn-bump
chore: force appup for emqx_dashboard app in each release
2021-10-06 22:55:58 +02:00
Zaiming Shi 1d9f5ea133 chore: force appup for emqx_dashboard app in each release 2021-10-06 22:19:05 +02:00
Zaiming (Stone) Shi 0120f8cf45
Merge pull request #5877 from zmstone/test-fix-flaky-test-case-in-broker-suite
test(emqx_broker): fix flaky tests
2021-10-06 15:22:52 +02:00
Zaiming Shi e012e77ce6 chore(ci): do not colorize JSON in jq output 2021-10-06 14:53:54 +02:00
Zaiming Shi e1a2dc9138 fix(ci): lux report verbose progress 2021-10-06 14:14:21 +02:00
Zaiming Shi 3fa442f4a4 test(emqx_broker): fix flaky tests 2021-10-05 20:55:36 +02:00
Zaiming (Stone) Shi feef02b639
Merge pull request #5874 from zmstone/fix-emqx-app-vsn
chore(emqx.app): bump emqx app to vsn 4.3.10
2021-10-05 14:34:20 +02:00
Ilya Averyanov da2c41702d
Merge pull request #5848 from savonarola/mqtt-http-api-validations
Add validations to management API
2021-10-05 14:26:38 +03:00
Zaiming Shi 7804b39e08 chore(emqx.app): bump emqx app to vsn 4.3.10
app 4.3.9 was release as a part of enterprise e4.3.4
but opensource v4.3.9 is not releasd yet, but we have
to bump app version to 4.3.10 to make appup work for the next
release (either opensource or enterprise).
2021-10-05 12:03:47 +02:00
Ilya Averyanov 44d16a26ab fix(mgmt api): validate clientid to avoid crashes and 500 HTTP errors 2021-10-05 12:09:03 +03:00
Ilya Averyanov 42339b2e35
Merge pull request #5869 from savonarola/refactor-relup-tests
chore(relup tests): refactored relup tests
2021-10-05 12:07:49 +03:00
Ilya Averyanov ebbf567fff chore(relup tests): refactored relup tests 2021-10-04 21:47:51 +03:00
Zaiming (Stone) Shi ec89781cc4
Merge pull request #5849 from savonarola/dashboard-login-security
fix(dashboard rest api): improve auth method security
2021-09-30 07:29:38 +02:00
Ilya Averyanov 40850d981d chore(CI): increased relup test timeout 2021-09-29 23:29:40 +03:00
Ilya Averyanov 188b889ed3 fix(dashboard rest api): improve auth method security
Make messages not differ when authenticating with invalid password and invalid username.

Closes: #5563
2021-09-29 19:33:45 +03:00
Zaiming (Stone) Shi 004160af56
Merge pull request #5826 from JimMoen/fix-frame
fix(frame): variable byte integer could be larger than 4 bytes.
2021-09-28 19:06:54 +02:00
JimMoen 2dba91d6d0 chore(test): variable integer test. 2021-09-28 15:15:05 +08:00
JimMoen 19031e21ec fix(frame): variable byte integer could be larger than 4 bytes. 2021-09-28 15:15:05 +08:00
Zaiming (Stone) Shi d59d3849e0
Merge pull request #5794 from zmstone/fix-flaky-test-bridge-worker
test(mqtt-bridge): increase timeout in snk event wait
2021-09-23 16:58:47 +02:00
Zaiming Shi 92a3d683cf test(mqtt-bridge): increase timeout in snk event wait 2021-09-23 13:34:27 +02:00
Zaiming (Stone) Shi 55d4dfde44
Merge pull request #5758 from m-yosefpor/main-v4.3
Backporting https://github.com/emqx/emqx/pull/5471 to main-v4.3
2021-09-16 21:36:50 +02:00
Mohammad Yosefpor 1ae3f8c204
fix: Running on Openshift clusters with restricted writable filesystem containers 2021-09-16 18:57:44 +04:30
Parham Alvani 9d993e1625
chore(auth-http): Disable Superuser Request by Defualt 2021-09-15 08:48:52 +08:00
Turtle 9f843d618d fix(rule): fix rpc timeout extend the RPC timeout interval 2021-09-15 08:19:22 +08:00
Zaiming (Stone) Shi 80421651d7
Merge pull request #5739 from zmstone/fix-pin-rebar_mix-plugin-version-0.4.0
chore(build): pin rebar_mix plugin version v0.4.0
2021-09-14 18:53:28 +02:00
Zaiming Shi d777ca7baf chore(build): pin rebar_mix plugin version v0.4.0 2021-09-14 16:31:38 +02:00
Turtle 3ad0678892 fix(rule): fix edit rule fail in the cluster 2021-09-14 14:54:24 +08:00
tigercl 4664b85968
Merge pull request #5696 from tigercl/fix/sni
fix(sni): fix bad type of sni
2021-09-09 17:04:17 +08:00
zhouzb ff2d73ad3b chore(upgrade): update upgrade script 2021-09-09 10:29:58 +08:00
zhouzb 1a694814e0 fix(sni): fix bad type of sni 2021-09-09 10:18:40 +08:00
zhanghongtong f92ff4494b fix(auth mnesia api): parsing the http body parameter does not require url decode 2021-09-09 09:42:03 +08:00
k32 1a291d5d97
Merge pull request #5666 from k32/pqueue
feat(mqueue): Interleave messages with different priorities
2021-09-07 16:14:24 +02:00
k32 9b097ac73f chore(mqueue): Remove forgotten debug message 2021-09-07 11:33:16 +02:00
k32 5fc1036cf7 chore(mqueue): Implement live upgrade 2021-09-06 23:15:14 +02:00
k32 ed61999fdf chore(emqx): Bump version 2021-09-06 22:22:48 +02:00
k32 4eacaa29bd feat(mqueue): Interleave messages with different priorities 2021-09-06 22:22:48 +02:00
zhanghongtong aaa7cd0a44 chore(release): update emqx release version 2021-09-06 10:55:02 +08:00
zhanghongtong eeb44086c8 fix(issue): 5565 2021-09-06 10:49:20 +08:00
zhouzb a27b75b98e chore(ehttpc): update tag for ehttpc 2021-09-06 10:41:24 +08:00
William Yang eb88a0b7b6
Merge pull request #5646 from qzhuyan/backport/william/issue/5254
Backport: fix(helm-chart): force headless svc ready while pod is not ready
2021-09-03 13:18:05 +02:00
William Yang e78967cfc3 fix(helm-chart): force headless svc ready while pod is not ready
fixs: #5254

The dist port behind headless svc should to be accessible during emqx
cluster boot.

Endpoints of headless SVC is not in 'ready' state that prevents nodes to talk to
each other, this issue only happens when K8s host node is restarted and
all emqx nodes are deployed on the same host.
2021-09-03 10:10:10 +02:00
Shawn fe343a0407 fix(ekka): kill the process if don't release lock 2021-09-03 10:50:12 +08:00
Turtle e532fff4df chore: Update dashboard version to 4.3.4 2021-08-27 16:28:01 +08:00
Turtle 7bcc67f95d fix(relup): get broker metrics 2021-08-27 16:28:01 +08:00
turtleDeng ea15aa3f9e
fix(data-import): fix import rule fail (#5512) 2021-08-18 09:55:04 +08:00
Turtle 6aa61ea78d fix(test): Increase the delay time 2021-08-13 17:29:51 +08:00
JianBo He a41e6604cf chore(exproto): update appup.src 2021-08-13 17:21:31 +08:00
JianBo He 473e600b53 fix(exproto): fix badarg is_process_alive/1 2021-08-13 17:21:31 +08:00
Turtle dffa81120c chore: emqx_rule_engine:load_providers has been called in emqx_dashboard.appup.src 2021-08-13 12:35:56 +08:00
Turtle f92cfa72d2 fix(webhook): fix the hot upgrade resulted in the loss of webhook messages 2021-08-13 11:05:55 +08:00
Shawn 1245020ec0 fix(force_shutdown): add some comments for the range of max_heap_size 2021-08-13 09:46:49 +08:00
Shawn 844133c7c5 fix(appup): always reload emqx_app 2021-08-13 09:46:49 +08:00
Shawn f9601804e5 chore(emqx): bump the emqx version to 4.3.8 2021-08-13 09:46:49 +08:00
Shawn d2d42ed33e fix(logger): change default value of log.max_depth to 100
The value 20 is too small to inspect some error messages, especially
when it contains stack traces.
2021-08-13 09:46:49 +08:00
Shawn 31a1942b61 fix(force_shutdown): cannot suicide if the process hangs up 2021-08-13 09:46:49 +08:00
Turtle 391eb55324 chore: format error log 2021-08-12 19:35:51 +08:00
Turtle a84b6b74bd chore(relup): update appup file 2021-08-12 19:35:51 +08:00
Turtle e0336e60da fix(webhook-action): fix webhook action path type error 2021-08-12 19:35:51 +08:00
Parham Alvani e5c4277109 fix: Correct Issues 2021-08-12 14:24:12 +08:00
Parham Alvani 45b9f682b2 feat: Expose Internal MQTT Service 2021-08-12 14:24:12 +08:00
William Yang 94712064b5 chore: bump to ekka 0.8.1.1 2021-08-12 11:04:14 +08:00
William Yang f3bd1f1c3a fix(helm-chart): make podManagementPolicy configurable 2021-08-12 11:04:14 +08:00
William Yang ced8693043 fix(helm-chart): start/stop pods in parallel 2021-08-12 11:04:14 +08:00
JianBo He 66f69e7693 feat(exhook): make request_failed_action working 2021-08-12 10:40:24 +08:00
JianBo He 7ec8dc21a6 chore(appup): update appup.src & app.src 2021-08-12 10:40:24 +08:00
JianBo He 1e4ca14476 fix(exhook): set trap_exit flag 2021-08-12 10:40:24 +08:00
JianBo He b3db4d0f7c refactor(exhook): move all manager code into mngr module 2021-08-12 10:40:24 +08:00
JianBo He 22f7b0b8e5 refactor(exhook): add mechanism to reload the failure server 2021-08-12 10:40:24 +08:00
JianBo He 60e830fef7 chore(ex): update grpc to 0.6.3 2021-08-10 17:59:36 +08:00
JianBo He f9a9d4a6f0 chore(exproto): update appup.src 2021-08-10 17:59:36 +08:00
JianBo He 5854bfab57 fix(exproto): retry the grpc request if the stream closed 2021-08-10 17:59:36 +08:00
zhanghongtong bf0036bf81 chore(cts): execute cts every six hours 2021-08-10 15:09:32 +08:00
zhanghongtong 554879c9d7 chore(relup tests): upload emqx package to workflow artifact
Signed-off-by: zhanghongtong <rory-z@outlook.com>
2021-08-09 13:27:00 +08:00
Shawn c09cb64db6
fix(lwm2m): write incorrect integer to device (#5425)
* fix(test): add testcase for write integer values

* fix(lwm2m): write incorrect integer to device

* fix(emqx_lwm2m): refactor the code for getting bits len of a signed int

* chore(emqx_lwm2m): bump version for emqx_lwm2m to 4.3.3
2021-08-06 17:05:25 +08:00
Rory Z ff96250b0b chore(tests): fix conunt error 2021-08-06 15:31:32 +08:00
Turtle 992e094ce9 fix(relup): fix badfun after relup 2021-08-05 14:19:53 +08:00
Turtle efa71d12fe chore(minirest): Upgrade minirest version to 0.3.7 2021-08-05 14:19:53 +08:00
Turtle de96349ddf chore: Specify emqtt-bench version 2021-08-05 14:19:53 +08:00
zhanghongtong 5b671e5c4f chore(CI): print log when deployment helm fail 2021-08-05 10:57:32 +08:00
zhanghongtong ed53b859d9 feat(helm): add externalIPs to chart 2021-08-05 10:57:32 +08:00
Turtle c45de03ac8 chore(version): update emqx version to 4.3.7
Signed-off-by: zhanghongtong <rory-z@outlook.com>
2021-08-05 10:00:03 +08:00
Turtle 87ee94b6f2 chore(version): update emqx version to 4.3.7 2021-08-04 18:44:47 +08:00
tigercl d4ce7f328d
Merge pull request #5395 from tigercl/chore/ehttpc
chore(ehttpc): update tag of ehttpc
2021-08-04 15:58:58 +08:00
Turtle ac0639f6b1 fix(actions): fix republish actions payload is null 2021-08-04 14:39:19 +08:00
Turtle ff4229bb93 fix(relup): fix check relup fail 2021-08-04 11:28:07 +08:00
Turtle 8fb9170df8 fix(rule-engine): fix rule status is not available after the emqx restart 2021-08-03 17:31:43 +08:00
zhouzb 46e58a50d0 chore(ehttpc): update tag of ehttpc 2021-08-03 17:27:35 +08:00
Turtle 35ae097038 fix(relup): upgrade emqx dashboard version 2021-08-03 12:17:35 +08:00
Turtle a7d67eb862 fix(script): fix emqx-ee get dashboard src fail 2021-08-03 12:17:35 +08:00
Zaiming (Stone) Shi 253fa9167c
Merge pull request #5368 from zmstone/fix-boot-log
fix(bin/emqx): fix boot log
2021-07-31 08:50:47 +02:00
Turtle 36fa9f99be test(relup): fix relup fail 2021-07-31 10:52:43 +08:00
zhouzb 65df4fd9ca fix(http pipelining): fix http pipelining for webhook resource 2021-07-30 15:22:18 +08:00
Turtle 49a00c3412 chore(relup): update appup 2021-07-30 14:39:37 +08:00
William Yang 2479c2a80b feat(ssl): mqtt bridge support ssl peer verification 2021-07-30 14:39:37 +08:00
zhanghongtong 07f58c0e9e chore(release): update emqx release version 2021-07-28 16:45:54 +08:00
tigercl 4618eb985a
Merge pull request #5334 from tigercl/chore/dashboard
chore(dashboard): update version for dashboard
2021-07-28 16:43:06 +08:00
zhouzb 2bd12a9a3d chore(dashboard): update version for dashboard 2021-07-28 14:31:24 +08:00
JianBo He d3d019cb89 chore(emqx): update appup.src 2021-07-28 13:54:13 +08:00
JianBo He 07c29e8c55 chore(acl): support ipaddr list 2021-07-28 13:54:13 +08:00
Zaiming Shi dd23ee6b15 fix(emqx_app): stop listeners in application prep_stop callback
Application:stop is call after the root supervisor is stopped,
in our case, prior to this fix, emqx_sup is stopped before
the listeners (hence the emqx_connection processes).

This causes shutdown to emit a lot of error logs
e.g. emqx_broker pool is down, but emqx_connection process is still
trying to call the pool
2021-07-28 08:52:04 +08:00
tigercl fee3462603
fix(http pipelining): support to switch http pipelining (#5279) 2021-07-27 17:32:56 +08:00
zhanghongtong a538979c3b chore(CI): upload emqx log in relup check 2021-07-27 14:57:46 +08:00
zhanghongtong 8809d72ee5 chore(CI): check relup rule action success 2021-07-27 11:31:44 +08:00
zhanghongtong a9a1c71eb4 chore(auth mnesia): hide the password in the api 2021-07-27 10:05:08 +08:00
Zaiming (Stone) Shi b851a7ea7c
Merge pull request #5301 from zmstone/add-notice
chore: Add NOTICE file
2021-07-23 11:44:26 +02:00
Zaiming Shi 7103324426 chore: Add NOTICE file 2021-07-23 10:55:03 +02:00
zhanghongtong f6138e8971 chore(relup tests): check rules matched
Signed-off-by: zhanghongtong <rory-z@outlook.com>
2021-07-22 15:28:04 +08:00
JianBo He b1d190fd3b fix(exproto): fix peername for udp socket 2021-07-21 17:33:21 +08:00
JianBo He fbaf2646f9 chore(exproto): update appup.src 2021-07-21 17:33:21 +08:00
JianBo He 31cbd66f61 fix(exproto): get peername after esockd_wait/1 2021-07-21 17:33:21 +08:00
JianBo He c878c73395
fix(exproto): fix bad socket type
* fix(exproto): fix bad socket type

* chore(exproto): update appup.src
2021-07-20 11:04:00 +08:00
zhanghongtong 5bc33b9b5b chore(CI): add time sleep for relup test 2021-07-16 20:18:33 +08:00
Turtle befd22282f chore(relup): fix check relup fail 2021-07-16 19:01:05 +08:00
Turtle 5edb5351b0 chore(relup): update emqx appup 2021-07-16 19:01:05 +08:00
zhanghongtong 2b1249ba9c fix(auth mnesia): fix add password error by api
Signed-off-by: zhanghongtong <rory-z@outlook.com>
2021-07-16 17:40:51 +08:00
Turtle 8b4b9a119b chore: bind_as_user set default value 2021-07-14 14:14:09 +08:00
JianBo He 46d0cb69dc chore(emqx): update appup.src 2021-07-13 17:53:34 +08:00
JianBo He 240a4b88a5 fix(cm): add a timeout to rpc_call function
An infinite wait will leave the client process waiting for
a return and cause the client to go to a dead state
2021-07-13 17:53:34 +08:00
JianBo He d3d636fc99 chore(mgmt): update appup.src 2021-07-13 17:53:26 +08:00
JianBo He 8cd1fa41b6 fix(mgmt): fix dump aborted by print function crash 2021-07-13 17:53:26 +08:00
zhanghongtong 750cb2d491 chore(CI): update emqx-ci-helper tag 2021-07-09 19:37:45 +08:00
Zaiming Shi 780e403262 fix(conf): change wss.external.max_connections from 16 to 102400 2021-07-09 09:30:57 +08:00
JianBo He 05b16c601b chore(presence): more fields for disconnected event 2021-07-07 18:36:09 +08:00
JianBo He 8935d28ed4 fix(exhook): catch the badarg error 2021-07-01 17:56:10 +08:00
zhanghongtong 0c66fcef00 chore(release): update emqx release version 2021-06-28 11:14:33 +08:00
tigercl 637cd5e804
Merge pull request #5105 from terry-xiaoyu/clean_emqx_shared_subscription2
fix(shared_sub): discard all unexpected msgs
2021-06-28 11:07:10 +08:00
Shawn 5fbf83e7f0 fix(shared_sub): discard all unexpected msgs 2021-06-28 09:37:34 +08:00
Shawn 513cd001ac chore(appup): update the appup for 4.3.5 2021-06-25 20:38:43 +08:00
Shawn 868cd6e57c fix(shared_sub): failed to clean the emqx_shared_subscription tab
A trick that fixes the issue that we demonitored the shared subscriber
too early if it not unsubscribed all of the topics.
2021-06-25 20:38:43 +08:00
zhanghongtong a8aabd5f74 revert: chore(CI): update events that trigger workflows
This reverts commit 002cbb6d8b
2021-06-25 20:13:35 +08:00
zhanghongtong 002cbb6d8b chore(CI): update events that trigger workflows 2021-06-24 17:44:30 +08:00
zhanghongtong e87838f272 docs(docker): fix env name error 2021-06-24 14:46:34 +08:00
zhanghongtong f18b9a92bc chore(CI): delete needless link when build packages 2021-06-23 21:38:30 +08:00
Zaiming Shi 49a78c8ef2 fix(script): exclude non-edge apps in relup dependency 2021-06-23 21:30:59 +08:00
zhanghongtong 8ad42cb827 chore(CI): add DIAGNOSTIC=1 when build windows 2021-06-23 20:27:08 +08:00
Zaiming Shi f17962e79a chore: add more info in error message 2021-06-23 19:40:12 +08:00
Turtle 98c4fff43f chore: fix inject deps notfound emqx_reloader 2021-06-23 19:03:06 +08:00
zhanghongtong bfc6c3aa42 chore(release): update emqx release version 2021-06-23 17:52:42 +08:00
Turtle 1a438125c7 chore(review): review 4.3.4 2021-06-23 17:51:17 +08:00
Turtle 2092bedb12 feat(lwm2m): fix check dialyzer fail 2021-06-23 17:08:44 +08:00
Turtle a6bd1c90d5 fix: Ignore repeatedly receiving connection packet in the wait_will_msg/wait_will_topic/connected state 2021-06-23 14:37:26 +08:00
JianBo He 3ddbdbc6c1
fix(emqx_cm): catch noproc exception from rpc_call (#5048) 2021-06-23 09:45:24 +08:00
zhanghongtong 2c0916ff05 chore(CI): upload rebar3.crashdump file when slim build failure 2021-06-23 09:44:58 +08:00
JianBo He 77a41ea88f
Fix coap uri format (#5059) 2021-06-23 08:50:20 +08:00
Zaiming Shi b92940af29 test(ci): add plugin list status check after relup new vsn install 2021-06-22 08:54:55 +08:00
Zaiming Shi bed45417dc chore(relup): add relup dependency injection 2021-06-22 08:54:55 +08:00
JianBo He 8110ef7a64 chore: upgrade lwm2m_coap to 1.1.4 2021-06-21 12:21:25 +08:00
Turtle ecec9bd2f6 feat(lwm2m): add emqx_lwm2m http API 2021-06-21 12:19:35 +08:00
Shawn 6724e59e7a fix(appup): relup for emqx_rule_registry failed 2021-06-21 12:18:39 +08:00
Shawn 5962c9c83c
feat(rules): remove stats update from rule_engine_registry (#5029) 2021-06-19 17:02:43 +08:00
Shawn c0367fb8dd
Delete resource failed when searching dependent rules (#4996) 2021-06-17 16:45:44 +08:00
tigercl 0ecaa80fb8
fix(query string): support query string in path (#4981) 2021-06-17 16:12:08 +08:00
JianBo He bdd9154001 fix(modules): fix start/stop exhook module failure 2021-06-16 14:40:57 +08:00
JianBo He bbed1b55e0 fix(ws): avoid funcation_clause for un-inited websocket 2021-06-15 11:27:47 +08:00
k32 074c0bd2cc fix(auth_ldap): Handle missing attributes
Fixes: #4953
2021-06-11 18:35:21 +08:00
Zaiming (Stone) Shi 69ef5cbdc3
Merge pull request #4979 from zmstone/chore-config-rpc-connections-default-to-one
chore(conf): change default number of gen_rpc connections to 1
2021-06-11 09:58:50 +02:00
JianBo He 42a6f2aba5
fix(mqttsn): fix proto_name to MQTT-SN instead of MQTT (#4961) 2021-06-11 11:08:24 +08:00
Shawn 0184a1b3e8
fix(minirest): encode response message failed (#4965) 2021-06-11 09:56:11 +08:00
JianBo He 86766ee7f1 fix(lwm2m): base64 decode for opaque value 2021-06-11 09:48:57 +08:00
Turtle 8eebdd5cdb chore: remove lager schema info 2021-06-11 09:48:25 +08:00
Zaiming Shi 1f57968c9b chore(conf): change default number of gen_rpc connections to 1 2021-06-10 19:59:10 +02:00
419 changed files with 15245 additions and 4585 deletions

14
.ci/acl_migration_test/build.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -xe
cd "$EMQX_PATH"
rm -rf _build _upgrade_base
mkdir _upgrade_base
pushd _upgrade_base
wget "https://s3-us-west-2.amazonaws.com/packages.emqx/emqx-ce/v${EMQX_BASE}/emqx-ubuntu20.04-${EMQX_BASE}-amd64.zip"
popd
make emqx-zip

View File

@ -0,0 +1,15 @@
#!/bin/bash
set -xe
mkdir -p "$TEST_PATH"
cd "$TEST_PATH"
cp ../"$EMQX_PATH"/_upgrade_base/*.zip ./
unzip ./*.zip
cp ../"$EMQX_PATH"/_packages/emqx/*.zip ./emqx/releases/
git clone --depth 1 https://github.com/terry-xiaoyu/one_more_emqx.git
./one_more_emqx/one_more_emqx.sh emqx2

17
.ci/acl_migration_test/suite.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -xe
export EMQX_PATH="$1"
export EMQX_BASE="$2"
export TEST_PATH="emqx_test"
./build.sh
VERSION=$("$EMQX_PATH"/pkg-vsn.sh)
export VERSION
./prepare.sh
./test.sh

121
.ci/acl_migration_test/test.sh Executable file
View File

@ -0,0 +1,121 @@
#!/bin/bash
set -e
EMQX_ENDPOINT="http://localhost:8081/api/v4/acl"
EMQX2_ENDPOINT="http://localhost:8917/api/v4/acl"
function run() {
emqx="$1"
shift
echo "[$emqx]" "$@"
pushd "$TEST_PATH/$emqx"
"$@"
popd
}
function post_rule() {
endpoint="$1"
rule="$2"
echo -n "->($endpoint) "
curl -s -u admin:public -X POST "$endpoint" -d "$rule"
echo
}
function verify_clientid_rule() {
endpoint="$1"
id="$2"
echo -n "<-($endpoint) "
curl -s -u admin:public "$endpoint/clientid/$id" | grep "$id" || (echo "verify rule for client $id failed" && return 1)
}
# Run nodes
run emqx ./bin/emqx start
run emqx2 ./bin/emqx start
run emqx ./bin/emqx_ctl plugins load emqx_auth_mnesia
run emqx2 ./bin/emqx_ctl plugins load emqx_auth_mnesia
run emqx2 ./bin/emqx_ctl cluster join 'emqx@127.0.0.1'
# Add ACL rule to unupgraded EMQX nodes
post_rule "$EMQX_ENDPOINT" '{"clientid": "CLIENT1_A","topic": "t", "action": "pub", "access": "allow"}'
post_rule "$EMQX2_ENDPOINT" '{"clientid": "CLIENT1_B","topic": "t", "action": "pub", "access": "allow"}'
# Upgrade emqx2 node
run emqx2 ./bin/emqx install "$VERSION"
sleep 60
# Verify upgrade blocked
run emqx2 ./bin/emqx eval 'emqx_acl_mnesia_migrator:is_old_table_migrated().' | grep false || (echo "emqx2 shouldn't have migrated" && exit 1)
# Verify old rules on both nodes
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT1_A'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT1_A'
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT1_B'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT1_B'
# Add ACL on OLD and NEW node, verify on all nodes
post_rule "$EMQX_ENDPOINT" '{"clientid": "CLIENT2_A","topic": "t", "action": "pub", "access": "allow"}'
post_rule "$EMQX2_ENDPOINT" '{"clientid": "CLIENT2_B","topic": "t", "action": "pub", "access": "allow"}'
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT2_A'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT2_A'
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT2_B'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT2_B'
# Upgrade emqx node
run emqx ./bin/emqx install "$VERSION"
# Wait for upgrade
sleep 60
# Verify if upgrade occured
run emqx ./bin/emqx eval 'emqx_acl_mnesia_migrator:is_old_table_migrated().' | grep true || (echo "emqx should have migrated" && exit 1)
run emqx2 ./bin/emqx eval 'emqx_acl_mnesia_migrator:is_old_table_migrated().' | grep true || (echo "emqx2 should have migrated" && exit 1)
# Verify rules are kept
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT1_A'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT1_A'
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT1_B'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT1_B'
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT2_A'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT2_A'
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT2_B'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT2_B'
# Add ACL on OLD and NEW node, verify on all nodes
post_rule "$EMQX_ENDPOINT" '{"clientid": "CLIENT3_A","topic": "t", "action": "pub", "access": "allow"}'
post_rule "$EMQX2_ENDPOINT" '{"clientid": "CLIENT3_B","topic": "t", "action": "pub", "access": "allow"}'
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT3_A'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT3_A'
verify_clientid_rule "$EMQX_ENDPOINT" 'CLIENT3_B'
verify_clientid_rule "$EMQX2_ENDPOINT" 'CLIENT3_B'
# Stop nodes
run emqx ./bin/emqx stop
run emqx2 ./bin/emqx stop
echo "Success!"

View File

@ -1,4 +1,4 @@
ARG BUILD_FROM=emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04
ARG BUILD_FROM=emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
FROM ${BUILD_FROM}
ARG EMQX_NAME=emqx

View File

@ -88,6 +88,7 @@ emqx_test(){
;;
"rpm")
packagename=$(basename "${PACKAGE_PATH}/${EMQX_NAME}"-*.rpm)
rpm -ivh "${PACKAGE_PATH}/${packagename}"
if ! rpm -q emqx | grep -q emqx; then
echo "package install error"
@ -129,23 +130,6 @@ running_test(){
pytest -v /paho-mqtt-testing/interoperability/test_client/V5/test_connect.py::test_basic
# shellcheck disable=SC2009 # pgrep does not support Extended Regular Expressions
emqx stop || kill "$(ps -ef | grep -E '\-progname\s.+emqx\s' |awk '{print $2}')"
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
service emqx start || ( tail /var/log/emqx/emqx.log.1 && exit 1 )
IDLE_TIME=0
while ! emqx_ctl status | grep -E 'Node\s.*@.*\sis\sstarted'
do
if [ $IDLE_TIME -gt 10 ]
then
echo "emqx service error"
exit 1
fi
sleep 10
IDLE_TIME=$((IDLE_TIME+1))
done
service emqx stop
fi
}
relup_test(){
@ -156,15 +140,21 @@ relup_test(){
find . -maxdepth 1 -name "${EMQX_NAME}-*-${ARCH}.zip" |
while read -r pkg; do
packagename=$(basename "${pkg}")
unzip "$packagename"
unzip -q "$packagename"
./emqx/bin/emqx start || ( tail emqx/log/emqx.log.1 && exit 1 )
./emqx/bin/emqx_ctl status
./emqx/bin/emqx versions
cp "${PACKAGE_PATH}/${EMQX_NAME}"-*-"${TARGET_VERSION}-${ARCH}".zip ./emqx/releases
./emqx/bin/emqx install "${TARGET_VERSION}"
[ "$(./emqx/bin/emqx versions |grep permanent | awk '{print $2}')" = "${TARGET_VERSION}" ] || exit 1
export EMQX_WAIT_FOR_STOP=300
./emqx/bin/emqx_ctl status
./emqx/bin/emqx stop
if ! ./emqx/bin/emqx stop; then
cat emqx/log/erlang.log.1 || true
cat emqx/log/emqx.log.1 || true
echo "failed to stop emqx"
exit 1
fi
rm -rf emqx
done
fi

View File

@ -0,0 +1,99 @@
version: '3.9'
services:
haproxy:
container_name: haproxy
image: haproxy:2.3
depends_on:
- emqx1
- emqx2
volumes:
- ./haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
- ../../etc/certs:/usr/local/etc/haproxy/certs
ports:
- "18083:18083"
# - "1883:1883"
# - "8883:8883"
# - "8083:8083"
# - "5683:5683/udp"
# - "9999:9999"
# - "8084:8084"
networks:
- emqx_bridge
working_dir: /usr/local/etc/haproxy
command:
- bash
- -c
- |
cat /usr/local/etc/haproxy/certs/cert.pem /usr/local/etc/haproxy/certs/key.pem > /usr/local/etc/haproxy/certs/emqx.pem
haproxy -f /usr/local/etc/haproxy/haproxy.cfg
emqx1:
restart: always
container_name: node1.emqx.io
image: $TARGET:$EMQX_TAG
env_file:
- conf.cluster.env
volumes:
- etc:/opt/emqx/etc
environment:
- "EMQX_HOST=node1.emqx.io"
ports:
- "11881:18083"
# - "1883:1883"
command:
- /bin/sh
- -c
- |
sed -i "s 127.0.0.1 $$(ip route show |grep "link" |awk '{print $$1}') g" /opt/emqx/etc/acl.conf
sed -i '/emqx_telemetry/d' /opt/emqx/data/loaded_plugins
/opt/emqx/bin/emqx foreground
healthcheck:
test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"]
interval: 5s
timeout: 25s
retries: 5
networks:
emqx_bridge:
aliases:
- node1.emqx.io
emqx2:
restart: always
container_name: node2.emqx.io
image: $TARGET:$EMQX_TAG
env_file:
- conf.cluster.env
volumes:
- etc:/opt/emqx/etc
environment:
- "EMQX_HOST=node2.emqx.io"
ports:
- "11882:18083"
command:
- /bin/sh
- -c
- |
sed -i "s 127.0.0.1 $$(ip route show |grep "link" |awk '{print $$1}') g" /opt/emqx/etc/acl.conf
sed -i '/emqx_telemetry/d' /opt/emqx/data/loaded_plugins
/opt/emqx/bin/emqx foreground
healthcheck:
test: ["CMD", "/opt/emqx/bin/emqx", "ping"]
interval: 5s
timeout: 25s
retries: 5
networks:
emqx_bridge:
aliases:
- node2.emqx.io
volumes:
etc:
networks:
emqx_bridge:
driver: bridge
name: emqx_bridge
ipam:
driver: default
config:
- subnet: 172.100.239.0/24
gateway: 172.100.239.1

View File

@ -27,6 +27,7 @@ services:
haproxy -f /usr/local/etc/haproxy/haproxy.cfg
emqx1:
restart: always
container_name: node1.emqx.io
image: $TARGET:$EMQX_TAG
env_file:
@ -51,6 +52,7 @@ services:
- node1.emqx.io
emqx2:
restart: always
container_name: node2.emqx.io
image: $TARGET:$EMQX_TAG
env_file:

View File

@ -0,0 +1,10 @@
version: '3.9'
services:
web_server:
container_name: Tomcat
build:
context: ./http-service
image: web-server
networks:
- emqx_bridge

View File

@ -3,7 +3,7 @@ version: '3.9'
services:
erlang:
container_name: erlang
image: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04
image: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
env_file:
- conf.env
environment:

View File

@ -0,0 +1,15 @@
FROM tomcat:10.0.5
RUN wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip \
&& unzip -q apache-maven-3.6.3-bin.zip \
&& mv apache-maven-3.6.3 /opt/apache-maven-3.6.3/ \
&& ln -s /opt/apache-maven-3.6.3/ /opt/maven
ENV M2_HOME=/opt/maven
ENV M2=$M2_HOME/bin
ENV PATH=$M2:$PATH
COPY ./web-server /code
WORKDIR /code
RUN mvn package -Dmaven.skip.test=true
RUN mv ./target/emqx-web-0.0.1.war /usr/local/tomcat/webapps/emqx-web.war
EXPOSE 8080
CMD ["/usr/local/tomcat/bin/catalina.sh","run"]

View File

@ -0,0 +1,65 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>emqx-web</groupId>
<artifactId>emqx-web</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
</dependency>
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/reousrce</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,54 @@
package com.emqx.dao;
import java.io.IOException;
import java.sql.SQLException;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ScalarHandler;
import com.emqx.util.EmqxDatabaseUtil;
public class AuthDAO {
public String getUserName(String userName) throws IOException, SQLException {
QueryRunner runner = new QueryRunner(EmqxDatabaseUtil.getDataSource());
String sql = "select password from http_user where username='"+userName+"'";
String password =runner.query(sql, new ScalarHandler<String>());
return password;
}
public String getClient(String clientid) throws IOException, SQLException {
QueryRunner runner = new QueryRunner(EmqxDatabaseUtil.getDataSource());
String sql = "select password from http_user where clientid='"+clientid+"'";
String password =runner.query(sql, new ScalarHandler<String>());
return password;
}
public String getUserAccess(String userName) throws IOException, SQLException {
QueryRunner runner = new QueryRunner(EmqxDatabaseUtil.getDataSource());
String sql = "select access from http_acl where username='"+userName+"'";
String access =runner.query(sql, new ScalarHandler<String>());
return access;
}
public String getUserTopic(String userName) throws IOException, SQLException {
QueryRunner runner = new QueryRunner(EmqxDatabaseUtil.getDataSource());
String sql = "select topic from http_acl where username='"+userName+"'";
String topic =runner.query(sql, new ScalarHandler<String>());
return topic;
}
public String getClientAccess(String clientid) throws IOException, SQLException {
QueryRunner runner = new QueryRunner(EmqxDatabaseUtil.getDataSource());
String sql = "select access from http_acl where clientid='"+clientid+"'";
String access =runner.query(sql, new ScalarHandler<String>());
return access;
}
public String getClientTopic(String clientid) throws IOException, SQLException {
QueryRunner runner = new QueryRunner(EmqxDatabaseUtil.getDataSource());
String sql = "select topic from http_acl where clientid='"+clientid+"'";
String topic =runner.query(sql, new ScalarHandler<String>());
return topic;
}
}

View File

@ -0,0 +1,45 @@
package com.emqx.dao;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Properties;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ColumnListHandler;
import org.apache.commons.dbutils.handlers.ScalarHandler;
import org.apache.commons.dbutils.handlers.columns.StringColumnHandler;
public class DBUtilsTest {
public static void main(String args[]) throws FileNotFoundException, IOException, SQLException {
Properties property = new Properties();//流文件
property.load(DBUtilsTest.class.getClassLoader().getResourceAsStream("database.properties"));
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(property.getProperty("jdbc.driver"));
dataSource.setUrl(property.getProperty("jdbc.url"));
dataSource.setUsername(property.getProperty("jdbc.username"));
dataSource.setPassword(property.getProperty("jdbc.password"));
// 初始化连接数 if(initialSize!=null)
//dataSource.setInitialSize(Integer.parseInt(initialSize));
// 最小空闲连接 if(minIdle!=null)
//dataSource.setMinIdle(Integer.parseInt(minIdle));
// 最大空闲连接 if(maxIdle!=null)
//dataSource.setMaxIdle(Integer.parseInt(maxIdle));
QueryRunner runner = new QueryRunner(dataSource);
String sql="select username from mqtt_user where id=1";
String result = runner.query(sql, new ScalarHandler<String>());
System.out.println(result);
}
}

View File

@ -0,0 +1,103 @@
package com.emqx.servlet;
import java.io.IOException;
import java.sql.SQLException;
import com.emqx.dao.AuthDAO;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
public class AclServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String clientid = req.getParameter("clientid");
String username = req.getParameter("username");
String access = req.getParameter("access");
String topic = req.getParameter("topic");
//String password = req.getParameter("password");
//step0: password is not null, or not pass.
AuthDAO dao = new AuthDAO();
try {
//step1: check username access&topic
if(username != null) {
String access_1 = dao.getUserAccess(username);
String topic_1 = dao.getUserTopic(username);
if(access.equals(access_1)) {
if(topic.equals(topic_1)) {
resp.setStatus(200);
}
else {
if(clientid != null){
String access_2 = dao.getClientAccess(clientid);
String topic_2 = dao.getClientTopic(clientid);
if(access.equals(access_2)) {
if(topic.equals(topic_2)) {
resp.setStatus(200);
}
else {
resp.setStatus(400);
}
}else {
resp.setStatus(400);
}
}else {
resp.setStatus(400);
}
}
}else {//step2.1: username password is not match, then check clientid password
if(clientid != null){
String access_3 = dao.getClientAccess(clientid);
String topic_3 = dao.getClientTopic(clientid);
if(access.equals(access_3)) {
if(topic.equals(topic_3)) {
resp.setStatus(200);
}
else {
resp.setStatus(400);
}
}else {
resp.setStatus(400);
}
}else {
resp.setStatus(400);
}
}
}else {//step2.2: username is null, then check clientid password
if(clientid != null){
String access_4 = dao.getClientAccess(clientid);
String topic_4 = dao.getClientTopic(clientid);
if(access.equals(access_4)) {
if(topic.equals(topic_4)) {
resp.setStatus(200);
}
else {
resp.setStatus(400);
}
}else {
resp.setStatus(400);
}
}else {
resp.setStatus(400);
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,72 @@
package com.emqx.servlet;
import java.io.IOException;
import java.sql.SQLException;
import com.emqx.dao.AuthDAO;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
public class AuthServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String clientid = req.getParameter("clientid");
String username =req.getParameter("username");
String password = req.getParameter("password");
//step0: password is not null, or not pass.
if(password == null) {
resp.setStatus(400);
return;
}
AuthDAO dao = new AuthDAO();
try {
//step1: check username password
if(username != null) {
String password_d = dao.getUserName(username);
if(password.equals(password_d)) {
resp.setStatus(200);
//200
}else {//step2.1: username password is not match, then check clientid password
if(clientid != null){
String password_c = dao.getClient(clientid);
if(password.equals(password_c)) {
resp.setStatus(200);
}else {
resp.setStatus(400);
}
}else {
resp.setStatus(400);
}
}
}else {//step2.2: username is null, then check clientid password
if(clientid != null){
String password_c = dao.getClient(clientid);
if(password.equals(password_c)) {
resp.setStatus(200);
}else {
resp.setStatus(400);
}
}else {
resp.setStatus(400);
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,27 @@
package com.emqx.util;
import java.io.IOException;
import java.util.Properties;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import com.emqx.dao.DBUtilsTest;
public class EmqxDatabaseUtil {
public static DataSource getDataSource() throws IOException {
Properties property = new Properties();// 流文件
property.load(EmqxDatabaseUtil.class.getClassLoader().getResourceAsStream("database.properties"));
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(property.getProperty("jdbc.driver"));
dataSource.setUrl(property.getProperty("jdbc.url"));
dataSource.setUsername(property.getProperty("jdbc.username"));
dataSource.setPassword(property.getProperty("jdbc.password"));
return dataSource;
}
}

View File

@ -0,0 +1,4 @@
jdbc.driver= com.mysql.jdbc.Driver
jdbc.url= jdbc:mysql://mysql_server:3306/mqtt
jdbc.username= root
jdbc.password= public

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://JAVA.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>emqx-web</display-name>
<servlet>
<servlet-name>Auth</servlet-name>
<servlet-class>com.emqx.servlet.AuthServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>Acl</servlet-name>
<servlet-class>com.emqx.servlet.AclServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Auth</servlet-name>
<url-pattern>/auth</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Acl</servlet-name>
<url-pattern>/acl</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>love</title>
</head>
<body>
It's lucky, jiabanxiang.
</body>
</html>

View File

@ -10,7 +10,7 @@ LB="haproxy"
apk update && apk add git curl
git clone -b develop-4.0 https://github.com/emqx/paho.mqtt.testing.git /paho.mqtt.testing
pip install pytest
pip install pytest==6.2.5
pytest -v /paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "$LB"
RESULT=$?

View File

@ -1,7 +1,7 @@
{erl_opts, [debug_info]}.
{deps,
[
{minirest, {git, "https://github.com/emqx/minirest.git", {tag, "0.3.5"}}}
{minirest, {git, "https://github.com/emqx/minirest.git", {tag, "0.3.6"}}}
]}.
{shell, [

View File

@ -0,0 +1,40 @@
#!/bin/bash
USAGE="$0 profile vsn old_vsn package_path"
EXAMPLE="$0 emqx 4.3.8-b3bb6075 v4.3.2 /home/alice/relup_dubug/downloaded_packages"
if [[ $# -ne 4 ]]; then
echo "$USAGE"
echo "$EXAMPLE"
exit 1
fi
set -ex
PROFILE="$1"
VSN="$2"
OLD_VSN="$3"
PACKAGE_PATH="$4"
TEMPDIR=$(mktemp -d)
trap '{ rm -rf -- "$TEMPDIR"; }' EXIT
git clone --branch=master "https://github.com/terry-xiaoyu/one_more_emqx.git" "$TEMPDIR/one_more_emqx"
cp -r "$PACKAGE_PATH" "$TEMPDIR/packages"
cp relup.lux "$TEMPDIR/"
cp -r http_server "$TEMPDIR/http_server"
exec docker run \
-v "$TEMPDIR:/relup_test" \
-w "/relup_test" \
-e REBAR_COLOR=none \
-it emqx/relup-test-env:erl23.2.7.2-emqx-3-ubuntu20.04 \
lux \
--progress verbose \
--case_timeout infinity \
--var PROFILE="$PROFILE" \
--var PACKAGE_PATH="/relup_test/packages" \
--var ONE_MORE_EMQX_PATH="/relup_test/one_more_emqx" \
--var VSN="$VSN" \
--var OLD_VSN="$OLD_VSN" \
relup.lux

View File

@ -1,15 +1,12 @@
[config var=PROFILE]
[config var=PACKAGE_PATH]
[config var=BENCH_PATH]
[config var=ONE_MORE_EMQX_PATH]
[config var=VSN]
[config var=OLD_VSNS]
[config var=OLD_VSN]
[config shell_cmd=/bin/bash]
[config timeout=600000]
[loop old_vsn $OLD_VSNS]
[shell http_server]
!cd http_server
!rebar3 shell
@ -21,29 +18,30 @@
?>
[shell emqx]
!OLD_VSN=$(echo $OLD_VSN | sed -r 's/[v|e]//g')
!cd $PACKAGE_PATH
!unzip -q -o $PROFILE-ubuntu20.04-$(echo $old_vsn | sed -r 's/[v|e]//g')-amd64.zip
!unzip -q -o $PROFILE-ubuntu20.04-$${OLD_VSN}-amd64.zip
?SH-PROMPT
!cd emqx
!sed -i 's|listener.wss.external[ \t]*=.*|listener.wss.external = 8085|g' etc/emqx.conf
!sed -i '/emqx_telemetry/d' data/loaded_plugins
!export EMQX_LOG__LEVEL=debug
!./bin/emqx start
?EMQ X .* is started successfully!
?SH-PROMPT
[shell emqx2]
!OLD_VSN=$(echo $OLD_VSN | sed -r 's/[v|e]//g')
!cd $PACKAGE_PATH
!cp -f $ONE_MORE_EMQX_PATH/one_more_$(echo $PROFILE | sed 's/-/_/g').sh .
!./one_more_$(echo $PROFILE | sed 's/-/_/g').sh emqx2
?SH-PROMPT
!cd emqx2
!sed -i '/emqx_telemetry/d' data/loaded_plugins
!export EMQX_LOG__LEVEL=debug
!./bin/emqx start
?EMQ X (.*) is started successfully!
?EMQ X .* is started successfully!
?SH-PROMPT
!./bin/emqx_ctl cluster join emqx@127.0.0.1
@ -63,6 +61,8 @@
!./bin/emqx_ctl rules create 'SELECT * FROM "t/#"' '[{"name":"data_to_webserver", "params": {"$$resource": "resource:691c29ba"}}]'
?created
?SH-PROMPT
!sleep 5
?SH-PROMPT
[shell emqx]
!./bin/emqx_ctl resources list
@ -71,11 +71,11 @@
!./bin/emqx_ctl rules list
?691c29ba
?SH-PROMPT
!./bin/emqx_ctl broker metrics | grep "messages.publish"
???SH-PROMPT
[shell bench]
!cd $BENCH_PATH
!./emqtt_bench pub -c 10 -I 1000 -t t/%i -s 64 -L 300
!emqtt_bench pub -c 10 -I 1000 -t t/%i -s 64 -L 300
???sent
[shell emqx]
@ -84,6 +84,27 @@
!cp -f ../$PROFILE-ubuntu20.04-$VSN-amd64.zip releases/
## upgrade to the new version
!./bin/emqx install $VSN
?Made release permanent: "$VSN"
?SH-PROMPT
!./bin/emqx versions |grep permanent
?(.*)$VSN
?SH-PROMPT
## downgrade to the old version
!./bin/emqx install $${OLD_VSN}
?Made release permanent:.*
?SH-PROMPT
!./bin/emqx versions |grep permanent | grep -qs "$${OLD_VSN}"
?SH-PROMPT:
!echo ==$$?==
?^==0==
?SH-PROMPT:
## again, upgrade to the new version
!./bin/emqx install $VSN
?Made release permanent: "$VSN"
?SH-PROMPT
@ -99,12 +120,37 @@
"""
?SH-PROMPT
!./bin/emqx_ctl plugins list | grep --color=never emqx_management
?Plugin\(emqx_management.*active=true\)
?SH-PROMPT
[shell emqx2]
!echo "" > log/emqx.log.1
?SH-PROMPT
!cp -f ../$PROFILE-ubuntu20.04-$VSN-amd64.zip releases/
## upgrade to the new version
!./bin/emqx install $VSN
?Made release permanent: "$VSN"
?SH-PROMPT
!./bin/emqx versions |grep permanent
?(.*)$VSN
?SH-PROMPT
## downgrade to the old version
!./bin/emqx install $${OLD_VSN}
?Made release permanent:.*
?SH-PROMPT
!./bin/emqx versions |grep permanent | grep -qs "$${OLD_VSN}"
?SH-PROMPT:
!echo ==$$?==
?^==0==
?SH-PROMPT:
## again, upgrade to the new version
!./bin/emqx install $VSN
?Made release permanent: "$VSN"
?SH-PROMPT
@ -120,11 +166,34 @@
"""
?SH-PROMPT
!./bin/emqx_ctl plugins list | grep --color=never emqx_management
?Plugin\(emqx_management.*active=true\)
?SH-PROMPT
[shell bench]
???publish complete
??SH-PROMPT:
!sleep 30
?SH-PROMPT
[shell emqx]
!./bin/emqx_ctl broker metrics | grep "messages.publish"
???SH-PROMPT
## We don't guarantee not to lose a single message!
## So even if we received 290~300 messages, we consider it as success
[shell bench]
!curl --user admin:public --silent --show-error http://localhost:8081/api/v4/rules | jq -M --raw-output ".data[0].metrics[] | select(.node==\"emqx@127.0.0.1\").matched"
?(29[0-9])|(300)
?SH-PROMPT
!curl --user admin:public --silent --show-error http://localhost:8081/api/v4/rules | jq -M --raw-output ".data[0].actions[0].metrics[] | select(.node==\"emqx@127.0.0.1\").success"
?(29[0-9])|(300)
?SH-PROMPT
## The /counter API is provided by .ci/fvt_test/http_server
!curl http://127.0.0.1:8080/counter
???{"data":300,"code":0}
?\{"data":(29[0-9])|(300),"code":0\}
?SH-PROMPT
[shell emqx2]
@ -158,8 +227,6 @@
!halt(3).
?SH-PROMPT:
[endloop]
[cleanup]
!echo ==$$?==
?==0==

View File

@ -12,11 +12,11 @@ assignees: tigercl
**Environment**:
- EMQ X version (e.g. `emqx_ctl status`):
- EMQX version (e.g. `emqx_ctl status`):
- Hardware configuration (e.g. `lscpu`):
- OS (e.g. `cat /etc/os-release`):
- Kernel (e.g. `uname -a`):
- Erlang/OTP version (in case you build emqx from source code):
- Erlang/OTP version (in case you build emqx from source code):
- Others:
**What happened and what you expected to happen**:

View File

@ -6,7 +6,24 @@ jobs:
check_apps_version:
runs-on: ubuntu-20.04
strategy:
matrix:
erl_otp:
- erl23.2.7.2-emqx-3
os:
- ubuntu20.04
container: emqx/build-env:${{ matrix.erl_otp }}-${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 0 # need full history
- name: Check relup (ce)
if: endsWith(github.repository, 'emqx')
run: ./scripts/update-appup.sh emqx --check
- name: Check relup (ee)
if: endsWith(github.repository, 'enterprise')
run: ./scripts/update-appup.sh emqx-ee --check
- name: Check apps version
run: ./scripts/apps-version-check.sh

View File

@ -1,21 +1,27 @@
name: Cross build packages
concurrency:
group: build-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'main-v4.**'
tags:
- v*
- e*
schedule:
- cron: '0 */6 * * *'
release:
types:
- published
workflow_dispatch:
jobs:
prepare:
runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04
container: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
outputs:
profiles: ${{ steps.set_profile.outputs.profiles}}
old_vsns: ${{ steps.set_profile.outputs.old_vsns}}
steps:
- uses: actions/checkout@v2
@ -27,15 +33,9 @@ jobs:
shell: bash
run: |
cd source
vsn="$(./pkg-vsn.sh)"
pre_vsn="$(echo $vsn | grep -oE '^[0-9]+.[0-9]')"
if make emqx-ee --dry-run > /dev/null 2>&1; then
old_vsns="$(git tag -l "e$pre_vsn.[0-9]" | xargs echo -n | sed "s/e$vsn//")"
echo "::set-output name=old_vsns::$old_vsns"
echo "::set-output name=profiles::[\"emqx-ee\"]"
else
old_vsns="$(git tag -l "v$pre_vsn.[0-9]" | xargs echo -n | sed "s/v$vsn//")"
echo "::set-output name=old_vsns::$old_vsns"
echo "::set-output name=profiles::[\"emqx\", \"emqx-edge\"]"
fi
- name: get_all_deps
@ -48,7 +48,6 @@ jobs:
run: |
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
echo "${{ secrets.CI_GIT_TOKEN }}" >> source/scripts/git-token
make -C source deps-all
zip -ryq source.zip source/* source/.[^.]*
- uses: actions/upload-artifact@v2
@ -58,13 +57,13 @@ jobs:
windows:
runs-on: windows-2019
needs: prepare
if: endsWith(github.repository, 'emqx')
strategy:
matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
otp:
- 23.3.4.13
exclude:
- profile: emqx-edge
@ -76,16 +75,15 @@ jobs:
- name: unzip source code
run: Expand-Archive -Path source.zip -DestinationPath ./
- uses: ilammy/msvc-dev-cmd@v1
- uses: gleam-lang/setup-erlang@v1.1.0
id: install_erlang
- uses: erlef/setup-beam@v1
with:
otp-version: 23.2
otp-version: ${{ matrix.otp }}
- name: build
env:
PYTHON: python
DIAGNOSTIC: 1
run: |
$env:PATH = "${{ steps.install_erlang.outputs.erlpath }}\bin;$env:PATH"
erl -eval "erlang:display(crypto:info_lib())" -s init stop
$version = $( "${{ github.ref }}" -replace "^(.*)/(.*)/" )
if ($version -match "^v[0-9]+\.[0-9]+(\.[0-9]+)?") {
$regex = "[0-9]+\.[0-9]+(-alpha|-beta|-rc)?\.[0-9]+"
@ -101,14 +99,11 @@ jobs:
Remove-Item -Force -Path rebar.lock
}
make ensure-rebar3
copy rebar3 "${{ steps.install_erlang.outputs.erlpath }}\bin"
ls "${{ steps.install_erlang.outputs.erlpath }}\bin"
rebar3 --help
make ${{ matrix.profile }}
mkdir -p _packages/${{ matrix.profile }}
Compress-Archive -Path _build/${{ matrix.profile }}/rel/emqx -DestinationPath _build/${{ matrix.profile }}/rel/$pkg_name
mv _build/${{ matrix.profile }}/rel/$pkg_name _packages/${{ matrix.profile }}
Get-FileHash -Path "_packages/${{ matrix.profile }}/$pkg_name" | Format-List | grep 'Hash' | awk '{print $3}' > _packages/${{ matrix.profile }}/$pkg_name.sha256
sha256sum "_packages/${{ matrix.profile }}/$pkg_name" | head -c 64 > "_packages/${{ matrix.profile }}/${pkg_name}.sha256"
- name: run emqx
timeout-minutes: 1
run: |
@ -125,17 +120,18 @@ jobs:
path: source/_packages/${{ matrix.profile }}/.
mac:
runs-on: macos-10.15
needs: prepare
strategy:
matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
erl_otp:
- 23.2.7.2-emqx-2
- 23.2.7.2-emqx-3
exclude:
- profile: emqx-edge
macos:
- macos-10.15
runs-on: ${{ matrix.macos }}
steps:
- uses: actions/download-artifact@v2
@ -153,8 +149,8 @@ jobs:
- uses: actions/cache@v2
id: cache
with:
path: ~/.kerl
key: erl${{ matrix.erl_otp }}-macos10.15
path: ~/.kerl/${{ matrix.erl_otp }}
key: otp-install-${{ matrix.erl_otp }}-${{ matrix.macos }}
- name: build erlang
if: steps.cache.outputs.cache-hit != 'true'
timeout-minutes: 60
@ -168,9 +164,11 @@ jobs:
- name: build
run: |
. $HOME/.kerl/${{ matrix.erl_otp }}/activate
make -C source ensure-rebar3
sudo cp source/rebar3 /usr/local/bin/rebar3
make -C source ${{ matrix.profile }}-zip
cd source
make ensure-rebar3
sudo cp rebar3 /usr/local/bin/rebar3
rm -rf _build/${{ matrix.profile }}/lib
make ${{ matrix.profile }}-zip
- name: test
run: |
cd source
@ -192,8 +190,14 @@ jobs:
exit 1
fi
./emqx/bin/emqx_ctl status
./emqx/bin/emqx stop
if ! ./emqx/bin/emqx stop; then
cat emqx/log/erlang.log.1 || true
cat emqx/log/emqx.log.1 || true
echo "failed to stop emqx"
exit 1
fi
rm -rf emqx
#sha256sum ./_packages/${{ matrix.profile }}/$pkg_name | head -c64 > ./_packages/${{ matrix.profile }}/$pkg_name.sha256
openssl dgst -sha256 ./_packages/${{ matrix.profile }}/$pkg_name | awk '{print $2}' > ./_packages/${{ matrix.profile }}/$pkg_name.sha256
- uses: actions/upload-artifact@v1
if: startsWith(github.ref, 'refs/tags/')
@ -207,6 +211,7 @@ jobs:
needs: prepare
strategy:
fail-fast: false
matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
arch:
@ -260,35 +265,9 @@ jobs:
path: .
- name: unzip source code
run: unzip -q source.zip
- name: downloads old emqx zip packages
env:
PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }}
SYSTEM: ${{ matrix.os }}
OLD_VSNS: ${{ needs.prepare.outputs.old_vsns }}
run: |
set -e -x -u
broker=$PROFILE
if [ $PROFILE = "emqx" ];then
broker="emqx-ce"
fi
if [ ! -z "$(echo $SYSTEM | grep -oE 'raspbian')" ]; then
export ARCH="arm"
fi
mkdir -p source/_upgrade_base
cd source/_upgrade_base
old_vsns=($(echo $OLD_VSNS | tr ' ' ' '))
for tag in ${old_vsns[@]}; do
if [ ! -z "$(echo $(curl -I -m 10 -o /dev/null -s -w %{http_code} https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip) | grep -oE "^[23]+")" ];then
wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip
wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$broker/$tag/$PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip.sha256
echo "$(cat $PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip.sha256) $PROFILE-$SYSTEM-${tag#[e|v]}-$ARCH.zip" | sha256sum -c || exit 1
fi
done
- name: build emqx packages
env:
ERL_OTP: erl23.2.7.2-emqx-2
ERL_OTP: erl23.2.7.2-emqx-3
PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch }}
SYSTEM: ${{ matrix.os }}
@ -333,19 +312,18 @@ jobs:
needs: prepare
strategy:
fail-fast: false
matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
arch:
- [amd64, x86_64]
- [arm64v8, aarch64]
- [arm32v7, arm]
- [i386, i386]
- [s390x, s390x]
registry:
- 'docker.io'
- 'public.ecr.aws'
exclude:
# we don't have an aws ecr repo for enterprise and edge yet
- profile: emqx-edge
registry: 'public.ecr.aws'
- profile: emqx-ee
arch: [i386, i386]
- profile: emqx-ee
arch: [s390x, s390x]
registry: 'public.ecr.aws'
steps:
- uses: actions/download-artifact@v2
@ -354,30 +332,70 @@ jobs:
path: .
- name: unzip source code
run: unzip -q source.zip
- name: build emqx docker image
env:
PROFILE: ${{ matrix.profile }}
ARCH: ${{ matrix.arch[0] }}
QEMU_ARCH: ${{ matrix.arch[1] }}
run: |
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
cd source
sudo TARGET=emqx/$PROFILE ARCH=$ARCH QEMU_ARCH=$QEMU_ARCH make docker
cd _packages/$PROFILE && for var in $(ls ${PROFILE}-docker-* ); do sudo bash -c "echo $(sha256sum $var | awk '{print $1}') > $var.sha256"; done && cd -
- uses: actions/upload-artifact@v1
if: startsWith(github.ref, 'refs/tags/')
- uses: docker/setup-buildx-action@v1
- uses: docker/setup-qemu-action@v1
with:
name: ${{ matrix.profile }}
path: source/_packages/${{ matrix.profile }}/.
delete-artifact:
runs-on: ubuntu-20.04
needs: [prepare, mac, linux, docker]
steps:
- uses: geekyeggo/delete-artifact@v1
image: tonistiigi/binfmt:latest
platforms: all
- uses: aws-actions/configure-aws-credentials@v1
if: matrix.registry == 'public.ecr.aws'
with:
name: source
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Docker login to aws ecr
if: matrix.registry == 'public.ecr.aws'
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- uses: docker/login-action@v1
if: matrix.registry == 'docker.io'
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: docker/metadata-action@v3
id: meta
with:
images: ${{ matrix.registry }}/${{ github.repository_owner }}/${{ matrix.profile }}
## only stable tag is latest
flavor: |
latest=${{ contains(github.ref, 'tags') && !contains(github.ref_name, 'rc') && !contains(github.ref_name, 'beta') && !contains(github.ref_name, 'alpha') }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=match,pattern=[v|e](.*),group=1
labels:
org.opencontainers.image.otp.version=${{ matrix.otp }}
- uses: docker/build-push-action@v2
if: matrix.profile != 'emqx-ee'
with:
## only push when stable tag and rc tag
push: ${{ contains(github.ref, 'tags') && !contains(github.ref_name, 'beta') && !contains(github.ref_name, 'alpha') }}
pull: true
no-cache: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_FROM=emqx/build-env:erl23.2.7.2-emqx-3-alpine
RUN_FROM=alpine:3.12
EMQX_NAME=${{ matrix.profile }}
file: source/deploy/docker/Dockerfile
context: source
- uses: docker/build-push-action@v2
if: matrix.profile == 'emqx-ee'
with:
## only push when stable tag and rc tag
push: ${{ contains(github.ref, 'tags') && !contains(github.ref_name, 'beta') && !contains(github.ref_name, 'alpha') }}
pull: true
no-cache: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_FROM=emqx/build-env:erl23.2.7.2-emqx-3-alpine
RUN_FROM=alpine:3.12
EMQX_NAME=${{ matrix.profile }}
file: source/deploy/docker/Dockerfile.enterprise
context: source
upload:
runs-on: ubuntu-20.04
@ -387,106 +405,37 @@ jobs:
needs: [prepare, mac, linux, docker]
strategy:
fail-fast: false
matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
steps:
- uses: actions/checkout@v2
- name: get_version
run: |
echo 'version<<EOF' >> $GITHUB_ENV
echo ${{ github.ref }} | sed -r "s ^refs/heads/|^refs/tags/(.*) \1 g" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: ${{ matrix.profile }}
path: ./_packages/${{ matrix.profile }}
path: packages/${{ matrix.profile }}
- name: install dos2unix
run: sudo apt-get update && sudo apt install -y dos2unix
- name: get packages
run: |
set -e -u
cd _packages/${{ matrix.profile }}
cd packages/${{ matrix.profile }}
for var in $( ls |grep emqx |grep -v sha256); do
dos2unix $var.sha256
echo "$(cat $var.sha256) $var" | sha256sum -c || exit 1
done
cd -
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: upload aws s3
run: |
set -e -u
if [ "${{ matrix.profile }}" == "emqx" ];then
broker="emqx-ce"
s3dir="emqx-ce"
else
broker=${{ matrix.profile }}
s3dir=${{ matrix.profile }}
fi
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws configure set default.region ${{ secrets.AWS_DEFAULT_REGION }}
aws s3 cp --recursive _packages/${{ matrix.profile }} s3://${{ secrets.AWS_S3_BUCKET }}/$broker/${{ env.version }}
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/$broker/${{ env.version }}/*"
- uses: Rory-Z/upload-release-asset@v1
if: github.event_name == 'release' && matrix.profile != 'emqx-ee'
with:
repo: emqx
path: "_packages/${{ matrix.profile }}/emqx-*"
token: ${{ github.token }}
- uses: Rory-Z/upload-release-asset@v1
if: github.event_name == 'release' && matrix.profile == 'emqx-ee'
with:
repo: emqx-enterprise
path: "_packages/${{ matrix.profile }}/emqx-*"
token: ${{ github.token }}
- name: update to emqx.io
if: github.event_name == 'release'
run: |
set -e -x -u
curl -w %{http_code} \
--insecure \
-H "Content-Type: application/json" \
-H "token: ${{ secrets.EMQX_IO_TOKEN }}" \
-X POST \
-d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ env.version }}\" }" \
${{ secrets.EMQX_IO_RELEASE_API }}
- name: push docker image to docker hub
if: github.event_name == 'release'
run: |
set -e -x -u
sudo make docker-prepare
cd _packages/${{ matrix.profile }} && for var in $(ls |grep docker |grep -v sha256); do unzip $var; sudo docker load < ${var%.*}; rm -f ${var%.*}; done && cd -
echo ${{ secrets.DOCKER_HUB_TOKEN }} |sudo docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
sudo TARGET=emqx/${{ matrix.profile }} make docker-push
sudo TARGET=emqx/${{ matrix.profile }} make docker-manifest-list
- name: update repo.emqx.io
if: github.event_name == 'release' && endsWith(github.repository, 'enterprise') && matrix.profile == 'emqx-ee'
run: |
curl --silent --show-error \
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-X POST \
-d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ee\": \"true\"}}" \
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
- name: update repo.emqx.io
if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx'
run: |
curl --silent --show-error \
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-X POST \
-d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\", \"emqx_ce\": \"true\"}}" \
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
- name: update homebrew packages
if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx'
run: |
if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
curl --silent --show-error \
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-X POST \
-d "{\"ref\":\"v1.0.1\",\"inputs\":{\"version\": \"${{ env.version }}\"}}" \
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches"
fi
- uses: geekyeggo/delete-artifact@v1
with:
name: ${{ matrix.profile }}
aws s3 cp --recursive packages/${{ matrix.profile }} s3://${{ secrets.AWS_S3_BUCKET }}/${s3dir}/${{ github.ref_name }}
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/${s3dir}/${{ github.ref_name }}/*"

View File

@ -1,10 +1,6 @@
name: Build slim packages
on:
push:
tags:
- v*
- e*
pull_request:
workflow_dispatch:
@ -15,7 +11,7 @@ jobs:
strategy:
matrix:
erl_otp:
- erl23.2.7.2-emqx-2
- erl23.2.7.2-emqx-3
os:
- ubuntu20.04
- centos7
@ -29,7 +25,6 @@ jobs:
if make emqx-ee --dry-run > /dev/null 2>&1; then
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
echo "${{ secrets.CI_GIT_TOKEN }}" >> ./scripts/git-token
echo "EMQX_NAME=emqx-ee" >> $GITHUB_ENV
else
echo "EMQX_NAME=emqx" >> $GITHUB_ENV
@ -38,6 +33,11 @@ jobs:
run: make ${EMQX_NAME}-zip
- name: build deb/rpm packages
run: make ${EMQX_NAME}-pkg
- uses: actions/upload-artifact@v1
if: failure()
with:
name: rebar3.crashdump
path: ./rebar3.crashdump
- name: pakcages test
run: |
export CODE_PATH=$GITHUB_WORKSPACE
@ -48,13 +48,13 @@ jobs:
path: _packages/**/*.zip
mac:
runs-on: macos-10.15
strategy:
matrix:
erl_otp:
- 23.2.7.2-emqx-2
- 23.2.7.2-emqx-3
macos:
- macos-11
runs-on: ${{ matrix.macos }}
steps:
- uses: actions/checkout@v1
- name: prepare
@ -62,7 +62,6 @@ jobs:
if make emqx-ee --dry-run > /dev/null 2>&1; then
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
echo "${{ secrets.CI_GIT_TOKEN }}" >> ./scripts/git-token
echo "EMQX_NAME=emqx-ee" >> $GITHUB_ENV
else
echo "EMQX_NAME=emqx" >> $GITHUB_ENV
@ -76,8 +75,8 @@ jobs:
- uses: actions/cache@v2
id: cache
with:
path: ~/.kerl
key: erl${{ matrix.erl_otp }}-macos10.15
path: ~/.kerl/${{ matrix.erl_otp }}
key: otp-install-${{ matrix.erl_otp }}-${{ matrix.macos }}
- name: build erlang
if: steps.cache.outputs.cache-hit != 'true'
timeout-minutes: 60
@ -94,6 +93,11 @@ jobs:
make ensure-rebar3
sudo cp rebar3 /usr/local/bin/rebar3
make ${EMQX_NAME}-zip
- uses: actions/upload-artifact@v1
if: failure()
with:
name: rebar3.crashdump
path: ./rebar3.crashdump
- name: test
run: |
pkg_name=$(basename _packages/${EMQX_NAME}/emqx-*.zip)

View File

@ -5,7 +5,7 @@ on: [pull_request]
jobs:
check_deps_integrity:
runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04
container: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
steps:
- uses: actions/checkout@v2

View File

@ -1,16 +0,0 @@
name: Elvis Linter
on: [pull_request]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set git token
if: endsWith(github.repository, 'enterprise')
run: |
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
- run: |
./scripts/elvis-check.sh $GITHUB_BASE_REF

View File

@ -3,7 +3,6 @@ name: Sync to enterprise
on:
push:
branches:
- master
- main-v*
jobs:
@ -23,11 +22,7 @@ jobs:
id: create_pull_request
run: |
set -euo pipefail
if [ "$GITHUB_REF" = "refs/heads/master" ]; then
EE_REF="refs/heads/enterprise"
else
EE_REF="${GITHUB_REF}-enterprise"
fi
EE_REF="${GITHUB_REF}-enterprise"
R=$(curl --silent --show-error \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \

97
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,97 @@
name: Upload release assets
on:
release:
types:
- published
jobs:
prepare:
runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
outputs:
profiles: ${{ steps.set_profile.outputs.profiles}}
s3dir: ${{ steps.set_profile.outputs.s3dir}}
steps:
- uses: actions/checkout@v2
with:
path: source
fetch-depth: 0
- name: set profile
id: set_profile
shell: bash
run: |
cd source
if make emqx-ee --dry-run > /dev/null 2>&1; then
echo "::set-output name=profiles::[\"emqx-ee\"]"
else
echo "::set-output name=profiles::[\"emqx\", \"emqx-edge\"]"
fi
upload:
runs-on: ubuntu-20.04
needs: prepare
strategy:
fail-fast: false
matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
steps:
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Get packages
run: |
if [ "${{ matrix.profile }}" == "emqx" ];then
s3dir="emqx-ce"
else
s3dir=${{ matrix.profile }}
fi
aws s3 cp --recursive s3://${{ secrets.AWS_S3_BUCKET }}/$s3dir/${{ github.ref_name }} packages
- uses: alexellis/upload-assets@0.2.2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["packages/*"]'
- name: update to emqx.io
run: |
set -e -x -u
curl -w %{http_code} \
--insecure \
-H "Content-Type: application/json" \
-H "token: ${{ secrets.EMQX_IO_TOKEN }}" \
-X POST \
-d "{\"repo\":\"emqx/emqx\", \"tag\": \"${{ github.ref_name }}\" }" \
${{ secrets.EMQX_IO_RELEASE_API }}
- name: update repo.emqx.io
if: github.event_name == 'release' && endsWith(github.repository, 'enterprise') && matrix.profile == 'emqx-ee'
run: |
curl --silent --show-error \
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-X POST \
-d "{\"ref\":\"v1.0.3\",\"inputs\":{\"version\": \"${{ github.ref_name }}\", \"emqx_ee\": \"true\"}}" \
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
- name: update repo.emqx.io
if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx'
run: |
curl --silent --show-error \
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-X POST \
-d "{\"ref\":\"v1.0.3\",\"inputs\":{\"version\": \"${{ github.ref_name }}\", \"emqx_ce\": \"true\"}}" \
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_repos.yaml/dispatches"
- name: update homebrew packages
if: github.event_name == 'release' && endsWith(github.repository, 'emqx') && matrix.profile == 'emqx'
run: |
if [ -z $(echo $version | grep -oE "(alpha|beta|rc)\.[0-9]") ]; then
curl --silent --show-error \
-H "Authorization: token ${{ secrets.CI_GIT_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-X POST \
-d "{\"ref\":\"v1.0.3\",\"inputs\":{\"version\": \"${{ github.ref_name }}\"}}" \
"https://api.github.com/repos/emqx/emqx-ci-helper/actions/workflows/update_emqx_homebrew.yaml/dispatches"
fi

View File

@ -0,0 +1,22 @@
name: ACL fix & migration integration tests
on: workflow_dispatch
jobs:
test:
runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
strategy:
fail-fast: true
env:
BASE_VERSION: "4.3.0"
steps:
- uses: actions/checkout@v2
with:
path: emqx
- name: Prepare scripts
run: |
cp ./emqx/.ci/acl_migration_test/*.sh ./
- name: Run tests
run: |
./suite.sh emqx "$BASE_VERSION"

View File

@ -0,0 +1,442 @@
name: Integration Test Suites
on:
push:
tags:
- "v4.*"
pull_request:
branches:
- "main-v4.*"
jobs:
build:
runs-on: ubuntu-latest
outputs:
imgname: ${{ steps.build_docker.outputs.imgname}}
version: ${{ steps.build_docker.outputs.version}}
steps:
- name: download jmeter
id: dload_jmeter
timeout-minutes: 1
env:
JMETER_VERSION: 5.4.3
run: |
wget --no-verbose --no-check-certificate -O /tmp/apache-jmeter.tgz https://downloads.apache.org/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
- uses: actions/upload-artifact@v2
with:
name: apache-jmeter.tgz
path: /tmp/apache-jmeter.tgz
- uses: actions/checkout@v2
- name: build docker
id: build_docker
run: |
if [ -f EMQX_ENTERPRISE ]; then
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
make deps-emqx-ee
make clean
make emqx-ee-docker
echo "::set-output name=imgname::emqx-ee"
echo "::set-output name=version::$(./pkg-vsn.sh)"
docker save emqx/emqx-ee:$(./pkg-vsn.sh) -o emqx.tar
else
make emqx-docker
echo "::set-output name=imgname::emqx"
echo "::set-output name=version::$(./pkg-vsn.sh)"
docker save emqx/emqx:$(./pkg-vsn.sh) -o emqx.tar
fi
- uses: actions/upload-artifact@v2
with:
name: emqx-docker-image
path: emqx.tar
webhook:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
webhook_type:
- webhook_data_bridge
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: emqx-docker-image
path: /tmp
- name: load docker image
run: docker load < /tmp/emqx.tar
- name: docker compose up
timeout-minutes: 5
env:
TARGET: emqx/${{ needs.build.outputs.imgname }}
EMQX_TAG: ${{ needs.build.outputs.version }}
run: |
docker-compose \
-f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
up -d --build
- uses: actions/checkout@v2
with:
repository: emqx/emqx-svt-web-server
ref: web-server-1.0
path: emqx-svt-web-server
- uses: actions/download-artifact@v2
- name: run webserver in docker
run: |
cd ./emqx-svt-web-server/svtserver
mvn clean package
cd target
docker run --name webserver --network emqx_bridge -d -v $(pwd)/svtserver-0.0.1.jar:/webserver/svtserver-0.0.1.jar --workdir /webserver openjdk:8-jdk bash \
-c "java -jar svtserver-0.0.1.jar"
- name: wait docker compose up
timeout-minutes: 5
run: |
while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do
echo "['$(date -u +"%y-%m-%dt%h:%m:%sz")']:waiting emqx";
sleep 5;
done
docker ps -a
echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV
echo WEB_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' webserver) >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
repository: emqx/emqx-fvt
ref: v1.6.0
path: scripts
- uses: actions/setup-java@v1
with:
java-version: '8.0.282' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- uses: actions/download-artifact@v2
with:
name: apache-jmeter.tgz
path: /tmp
- name: install jmeter
timeout-minutes: 10
env:
JMETER_VERSION: 5.4.3
run: |
cd /tmp && tar -xvf apache-jmeter.tgz
echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
wget --no-verbose -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-2.0.2-jar-with-dependencies.jar https://raw.githubusercontent.com/xmeter-net/mqtt-jmeter/master/Download/v2.0.2/mqtt-xmeter-2.0.2-jar-with-dependencies.jar
ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
- name: run jmeter
run: |
/opt/jmeter/bin/jmeter.sh \
-Jjmeter.save.saveservice.output_format=xml -n \
-t scripts/automate-test-suite/${{ matrix.webhook_type }}.jmx \
-Demqx_ip=$HAPROXY_IP \
-Dweb_ip=$WEB_IP \
-l jmeter_logs/webhook_${{ matrix.webhook_type }}.jtl \
-j jmeter_logs/logs/webhook_${{ matrix.webhook_type }}.log
- name: check logs
run: |
if cat jmeter_logs/webhook_${{ matrix.webhook_type }}.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
echo "check logs filed"
exit 1
fi
- uses: actions/upload-artifact@v1
if: always()
with:
name: jmeter_logs
path: ./jmeter_logs
mysql:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mysql_tag:
- 5.7
- 8
mysql_type:
- mysql_auth_acl
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: emqx-docker-image
path: /tmp
- name: load docker image
run: docker load < /tmp/emqx.tar
- name: docker compose up
timeout-minutes: 5
env:
TARGET: emqx/${{ needs.build.outputs.imgname }}
EMQX_TAG: ${{ needs.build.outputs.version }}
MYSQL_TAG: ${{ matrix.mysql_tag }}
run: |
docker-compose \
-f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
-f .ci/docker-compose-file/docker-compose-mysql-tls.yaml \
up -d --build
- name: wait docker compose up
timeout-minutes: 5
run: |
while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do
echo "['$(date -u +"%y-%m-%dt%h:%m:%sz")']:waiting emqx";
sleep 5;
done
while [ $(docker ps -a --filter name=client --filter exited=0 | wc -l) \
!= $(docker ps -a --filter name=client | wc -l) ]; do
sleep 1
done
docker ps -a
echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV
echo MYSQL_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql) >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
repository: emqx/emqx-fvt
ref: v1.6.0
path: scripts
- uses: actions/setup-java@v1
with:
java-version: '8.0.282' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- uses: actions/download-artifact@v2
with:
name: apache-jmeter.tgz
path: /tmp
- name: install jmeter
timeout-minutes: 10
env:
JMETER_VERSION: 5.4.3
run: |
cd /tmp && tar -xvf apache-jmeter.tgz
echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
wget --no-verbose -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-2.0.2-jar-with-dependencies.jar https://raw.githubusercontent.com/xmeter-net/mqtt-jmeter/master/Download/v2.0.2/mqtt-xmeter-2.0.2-jar-with-dependencies.jar
ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
- name: install jmeter plugin
run: |
wget --no-verbose -O "/opt/jmeter/lib/mysql-connector-java-8.0.16.jar" https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar
- name: run jmeter
run: |
/opt/jmeter/bin/jmeter.sh \
-Jjmeter.save.saveservice.output_format=xml -n \
-t scripts/automate-test-suite/${{ matrix.mysql_type }}.jmx \
-Droute="apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data" \
-Dmysql_ip=$MYSQL_IP \
-Demqx_ip=$HAPROXY_IP \
-Ddbname="mqtt" \
-Dmysql_user="ssluser" \
-Ddb_user="root" \
-Dmysql_pwd="public" \
-Dconfig_path="/tmp/etc" \
-Ddocker_path=".ci/docker-compose-file" \
-l jmeter_logs/${{ matrix.mysql_type }}_${{ matrix.mysql_tag }}.jtl \
-j jmeter_logs/logs/${{ matrix.mysql_type }}_${{ matrix.mysql_tag }}.log
- name: check logs
run: |
if cat jmeter_logs/${{ matrix.mysql_type }}_${{ matrix.mysql_tag }}.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
echo "check logs filed"
exit 1
fi
- uses: actions/upload-artifact@v1
if: always()
with:
name: jmeter_logs
path: ./jmeter_logs
postgresql:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pgsql_type:
- pgsql_auth_acl
pgsql_tag:
- 9
- 10
- 11
- 12
- 13
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: emqx-docker-image
path: /tmp
- name: load docker image
run: docker load < /tmp/emqx.tar
- name: docker compose up
timeout-minutes: 5
env:
TARGET: emqx/${{ needs.build.outputs.imgname }}
EMQX_TAG: ${{ needs.build.outputs.version }}
PGSQL_TAG: ${{ matrix.pgsql_tag }}
run: |
docker-compose \
-f .ci/docker-compose-file/docker-compose-emqx-broker-cluster.yaml \
-f .ci/docker-compose-file/docker-compose-pgsql-tls.yaml \
up -d --build
- name: wait docker compose up
timeout-minutes: 5
run: |
while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do
echo "['$(date -u +"%y-%m-%dt%h:%m:%sz")']:waiting emqx";
sleep 5;
done
docker ps -a
echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV
echo PGSQL_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql) >> $GITHUB_ENV
echo CONFIG_PATH=$(docker inspect -f '{{ range .Mounts }}{{ if eq .Name "docker-compose-file_etc" }}{{ .Source }}{{ end }}{{ end }}' node1.emqx.io) >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
repository: emqx/emqx-fvt
ref: v1.6.0
path: scripts
- uses: actions/setup-java@v1
with:
java-version: '8.0.282' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- uses: actions/download-artifact@v2
with:
name: apache-jmeter.tgz
path: /tmp
- name: install jmeter
timeout-minutes: 10
env:
JMETER_VERSION: 5.4.3
run: |
cd /tmp && tar -xvf apache-jmeter.tgz
echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
wget --no-verbose -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-2.0.2-jar-with-dependencies.jar https://raw.githubusercontent.com/xmeter-net/mqtt-jmeter/master/Download/v2.0.2/mqtt-xmeter-2.0.2-jar-with-dependencies.jar
ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
- name: install jmeter plugin
run: |
wget --no-verbose -O "/opt/jmeter/lib/postgresql-42.2.18.jar" https://repo1.maven.org/maven2/org/postgresql/postgresql/42.2.18/postgresql-42.2.18.jar
- name: run jmeter
run: |
sudo /opt/jmeter/bin/jmeter.sh \
-Jjmeter.save.saveservice.output_format=xml -n \
-t scripts/automate-test-suite/${{ matrix.pgsql_type }}.jmx \
-Droute="apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data" \
-Dca_name="ca.pem" \
-Dkey_name="client-key.pem" \
-Dcert_name="client-cert.pem" \
-Ddb_ip=$PGSQL_IP \
-Dpgsql_ip=$PGSQL_IP \
-Demqx_ip=$HAPROXY_IP \
-Dpgsql_user="root" \
-Dpgsql_pwd="public" \
-Ddbname="mqtt" \
-Dpgsql_db="mqtt" \
-Dport="5432" \
-Dconfig_path=$CONFIG_PATH \
-Ddocker_path=".ci/docker-compose-file" \
-l jmeter_logs/${{ matrix.pgsql_type }}_${{ matrix.pgsql_tag }}.jtl \
-j jmeter_logs/logs/${{ matrix.pgsql_type }}_${{ matrix.pgsql_tag }}.log
- name: check logs
run: |
if cat jmeter_logs/${{ matrix.pgsql_type }}_${{ matrix.pgsql_tag }}.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
echo "check logs filed"
exit 1
fi
- uses: actions/upload-artifact@v1
if: always()
with:
name: jmeter_logs
path: ./jmeter_logs
http:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: emqx-docker-image
path: /tmp
- name: load docker image
run: docker load < /tmp/emqx.tar
- name: docker compose up
timeout-minutes: 5
env:
TARGET: emqx/${{ needs.build.outputs.imgname }}
EMQX_TAG: ${{ needs.build.outputs.version }}
MYSQL_TAG: 8
run: |
docker-compose \
-f .ci/docker-compose-file/docker-compose-emqx-broker-cluster.yaml \
-f .ci/docker-compose-file/docker-compose-mysql-tcp.yaml \
-f .ci/docker-compose-file/docker-compose-enterprise-tomcat-tcp.yaml \
up -d --build
- name: wait docker compose up
timeout-minutes: 5
run: |
while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do
echo "['$(date -u +"%y-%m-%dt%h:%m:%sz")']:waiting emqx";
sleep 5;
done
docker ps -a
echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV
echo HTTP_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' Tomcat) >> $GITHUB_ENV
echo MYSQL_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql) >> $GITHUB_ENV
echo CONFIG_PATH=$(docker inspect -f '{{ range .Mounts }}{{ if eq .Name "docker-compose-file_etc" }}{{ .Source }}{{ end }}{{ end }}' node1.emqx.io) >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
repository: emqx/emqx-fvt
ref: v1.6.0
path: scripts
- uses: actions/setup-java@v1
with:
java-version: '8.0.282' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- uses: actions/download-artifact@v2
with:
name: apache-jmeter.tgz
path: /tmp
- name: install jmeter
timeout-minutes: 10
env:
JMETER_VERSION: 5.4.3
run: |
cd /tmp && tar -xvf apache-jmeter.tgz
echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
wget --no-verbose -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-2.0.2-jar-with-dependencies.jar https://raw.githubusercontent.com/xmeter-net/mqtt-jmeter/master/Download/v2.0.2/mqtt-xmeter-2.0.2-jar-with-dependencies.jar
ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
- name: install jmeter plugin
run: |
wget --no-verbose -O "/opt/jmeter/lib/mysql-connector-java-8.0.16.jar" https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar
- name: run jmeter
run: |
sudo /opt/jmeter/bin/jmeter.sh \
-Jjmeter.save.saveservice.output_format=xml -n \
-t scripts/automate-test-suite/http_auth_acl.jmx \
-Dmysql_ip=$MYSQL_IP \
-Demqx_ip=$HAPROXY_IP \
-Dweb_server_ip=$HTTP_IP \
-Dconfig_path=$CONFIG_PATH \
-Ddocker_path=".ci/docker-compose-file" \
-l jmeter_logs/http_auth_acl.jtl \
-j jmeter_logs/logs/http_auth_acl.log
- name: check logs
run: |
if cat jmeter_logs/http_auth_acl.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
echo "check logs filed"
sudo cat /var/lib/docker/volumes/docker-compose-file_etc/_data/emqx.conf
exit 1
fi
- uses: actions/upload-artifact@v1
if: always()
with:
name: jmeter_logs
path: ./jmeter_logs

View File

@ -1,11 +1,13 @@
name: Compatibility Test Suite
on:
schedule:
- cron: '0 */6 * * *'
pull_request:
push:
tags:
- v*
- e*
pull_request:
jobs:
ldap:
@ -45,11 +47,12 @@ jobs:
fi
- name: run test cases
run: |
export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
printenv > .env
docker exec -i erlang sh -c "make ensure-rebar3"
docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_ldap"
docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_ldap"
printenv | grep "^EMQX_" > .env
docker exec -i \
-e "CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_" \
--env-file .env \
erlang sh -c "make apps/emqx_auth_ldap-ct"
- uses: actions/upload-artifact@v1
if: failure()
with:
@ -114,11 +117,11 @@ jobs:
fi
- name: run test cases
run: |
export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
printenv > .env
docker exec -i erlang sh -c "make ensure-rebar3"
docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_mongo"
docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mongo"
printenv | grep "^EMQX_" > .env
docker exec -i \
-e "CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_" \
--env-file .env \
erlang sh -c "make apps/emqx_auth_mongo-ct"
- uses: actions/upload-artifact@v1
if: failure()
with:
@ -196,11 +199,11 @@ jobs:
fi
- name: run test cases
run: |
export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
printenv > .env
docker exec -i erlang sh -c "make ensure-rebar3"
docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_mysql"
docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mysql"
printenv | grep "^EMQX_" > .env
docker exec -i \
-e "CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_" \
--env-file .env \
erlang sh -c "make apps/emqx_auth_mysql-ct"
- uses: actions/upload-artifact@v1
if: failure()
with:
@ -269,12 +272,12 @@ jobs:
run: |
export EMQX_AUTH__PGSQL__USERNAME=root \
EMQX_AUTH__PGSQL__PASSWORD=public \
EMQX_AUTH__PGSQL__DATABASE=mqtt \
CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
printenv > .env
docker exec -i erlang sh -c "make ensure-rebar3"
docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_pgsql"
docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_pgsql"
EMQX_AUTH__PGSQL__DATABASE=mqtt
printenv | grep "^EMQX_" > .env
docker exec -i \
-e "CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_" \
--env-file .env \
erlang sh -c "make apps/emqx_auth_pgsql-ct"
- uses: actions/upload-artifact@v1
if: failure()
with:
@ -390,12 +393,12 @@ jobs:
fi
- name: run test cases
run: |
export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
export EMQX_AUTH__REIDS__PASSWORD=public
printenv > .env
docker exec -i erlang sh -c "make ensure-rebar3"
docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_redis"
docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_redis"
printenv | grep "^EMQX_" > .env
docker exec -i \
-e "CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_" \
--env-file .env \
erlang sh -c "make apps/emqx_auth_redis-ct"
- uses: actions/upload-artifact@v1
if: failure()
with:

View File

@ -17,21 +17,20 @@ jobs:
id: install_erlang
with:
otp-version: 23.2
- name: prepare
- name: make docker
run: |
if make emqx-ee --dry-run > /dev/null 2>&1; then
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
echo "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
make deps-emqx-ee
echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
make emqx-ee-docker
else
echo "TARGET=emqx/emqx" >> $GITHUB_ENV
echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
make emqx-docker
fi
- name: make emqx image
run: make docker
- name: run emqx
timeout-minutes: 5
run: |
@ -76,14 +75,13 @@ jobs:
if make emqx-ee --dry-run > /dev/null 2>&1; then
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
echo "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
make deps-emqx-ee
echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
make emqx-ee-docker
else
echo "TARGET=emqx/emqx" >> $GITHUB_ENV
make emqx-docker
fi
- name: make emqx image
run: make docker
- name: install k3s
env:
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
@ -130,11 +128,27 @@ jobs:
echo "waiting emqx started";
sleep 10;
done
- name: get pods log
- name: get emqx-0 pods log
if: failure()
env:
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
run: kubectl describe pods emqx-0
run: |
kubectl describe pods emqx-0
kubectl logs emqx-0
- name: get emqx-1 pods log
if: failure()
env:
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
run: |
kubectl describe pods emqx-1
kubectl logs emqx-1
- name: get emqx-2 pods log
if: failure()
env:
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
run: |
kubectl describe pods emqx-2
kubectl logs emqx-2
- uses: actions/checkout@v2
with:
repository: emqx/paho.mqtt.testing
@ -162,117 +176,140 @@ jobs:
fi
exit $RESULT
relup_test:
relup_test_plan:
runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04
container: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
outputs:
profile: ${{ steps.profile-and-versions.outputs.profile }}
vsn: ${{ steps.profile-and-versions.outputs.vsn }}
old_vsns: ${{ steps.profile-and-versions.outputs.old_vsns }}
broker: ${{ steps.profile-and-versions.outputs.broker }}
matrix: ${{ steps.generate-matrix.outputs.matrix }}
defaults:
run:
shell: bash
steps:
- uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- uses: actions/checkout@v2
name: Checkout
with:
repository: emqx/paho.mqtt.testing
ref: develop-4.0
path: paho.mqtt.testing
path: emqx
fetch-depth: 0
- name: Get profile and version list
id: profile-and-versions
run: |
cd emqx
vsn="$(./pkg-vsn.sh)"
if make emqx-ee --dry-run > /dev/null 2>&1; then
profile="emqx-ee"
old_vsns="$(./scripts/relup-base-vsns.sh enterprise | xargs)"
broker="emqx-ee"
else
profile="emqx"
old_vsns="$(./scripts/relup-base-vsns.sh community | xargs)"
broker="emqx-ce"
fi
echo "OLD_VSNS=$old_vsns" >> $GITHUB_ENV
echo "::set-output name=vsn::$vsn"
echo "::set-output name=profile::$profile"
echo "::set-output name=broker::$broker"
echo "::set-output name=old_vsns::$old_vsns"
- name: Generate matrix
id: generate-matrix
run: |
matrix=$(echo -n "$OLD_VSNS" | sed 's/ $//g' | jq -R -s -c 'split(" ")')
echo "::set-output name=matrix::$matrix"
relup_test_build:
needs: relup_test_plan
runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
defaults:
run:
shell: bash
env:
OLD_VSNS: "${{ needs.relup_test_plan.outputs.old_vsns }}"
PROFILE: "${{ needs.relup_test_plan.outputs.profile }}"
BROKER: "${{ needs.relup_test_plan.outputs.broker }}"
steps:
- uses: actions/checkout@v2
name: Checkout
with:
path: emqx
fetch-depth: 0
- name: Prepare credentials
run: |
if [ "$PROFILE" = "emqx-ee" ]; then
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
fi
- name: Build emqx
run: make -C emqx ${PROFILE}-zip
- uses: actions/upload-artifact@v2
name: Upload built emqx and test scenario
with:
name: emqx_built
path: |
emqx/_packages/*/*.zip
emqx/.ci/fvt_tests
relup_test_run:
needs:
- relup_test_plan
- relup_test_build
runs-on: ubuntu-20.04
container: emqx/relup-test-env:erl23.2.7.2-emqx-3-ubuntu20.04
strategy:
fail-fast: false
matrix:
old_vsn: ${{ fromJson(needs.relup_test_plan.outputs.matrix) }}
env:
OLD_VSN: "${{ matrix.old_vsn }}"
PROFILE: "${{ needs.relup_test_plan.outputs.profile }}"
VSN: "${{ needs.relup_test_plan.outputs.vsn }}"
BROKER: "${{ needs.relup_test_plan.outputs.broker }}"
defaults:
run:
shell: bash
steps:
- uses: actions/download-artifact@v2
name: Download built emqx and test scenario
with:
name: emqx_built
path: emqx_built
- uses: actions/checkout@v2
name: Checkout one_more_emqx
with:
repository: terry-xiaoyu/one_more_emqx
ref: master
path: one_more_emqx
- uses: actions/checkout@v2
with:
repository: emqx/emqtt-bench
ref: master
path: emqtt-bench
- uses: actions/checkout@v2
with:
repository: hawk/lux
ref: lux-2.6
path: lux
- uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
path: emqx
fetch-depth: 0
- name: prepare
run: |
if make -C emqx emqx-ee --dry-run > /dev/null 2>&1; then
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
echo "${{ secrets.CI_GIT_TOKEN }}" >> emqx/scripts/git-token
echo "PROFILE=emqx-ee" >> $GITHUB_ENV
else
echo "PROFILE=emqx" >> $GITHUB_ENV
fi
- name: get version
- name: Prepare packages
run: |
set -e -x -u
cd emqx
if [ $PROFILE = "emqx" ];then
broker="emqx-ce"
edition='opensource'
else
broker="emqx-ee"
edition='enterprise'
fi
echo "BROKER=$broker" >> $GITHUB_ENV
vsn="$(./pkg-vsn.sh)"
echo "VSN=$vsn" >> $GITHUB_ENV
pre_vsn="$(echo $vsn | grep -oE '^[0-9]+.[0-9]')"
if [ $PROFILE = "emqx" ]; then
old_vsns="$(git tag -l "v$pre_vsn.[0-9]" | xargs echo -n | sed "s/v$vsn//")"
else
old_vsns="$(git tag -l "e$pre_vsn.[0-9]" | xargs echo -n | sed "s/e$vsn//")"
fi
echo "OLD_VSNS=$old_vsns" >> $GITHUB_ENV
- name: download emqx
mkdir -p packages
cp emqx_built/_packages/*/*.zip packages
cd packages
wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$BROKER/$OLD_VSN/$PROFILE-ubuntu20.04-${OLD_VSN#[e|v]}-amd64.zip
- name: Run relup test scenario
timeout-minutes: 5
run: |
set -e -x -u
mkdir -p emqx/_upgrade_base
cd emqx/_upgrade_base
old_vsns=($(echo $OLD_VSNS | tr ' ' ' '))
for old_vsn in ${old_vsns[@]}; do
wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$BROKER/$old_vsn/$PROFILE-ubuntu20.04-${old_vsn#[e|v]}-amd64.zip
done
- name: build emqx
run: make -C emqx ${PROFILE}-zip
- name: build emqtt-bench
run: make -C emqtt-bench
- name: build lux
run: |
set -e -u -x
cd lux
autoconf
./configure
make
make install
- name: run relup test
timeout-minutes: 20
run: |
set -e -x -u
if [ -n "$OLD_VSNS" ]; then
mkdir -p packages
cp emqx/_packages/${PROFILE}/*.zip packages
cp emqx/_upgrade_base/*.zip packages
lux \
--case_timeout infinity \
--var PROFILE=$PROFILE \
--var PACKAGE_PATH=$(pwd)/packages \
--var BENCH_PATH=$(pwd)/emqtt-bench \
--var ONE_MORE_EMQX_PATH=$(pwd)/one_more_emqx \
--var VSN="$VSN" \
--var OLD_VSNS="$OLD_VSNS" \
emqx/.ci/fvt_tests/relup.lux
fi
- uses: actions/upload-artifact@v1
lux \
--progress verbose \
--case_timeout infinity \
--var PROFILE=$PROFILE \
--var PACKAGE_PATH=$(pwd)/packages \
--var ONE_MORE_EMQX_PATH=$(pwd)/one_more_emqx \
--var VSN="$VSN" \
--var OLD_VSN="$OLD_VSN" \
emqx_built/.ci/fvt_tests/relup.lux
- uses: actions/upload-artifact@v2
name: Save debug data
if: failure()
with:
name: lux_logs
path: lux_logs
name: debug_data
path: |
packages/emqx/log/emqx.log.1
packages/emqx2/log/emqx.log.1
packages/*.zip
lux_logs

View File

@ -8,26 +8,9 @@ on:
pull_request:
jobs:
run_static_analysis:
runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04
steps:
- uses: actions/checkout@v2
- name: set git credentials
run: |
if make emqx-ee --dry-run > /dev/null 2>&1; then
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
git config --global credential.helper store
fi
- name: xref
run: make xref
- name: dialyzer
run: make dialyzer
run_proper_test:
runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04
container: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
steps:
- uses: actions/checkout@v2

13
.gitignore vendored
View File

@ -47,3 +47,16 @@ dist.zip
scripts/git-token
etc/*.seg
_upgrade_base/
erlang_ls.config
.els_cache/
# VSCode files
.vs/
.vscode/
# Emacs Backup files
*~
# Emacs temporary files
.#*
*#
# For direnv
.envrc
mix.lock

View File

@ -1 +1 @@
erlang 24.0.1-emqx-1
erlang 23.2.7.2-emqx-3

202
CHANGES-4.3.md Normal file
View File

@ -0,0 +1,202 @@
# EMQX 4.3 Changes
Started tracking changes in CHANGE.md since EMQX v4.3.11
NOTE: Keep prepending to the head of the file instead of the tail
File format:
- Use weight-2 heading for releases
- One list item per change topic
Change log ends with a list of github PRs
## v4.3.15
### Enhancements
* Made possible for EMQX to boot from a Linux directory which has white spaces in its path.
## v4.3.14
### Enhancements
* Add `RequestMeta` for exhook.proto in order to expose `cluster_name` of emqx in each gRPC request. [#7524]
* Support customize emqx_exhook execution priority. [#7408]
* add api: PUT /rules/{id}/reset_metrics.
This api reset the metrics of the rule engine of a rule, and reset the metrics of the action related to this rule. [#7474]
* Enhanced rule engine error handling when json parsing error.
* Add support for `RSA-PSK-AES256-GCM-SHA384`, `RSA-PSK-AES256-CBC-SHA384`,
`RSA-PSK-AES128-GCM-SHA256`, `RSA-PSK-AES128-CBC-SHA256` PSK ciphers, and remove `PSK-3DES-EDE-CBC-SHA`,
`PSK-RC4-SHA` from the default configuration. [#7427]
* Diagnostic logging for mnesia `wait_for_table`
- prints check points of mnesia internal stats
- prints check points of per table loading stats
Help to locate the problem of long table loading time.
* Add `local` strategy for Shared Subscription.
That will preferentially dispatch messages to a shared subscriber at the same
node. It will improves the efficiency of shared messages dispatching in certain
scenarios, especially when the emqx-bridge-mqtt plugin is configured as shared
subscription. [#7462]
### Bug fixes
* Prohibit empty topics in strict mode
* Make sure ehttpc delete useless pool always succeed.
* Update mongodb driver to fix potential process leak.
* Fix a potential security issue #3155 with emqx-dashboard plugin.
In the earlier implementation, the Dashboard password is reset back to the
default value of emqx_dashboard.conf after the node left cluster.
Now we persist changed password to protect against reset. [#7518]
* Silence grep/sed warnings in docker-entrypoint.sh. [#7520]
* Generate `loaded_modules` and `loaded_plugins` files with default values when no such files exists. [#7520]
* Fix the configuration `server_name_indication` set to disable does not take effect.
## v4.3.13
### Important changes
* For docker image, /opt/emqx/etc has been removed from the VOLUME list,
this made it easier for the users to rebuild image on top with changed configs.
* CentOS 7 Erlang runtime is rebuilt on OpenSSL-1.1.1n (previously on 1.0),
Prior to v4.3.13, EMQX pick certain cipher suites proposed by the clients,
but then fail to handshake resulting in a `malformed_handshake_data` exception.
* CentOS 8 Erlang runtime is rebuilt on RockyLinux 8.
'centos8' will remain in the package name to keep it backward compatible.
### Enhancements
* CLI `emqx_ctl pem_cache clean` to force purge x509 certificate cache,
to force an immediate reload of all certificates after the files are updated on disk.
* Refactor the ExProto so that anonymous clients can also be displayed on the dashboard [#6983]
* Force shutdown of processes that cannot answer takeover event [#7026]
* `topic` parameter in bridge configuration can have `${node}` substitution (just like in `clientid` parameter)
* Add UTF-8 string validity check in `strict_mode` for MQTT packet.
When set to true, invalid UTF-8 strings will cause the client to be disconnected. i.e. client ID, topic name. [#7261]
* Changed systemd service restart delay from 10 seconds to 60 seconds.
* MQTT-SN gateway supports initiative to synchronize registered topics after session resumed. [#7300]
* Add load control app for future development.
* Change the precision of float to 17 digits after the decimal point when formatting a
float using payload templates of rule actions. The old precision is 10 digits before
this change. [#7336]
* Return the cached resource status when querying a resource using HTTP APIs.
This is to avoid blocking the HTTP request if the resource is unavailable. [#7374]
### Bug fixes
* Fix the `{error,eexist}` error when do release upgrade again if last run failed. [#7121]
* Fix case where publishing to a non-existent topic alias would crash the connection [#6979]
* Fix HTTP-API 500 error on querying the lwm2m client list on the another node [#7009]
* Fix the ExProto connection registry is not released after the client process abnormally exits [#6983]
* Fix Server-KeepAlive wrongly applied on MQTT v3.0/v3.1 [#7085]
* Fix Stomp client can not trigger `$event/client_connection` message [#7096]
* Fix system memory false alarm at boot
* Fix the MQTT-SN message replay when the topic is not registered to the client [#6970]
* Fix rpc get node info maybe crash when other nodes is not ready.
* Fix false alert level log “cannot_find_plugins” caused by duplicate plugin names in `loaded_plugins` files.
* Prompt user how to change the dashboard's initial default password when emqx start.
* Fix errno=13 'Permission denied' Cannot create FIFO boot error in Amazon Linux 2022 (el8 package)
* Fix user or appid created, name only allow `^[A-Za-z]+[A-Za-z0-9-_]*$`
* Fix subscribe http api crash by bad_qos `/mqtt/subscribe`,`/mqtt/subscribe_batch`.
* Send DISCONNECT packet with reason code 0x98 if connection has been kicked [#7309]
* Auto subscribe to an empty topic will be simply ignored now
## v4.3.12
### Important changes
### Minor changes
* Fix updating `emqx_auth_mnesia.conf` password and restarting the new password does not take effect [#6717]
* Fix import data crash when emqx_auth_mnesia's record is not empty [#6717]
* Fix `os_mon.sysmem_high_watermark` may not alert after reboot.
* Enhancement: Log client status before killing it for holding the lock for too long.
[emqx-6959](https://github.com/emqx/emqx/pull/6959)
[ekka-144](https://github.com/emqx/ekka/pull/144)
[ekka-146](https://github.com/emqx/ekka/pull/146)
## v4.3.11
Important notes:
- For Debian/Ubuntu users
We changed the package installed service from init.d to systemd.
The upgrade from init.d to systemd is verified, however it is
recommended to verify it before rolling out to production.
At least to ensure systemd is available in your system.
- For Centos Users
RPM package now depends on `openssl11` which is NOT available
in certain centos distributions.
Please make sure the yum repo [epel-release](https://docs.fedoraproject.org/en-US/epel) is installed.
### Important changes
* Debian/Ubuntu package (deb) installed EMQX now runs on systemd [#6389]<br>
This is to take advantage of systemd's supervision functionality to ensure
EMQX service is restarted after crashes.
### Minor changes
* Clustering malfunction fixes [#6221, #6381]
Mostly changes made in [ekka](https://github.com/emqx/ekka/pull/134)<br>
From 0.8.1.4 to 0.8.1.6, fixes included intra-cluster RPC call timeouts,<br>
also fixed `ekka_locker` process crashed after killing a hanged lock owner.
* Improved log message when TCP proxy is in use but proxy_protocol configuration is not turned on [#6416]<br>
"please check proxy_protocol config for specific listeners and zones" to hint a misconfiguration
* Helm chart supports networking.k8s.io/v1 [#6368]
* Fix session takeover race condition which may lead to message loss [#6396]
* EMQX docker images are pushed to aws public ecr in an automated CI job [#6271]<br>
`docker pull public.ecr.aws/emqx/emqx:4.3.10`
* Fix webhook URL path to allow rule-engine variable substitution [#6399]
* Corrected RAM usage display [#6379]
* Changed emqx_sn_registry table creation to runtime [#6357]<br>
This was a bug introduced in 4.3.3, in which the table is changed from ets to mnesia<br>
this will cause upgrade to fail when a later version node joins a 4.3.0-2 cluster<br>
* Log level for normal termination changed from info to debug [#6358]
* Added config `retainer.stop_publish_clear_msg` to enable/disable empty message retained message publish [#6343]<br>
In MQTT 3.1.1, it is unclear if a MQTT broker should publish the 'clear' (no payload) message<br>
to the subscribers, or just delete the retained message. So we have made it configurable
* Fix mqtt bridge malfunction when remote host is unreachable (hangs the connection) [#6286, #6323]
* System monitor now inspects `current_stacktrace` of suspicious process [#6290]<br>
`current_function` was not quite helpful
* Changed default `max_topc_levels` config value to 128 [#6294, #6420]<br>
previously it has no limit (config value = 0), which can be a potential DoS threat
* Collect only libcrypto and libtinfo so files for zip package [#6259]<br>
in 4.3.10 we tried to collect all so files, however glibc is not quite portable
* Added openssl-1.1 to RPM dependency [#6239]
* Http client duplicated header fix [#6195]
* Fix `node_dump` issues when working with deb or rpm installation [#6209]
* Pin Erlang/OTP 23.2.7.2-emqx-3 [#6246]<br>
4.3.10 is on 23.2.7.2-emqx-2, this bump is to fix an ECC signature name typo:
ecdsa_secp512r1_sha512 -> ecdsa_secp521r1_sha512
* HTTP client performance improvement [#6474, #6414]<br>
The changes are mostly done in the dependency [repo](https://github.com/emqx/ehttpc).
* For messages from gateways add message properties as MQTT message headers [#6142]<br>
e.g. messages from CoAP, LwM2M, Stomp, ExProto, when translated into MQTT message<br>
properties such as protocol name, protocol version, username (if any) peer-host<br>
etc. are filled as MQTT message headers.
* Format the message id to hex strings in the log message [#6961]
## v4.3.0~10
Older version changes are not tracked here.

View File

@ -3,11 +3,16 @@ REBAR_VERSION = 3.14.3-emqx-8
REBAR = $(CURDIR)/rebar3
BUILD = $(CURDIR)/build
SCRIPTS = $(CURDIR)/scripts
export EMQX_RELUP ?= true
export EMQX_DEFAULT_BUILDER = emqx/build-env:erl23.2.7.2-emqx-3-alpine
export EMQX_DEFAULT_RUNNER = alpine:3.12
export PKG_VSN ?= $(shell $(CURDIR)/pkg-vsn.sh)
export EMQX_DESC ?= EMQ X
export EMQX_CE_DASHBOARD_VERSION ?= v4.3.1
export DOCKERFILE := deploy/docker/Dockerfile
ifeq ($(OS),Windows_NT)
export REBAR_COLOR=none
FIND=/usr/bin/find
else
FIND=find
endif
PROFILE ?= emqx
@ -51,7 +56,7 @@ APPS=$(shell $(CURDIR)/scripts/find-apps.sh)
## app/name-ct targets are intended for local tests hence cover is not enabled
.PHONY: $(APPS:%=%-ct)
define gen-app-ct-target
$1-ct:
$1-ct: $(REBAR)
$(REBAR) ct --name 'test@127.0.0.1' -v --suite $(shell $(CURDIR)/scripts/find-suites.sh $1)
endef
$(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app))))
@ -85,16 +90,20 @@ $(REL_PROFILES:%=%): $(REBAR) get-dashboard
clean: $(PROFILES:%=clean-%)
$(PROFILES:%=clean-%):
@if [ -d _build/$(@:clean-%=%) ]; then \
rm rebar.lock \
rm -rf _build/$(@:clean-%=%)/rel; \
find _build/$(@:clean-%=%) -name '*.beam' -o -name '*.so' -o -name '*.app' -o -name '*.appup' -o -name '*.o' -o -name '*.d' -type f | xargs rm -f; \
$(FIND) _build/$(@:clean-%=%) -name '*.beam' -o -name '*.so' -o -name '*.app' -o -name '*.appup' -o -name '*.o' -o -name '*.d' -type f | xargs rm -f; \
$(FIND) _build/$(@:clean-%=%) -type l -delete; \
fi
.PHONY: clean-all
clean-all:
@rm -rf _build
@rm -f rebar.lock
.PHONY: deps-all
deps-all: $(REBAR) $(PROFILES:%=deps-%)
@make clean # ensure clean at the end
## deps-<profile> is used in CI scripts to download deps and the
## share downloads between CI steps and/or copied into containers
@ -102,6 +111,7 @@ deps-all: $(REBAR) $(PROFILES:%=deps-%)
.PHONY: $(PROFILES:%=deps-%)
$(PROFILES:%=deps-%): $(REBAR) get-dashboard
@$(REBAR) as $(@:deps-%=%) get-deps
@rm -f rebar.lock
.PHONY: xref
xref: $(REBAR)
@ -118,10 +128,19 @@ COMMON_DEPS := $(REBAR) get-dashboard $(CONF_SEGS)
$(REL_PROFILES:%=%-rel) $(PKG_PROFILES:%=%-rel): $(COMMON_DEPS)
@$(BUILD) $(subst -rel,,$(@)) rel
## download relup base packages
.PHONY: $(REL_PROFILES:%=%-relup-downloads)
define download-relup-packages
$1-relup-downloads:
@if [ "$${EMQX_RELUP}" = "true" ]; then $(CURDIR)/scripts/relup-base-packages.sh $1; fi
endef
ALL_ZIPS = $(REL_PROFILES)
$(foreach zt,$(ALL_ZIPS),$(eval $(call download-relup-packages,$(zt))))
## relup target is to create relup instructions
.PHONY: $(REL_PROFILES:%=%-relup)
define gen-relup-target
$1-relup: $(COMMON_DEPS)
$1-relup: $1-relup-downloads $(COMMON_DEPS)
@$(BUILD) $1 relup
endef
ALL_ZIPS = $(REL_PROFILES)
@ -144,11 +163,18 @@ $1: $1-rel
endef
$(foreach pt,$(PKG_PROFILES),$(eval $(call gen-pkg-target,$(pt))))
## docker target is to create docker instructions
.PHONY: $(REL_PROFILES:%=%-docker)
define gen-docker-target
$1-docker: $(COMMON_DEPS)
@$(BUILD) $1 docker
endef
ALL_ZIPS = $(REL_PROFILES)
$(foreach zt,$(ALL_ZIPS),$(eval $(call gen-docker-target,$(zt))))
.PHONY: run
run: $(PROFILE) quickrun
.PHONY: quickrun
quickrun:
./_build/$(PROFILE)/rel/emqx/bin/emqx console
include docker.mk

5
NOTICE Normal file
View File

@ -0,0 +1,5 @@
EMQX, a highly scalable, highly available distributed MQTT messaging broker for IoT.
Copyright (c) 2017-2021 EMQ Technologies Co., Ltd. All Rights Reserved.
This product contains code developed at EMQ Technologies Co., Ltd.
Visit https://www.emqx.come to learn more.

View File

@ -1,4 +1,4 @@
# EMQ X Broker
# EMQX Broker
[![GitHub Release](https://img.shields.io/github/release/emqx/emqx?color=brightgreen)](https://github.com/emqx/emqx/releases)
[![Build Status](https://travis-ci.org/emqx/emqx.svg)](https://travis-ci.org/emqx/emqx)
@ -13,20 +13,20 @@
[English](./README.md) | 简体中文 | [日本語](./README-JP.md) | [русский](./README-RU.md)
*EMQ X* 是一款完全开源,高度可伸缩,高可用的分布式 MQTT 消息服务器,适用于 IoT、M2M 和移动应用程序,可处理千万级别的并发客户端。
*EMQX* 是一款完全开源,高度可伸缩,高可用的分布式 MQTT 消息服务器,适用于 IoT、M2M 和移动应用程序,可处理千万级别的并发客户端。
从 3.0 版本开始,*EMQ X* 完整支持 MQTT V5.0 协议规范,向下兼容 MQTT V3.1 和 V3.1.1,并支持 MQTT-SN、CoAP、LwM2M、WebSocket 和 STOMP 等通信协议。EMQ X 3.0 单集群可支持千万级别的 MQTT 并发连接。
从 3.0 版本开始,*EMQX* 完整支持 MQTT V5.0 协议规范,向下兼容 MQTT V3.1 和 V3.1.1,并支持 MQTT-SN、CoAP、LwM2M、WebSocket 和 STOMP 等通信协议。EMQX 3.0 单集群可支持千万级别的 MQTT 并发连接。
- 新功能的完整列表,请参阅 [EMQ X Release Notes](https://github.com/emqx/emqx/releases)。
- 获取更多信息,请访问 [EMQ X 官网](https://www.emqx.cn/)。
- 新功能的完整列表,请参阅 [EMQX Release Notes](https://github.com/emqx/emqx/releases)。
- 获取更多信息,请访问 [EMQX 官网](https://www.emqx.cn/)。
## 安装
*EMQ X* 是跨平台的,支持 Linux、Unix、macOS 以及 Windows。这意味着 *EMQ X* 可以部署在 x86_64 架构的服务器上,也可以部署在 Raspberry Pi 这样的 ARM 设备上。
*EMQX* 是跨平台的,支持 Linux、Unix、macOS 以及 Windows。这意味着 *EMQX* 可以部署在 x86_64 架构的服务器上,也可以部署在 Raspberry Pi 这样的 ARM 设备上。
Windows 上编译和运行 *EMQ X* 的详情参考:[Windows.md](./Windows.md)
Windows 上编译和运行 *EMQX* 的详情参考:[Windows.md](./Windows.md)
#### EMQ X Docker 镜像安装
#### EMQX Docker 镜像安装
```
docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 emqx/emqx
@ -34,14 +34,14 @@ docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p
#### 二进制软件包安装
需从 [EMQ X 下载](https://www.emqx.cn/downloads) 页面获取相应操作系统的二进制软件包。
需从 [EMQX 下载](https://www.emqx.cn/downloads) 页面获取相应操作系统的二进制软件包。
- [单节点安装文档](https://docs.emqx.cn/broker/latest/getting-started/install.html)
- [集群配置文档](https://docs.emqx.cn/broker/latest/advanced/cluster.html)
## 从源码构建
3.0 版本开始,构建 *EMQ X* 需要 Erlang/OTP R21+。
3.0 版本开始,构建 *EMQX* 需要 Erlang/OTP R21+。
4.3 及以后的版本:
@ -77,7 +77,7 @@ _build/emqx/rel/emqx/bin/emqx console
./bin/emqx stop
```
*EMQ X* 启动,可以使用浏览器访问 http://localhost:18083 来查看 Dashboard。
*EMQX* 启动,可以使用浏览器访问 http://localhost:18083 来查看 Dashboard。
## 测试
@ -108,7 +108,7 @@ DIALYZER_ANALYSE_APP=emqx_lwm2m,emqx_auth_jwt,emqx_auth_ldap make dialyzer
### FAQ
访问 [EMQ X FAQ](https://docs.emqx.cn/broker/latest/faq/faq.html) 以获取常见问题的帮助。
访问 [EMQX FAQ](https://docs.emqx.cn/broker/latest/faq/faq.html) 以获取常见问题的帮助。
### 问答
@ -117,7 +117,7 @@ DIALYZER_ANALYSE_APP=emqx_lwm2m,emqx_auth_jwt,emqx_auth_ldap make dialyzer
### 参与设计
如果对 EMQ X 有改进建议,可以向[EIP](https://github.com/emqx/eip) 提交 PR 和 ISSUE
如果对 EMQX 有改进建议,可以向[EIP](https://github.com/emqx/eip) 提交 PR 和 ISSUE
### 插件开发

View File

@ -1,4 +1,4 @@
# EMQ X Broker
# EMQX Broker
[![GitHub Release](https://img.shields.io/github/release/emqx/emqx?color=brightgreen)](https://github.com/emqx/emqx/releases)
[![Build Status](https://travis-ci.org/emqx/emqx.svg)](https://travis-ci.org/emqx/emqx)
@ -12,22 +12,22 @@
[English](./README.md) | [简体中文](./README-CN.md) | 日本語 | [русский](./README-RU.md)
*EMQ X* は、高い拡張性と可用性をもつ、分散型のMQTTブローカーです。数千万のクライアントを同時に処理するIoT、M2M、モバイルアプリケーション向けです。
*EMQX* は、高い拡張性と可用性をもつ、分散型のMQTTブローカーです。数千万のクライアントを同時に処理するIoT、M2M、モバイルアプリケーション向けです。
version 3.0 以降、*EMQ X* は MQTT V5.0 の仕様を完全にサポートしており、MQTT V3.1およびV3.1.1とも下位互換性があります。
version 3.0 以降、*EMQX* は MQTT V5.0 の仕様を完全にサポートしており、MQTT V3.1およびV3.1.1とも下位互換性があります。
MQTT-SN、CoAP、LwM2M、WebSocket、STOMPなどの通信プロトコルをサポートしています。 MQTTの同時接続数は1つのクラスター上で1,000万以上にまでスケールできます。
- 新機能の一覧については、[EMQ Xリリースート](https://github.com/emqx/emqx/releases)を参照してください。
- 詳細はこちら[EMQ X公式ウェブサイト](https://www.emqx.io/)をご覧ください。
- 新機能の一覧については、[EMQXリリースート](https://github.com/emqx/emqx/releases)を参照してください。
- 詳細はこちら[EMQX公式ウェブサイト](https://www.emqx.io/)をご覧ください。
## インストール
*EMQ X* はクロスプラットフォームで、Linux、Unix、macOS、Windowsをサポートしています。
そのため、x86_64アーキテクチャサーバー、またはRaspberryPiなどのARMデバイスに *EMQ X* をデプロイすることもできます。
*EMQX* はクロスプラットフォームで、Linux、Unix、macOS、Windowsをサポートしています。
そのため、x86_64アーキテクチャサーバー、またはRaspberryPiなどのARMデバイスに *EMQX* をデプロイすることもできます。
Windows上における *EMQ X* のビルドと実行については、[Windows.md](./Windows.md)をご参照ください。
Windows上における *EMQX* のビルドと実行については、[Windows.md](./Windows.md)をご参照ください。
#### Docker イメージによる EMQ X のインストール
#### Docker イメージによる EMQX のインストール
```
docker run -d --name emqx -p 1883:1883 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 emqx/emqx
@ -35,14 +35,14 @@ docker run -d --name emqx -p 1883:1883 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p
#### バイナリパッケージによるインストール
それぞれのOSに対応したバイナリソフトウェアパッケージは、[EMQ Xのダウンロード](https://www.emqx.io/downloads)ページから取得できます。
それぞれのOSに対応したバイナリソフトウェアパッケージは、[EMQXのダウンロード](https://www.emqx.io/downloads)ページから取得できます。
- [シングルノードインストール](https://docs.emqx.io/broker/latest/en/getting-started/installation.html)
- [マルチノードインストール](https://docs.emqx.io/broker/latest/en/advanced/cluster.html)
## ソースからビルド
version 3.0 以降の *EMQ X* をビルドするには Erlang/OTP R21+ が必要です。
version 3.0 以降の *EMQX* をビルドするには Erlang/OTP R21+ が必要です。
version 4.3 以降の場合:
@ -71,7 +71,7 @@ emqx をソースコードからビルドした場合は、
./bin/emqx stop
```
*EMQ X* の起動後、ブラウザで http://localhost:18083 にアクセスするとダッシュボードが表示されます。
*EMQX* の起動後、ブラウザで http://localhost:18083 にアクセスするとダッシュボードが表示されます。
## テスト
@ -102,7 +102,7 @@ DIALYZER_ANALYSE_APP=emqx_lwm2m,emqx_auth_jwt,emqx_auth_ldap make dialyzer
### FAQ
よくある質問については、[EMQ X FAQ](https://docs.emqx.io/broker/latest/en/faq/faq.html)をご確認ください。
よくある質問については、[EMQX FAQ](https://docs.emqx.io/broker/latest/en/faq/faq.html)をご確認ください。
### 質問する

View File

@ -1,4 +1,4 @@
# Брокер EMQ X
# Брокер EMQX
[![GitHub Release](https://img.shields.io/github/release/emqx/emqx?color=brightgreen)](https://github.com/emqx/emqx/releases)
[![Build Status](https://travis-ci.org/emqx/emqx.svg)](https://travis-ci.org/emqx/emqx)
@ -13,20 +13,20 @@
[English](./README.md) | [简体中文](./README-CN.md) | [日本語](./README-JP.md) | русский
*EMQ X* — это масштабируемый, высоко доступный, распределённый MQTT брокер с полностью открытым кодом для интернета вещей, межмашинного взаимодействия и мобильных приложений, который поддерживает миллионы одновременных подключений.
*EMQX* — это масштабируемый, высоко доступный, распределённый MQTT брокер с полностью открытым кодом для интернета вещей, межмашинного взаимодействия и мобильных приложений, который поддерживает миллионы одновременных подключений.
Начиная с релиза 3.0, брокер *EMQ X* полностью поддерживает протокол MQTT версии 5.0, и обратно совместим с версиями 3.1 и 3.1.1, а также протоколами MQTT-SN, CoAP, LwM2M, WebSocket и STOMP. Начиная с релиза 3.0, брокер *EMQ X* может масштабироваться до более чем 10 миллионов одновременных MQTT соединений на один кластер.
Начиная с релиза 3.0, брокер *EMQX* полностью поддерживает протокол MQTT версии 5.0, и обратно совместим с версиями 3.1 и 3.1.1, а также протоколами MQTT-SN, CoAP, LwM2M, WebSocket и STOMP. Начиная с релиза 3.0, брокер *EMQX* может масштабироваться до более чем 10 миллионов одновременных MQTT соединений на один кластер.
- Полный список возможностей доступен по ссылке: [EMQ X Release Notes](https://github.com/emqx/emqx/releases).
- Более подробная информация доступна на нашем сайте: [EMQ X homepage](https://www.emqx.io).
- Полный список возможностей доступен по ссылке: [EMQX Release Notes](https://github.com/emqx/emqx/releases).
- Более подробная информация доступна на нашем сайте: [EMQX homepage](https://www.emqx.io).
## Установка
Брокер *EMQ X* кросплатформенный, и поддерживает Linux, Unix, macOS и Windows. Он может работать на серверах с архитектурой x86_64 и устройствах на архитектуре ARM, таких как Raspberry Pi.
Брокер *EMQX* кросплатформенный, и поддерживает Linux, Unix, macOS и Windows. Он может работать на серверах с архитектурой x86_64 и устройствах на архитектуре ARM, таких как Raspberry Pi.
Более подробная информация о запуске на Windows по ссылке: [Windows.md](./Windows.md)
#### Установка EMQ X с помощью Docker-образа
#### Установка EMQX с помощью Docker-образа
```
docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 emqx/emqx
@ -34,7 +34,7 @@ docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p
#### Установка бинарного пакета
Сборки для различных операционных систем: [Загрузить EMQ X](https://www.emqx.io/downloads).
Сборки для различных операционных систем: [Загрузить EMQX](https://www.emqx.io/downloads).
- [Установка на одном сервере](https://docs.emqx.io/en/broker/latest/getting-started/install.html)
- [Установка на кластере](https://docs.emqx.io/en/broker/latest/advanced/cluster.html)
@ -111,7 +111,7 @@ DIALYZER_ANALYSE_APP=emqx_lwm2m,emqx_auth_jwt,emqx_auth_ldap make dialyzer
### FAQ
Наиболее частые проблемы разобраны в [EMQ X FAQ](https://docs.emqx.io/en/broker/latest/faq/faq.html).
Наиболее частые проблемы разобраны в [EMQX FAQ](https://docs.emqx.io/en/broker/latest/faq/faq.html).
### Вопросы

View File

@ -1,4 +1,4 @@
# EMQ X Broker
# EMQX Broker
[![GitHub Release](https://img.shields.io/github/release/emqx/emqx?color=brightgreen)](https://github.com/emqx/emqx/releases)
[![Build Status](https://travis-ci.org/emqx/emqx.svg)](https://travis-ci.org/emqx/emqx)
@ -12,20 +12,20 @@
English | [简体中文](./README-CN.md) | [日本語](./README-JP.md) | [русский](./README-RU.md)
*EMQ X* broker is a fully open source, highly scalable, highly available distributed MQTT messaging broker for IoT, M2M and Mobile applications that can handle tens of millions of concurrent clients.
*EMQX* broker is a fully open source, highly scalable, highly available distributed MQTT messaging broker for IoT, M2M and Mobile applications that can handle tens of millions of concurrent clients.
Starting from 3.0 release, *EMQ X* broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1, as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the *EMQ X* broker can scaled to 10+ million concurrent MQTT connections on one cluster.
Starting from 3.0 release, *EMQX* broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1, as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the *EMQX* broker can scaled to 10+ million concurrent MQTT connections on one cluster.
- For full list of new features, please read [EMQ X Release Notes](https://github.com/emqx/emqx/releases).
- For more information, please visit [EMQ X homepage](https://www.emqx.io).
- For full list of new features, please read [EMQX Release Notes](https://github.com/emqx/emqx/releases).
- For more information, please visit [EMQX homepage](https://www.emqx.io).
## Installation
The *EMQ X* broker is cross-platform, which supports Linux, Unix, macOS and Windows. It means *EMQ X* can be deployed on x86_64 architecture servers and ARM devices like Raspberry Pi.
The *EMQX* broker is cross-platform, which supports Linux, Unix, macOS and Windows. It means *EMQX* can be deployed on x86_64 architecture servers and ARM devices like Raspberry Pi.
See more details for building and running *EMQ X* on Windows in [Windows.md](./Windows.md)
See more details for building and running *EMQX* on Windows in [Windows.md](./Windows.md)
#### Installing via EMQ X Docker Image
#### Installing via EMQX Docker Image
```
docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 emqx/emqx
@ -33,7 +33,7 @@ docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p
#### Installing via Binary Package
Get the binary package of the corresponding OS from [EMQ X Download](https://www.emqx.io/downloads) page.
Get the binary package of the corresponding OS from [EMQX Download](https://www.emqx.io/downloads) page.
- [Single Node Install](https://docs.emqx.io/en/broker/latest/getting-started/install.html)
- [Multi Node Install](https://docs.emqx.io/en/broker/latest/advanced/cluster.html)
@ -41,7 +41,7 @@ Get the binary package of the corresponding OS from [EMQ X Download](https://www
## Build From Source
The *EMQ X* broker requires Erlang/OTP R21+ to build since 3.0 release.
The *EMQX* broker requires Erlang/OTP R21+ to build since 3.0 release.
For 4.3 and later versions.
@ -110,7 +110,7 @@ DIALYZER_ANALYSE_APP=emqx_lwm2m,emqx_auth_jwt,emqx_auth_ldap make dialyzer
### FAQ
Visiting [EMQ X FAQ](https://docs.emqx.io/en/broker/latest/faq/faq.html) to get help of common problems.
Visiting [EMQX FAQ](https://docs.emqx.io/en/broker/latest/faq/faq.html) to get help of common problems.
### Questions

View File

@ -1,4 +1,4 @@
# Build and run EMQ X on Windows
# Build and run EMQX on Windows
NOTE: The instructions and examples are based on Windows 10.
@ -6,7 +6,7 @@ NOTE: The instructions and examples are based on Windows 10.
### Visual studio for C/C++ compile and link
EMQ X includes Erlang NIF (Native Implmented Function) components, implemented
EMQX includes Erlang NIF (Native Implmented Function) components, implemented
in C/C++. To compile and link C/C++ libraries, the easiest way is perhaps to
install Visual Studio.
@ -25,17 +25,17 @@ C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
Depending on your visual studio version and OS, the paths may differ.
The first path is for rebar3 port compiler to find `cl.exe` and `link.exe`
The second path is for Powershell or CMD to setup environment variables.
The second path is for CMD to setup environment variables.
### Erlang/OTP
Install Erlang/OTP 23.2 from https://www.erlang.org/downloads
You may need to edit the `Path` environment variable to allow running
Erlang commands such as `erl` from powershell.
Erlang commands such as `erl` from CMD.
To validate Erlang installation in CMD or powershell:
To validate Erlang installation in CMD :
* Start (or restart) CMD or powershell
* Start (or restart) CMD
* Execute `erl` command to enter Erlang shell
@ -51,7 +51,7 @@ Eshell V11.1.4 (abort with ^G)
### bash
All EMQ X build/run scripts are either in `bash` or `escript`.
All EMQX build/run scripts are either in `bash` or `escript`.
`escript` is installed as a part of Erlang. To install a `bash`
environment in Windows, there are quite a few options.
@ -63,12 +63,12 @@ Cygwin is what we tested with.
to `Path` list.
* Validate installation.
Start (restart) CMD or powershell console and execute `which bash`, it should
Start (restart) CMD console and execute `which bash`, it should
print out `/usr/bin/bash`
### Other tools
Some of the unix world tools are required to build EMQ X. Including:
Some of the unix world tools are required to build EMQX. Including:
* git
* curl
@ -84,11 +84,11 @@ When using scoop:
scoop install git curl make jq zip unzip
```
## Build EMQ X source code
## Build EMQX source code
* Clone the repo: `git clone https://github.com/emqx/emqx.git`
* Start CMD or Powershell
* Start CMD
* Execute `vcvarsall.bat x86_amd64` to load environment variables
@ -112,11 +112,11 @@ scoop install git curl make jq zip unzip
To fix it, Visual Studio's bin paths should be ordered prior to Cygwin's (or similar installation's)
bin paths in `Path` environment variable.
## Run EMQ X
## Run EMQX
To start EMQ X broker.
To start EMQX broker.
Execute `_build\emqx\rel\emqx>.\bin\emqx console` or `_build\emqx\rel\emqx>.\bin\emqx start` to start EMQ X.
Execute `_build\emqx\rel\emqx>.\bin\emqx console` or `_build\emqx\rel\emqx>.\bin\emqx start` to start EMQX.
Then execute `_build\emqx\rel\emqx>.\bin\emqx_ctl status` to check status.
If everything works fine, it should print out

View File

@ -1,7 +1,7 @@
emqx_auth_http
==============
EMQ X HTTP Auth/ACL Plugin
EMQX HTTP Auth/ACL Plugin
Build
-----
@ -96,5 +96,5 @@ Apache License Version 2.0
Author
------
EMQ X Team.
EMQX Team.

View File

@ -42,18 +42,18 @@ auth.http.auth_req.params = clientid=%c,username=%u,password=%P
## Value: URL
##
## Examples: http://127.0.0.1:80/mqtt/superuser, https://[::1]:80/mqtt/superuser
auth.http.super_req.url = http://127.0.0.1:80/mqtt/superuser
# auth.http.super_req.url = http://127.0.0.1:80/mqtt/superuser
## HTTP Request Method for SuperUser Request
##
## Value: post | get
auth.http.super_req.method = post
# auth.http.super_req.method = post
## HTTP Request Headers for SuperUser Request, Content-Type header is configured by default.
## The possible values of the Content-Type header: application/x-www-form-urlencoded, application/json
##
## Examples: auth.http.super_req.headers.accept = */*
auth.http.super_req.headers.content-type = application/x-www-form-urlencoded
# auth.http.super_req.headers.content-type = application/x-www-form-urlencoded
## Parameters used to construct the request body or query string parameters
## When the request method is GET, these parameters will be converted into query string parameters
@ -70,7 +70,7 @@ auth.http.super_req.headers.content-type = application/x-www-form-urlencoded
## - %d: subject of client TLS cert
##
## Value: <K1>=<V1>,<K2>=<V2>,...
auth.http.super_req.params = clientid=%c,username=%u
# auth.http.super_req.params = clientid=%c,username=%u
## HTTP URL API path for ACL Request
## Comment out this config to disable ACL checks
@ -136,6 +136,11 @@ auth.http.connect_timeout = 5s
## Value: Number
auth.http.pool_size = 32
## Whether to enable HTTP Pipelining
##
## See: https://en.wikipedia.org/wiki/HTTP_pipelining
auth.http.enable_pipelining = true
##------------------------------------------------------------------------------
## SSL options
@ -163,7 +168,7 @@ auth.http.pool_size = 32
## If not specified, the server's names returned in server's certificate is validated against
## what's provided `auth.http.auth_req.url` config's host part.
## Setting to 'disable' will make EMQ X ignore unmatched server names.
## Setting to 'disable' will make EMQX ignore unmatched server names.
## If set with a host name, the server's names returned in server's certificate is validated
## against this value.
##

View File

@ -7,17 +7,8 @@
ignore = 'client.auth.ignore'
}).
-record(acl_metrics, {
allow = 'client.acl.allow',
deny = 'client.acl.deny',
ignore = 'client.acl.ignore'
}).
-define(METRICS(Type), tl(tuple_to_list(#Type{}))).
-define(METRICS(Type, K), #Type{}#Type.K).
-define(AUTH_METRICS, ?METRICS(auth_metrics)).
-define(AUTH_METRICS(K), ?METRICS(auth_metrics, K)).
-define(ACL_METRICS, ?METRICS(acl_metrics)).
-define(ACL_METRICS(K), ?METRICS(acl_metrics, K)).

View File

@ -109,6 +109,11 @@ end}.
{datatype, integer}
]}.
{mapping, "auth.http.enable_pipelining", "emqx_auth_http.enable_pipelining", [
{default, true},
{datatype, {enum, [true, false]}}
]}.
{mapping, "auth.http.ssl.cacertfile", "emqx_auth_http.cacertfile", [
{datatype, string}
]}.

View File

@ -29,26 +29,17 @@
]).
%% ACL callbacks
-export([ register_metrics/0
, check_acl/5
-export([ check_acl/5
, description/0
]).
-spec(register_metrics() -> ok).
register_metrics() ->
lists:foreach(fun emqx_metrics:ensure/1, ?ACL_METRICS).
%%--------------------------------------------------------------------
%% ACL callbacks
%%--------------------------------------------------------------------
check_acl(ClientInfo, PubSub, Topic, AclResult, Params) ->
return_with(fun inc_metrics/1,
do_check_acl(ClientInfo, PubSub, Topic, AclResult, Params)).
do_check_acl(#{username := <<$$, _/binary>>}, _PubSub, _Topic, _AclResult, _Params) ->
check_acl(#{username := <<$$, _/binary>>}, _PubSub, _Topic, _AclResult, _Params) ->
ok;
do_check_acl(ClientInfo, PubSub, Topic, _AclResult, #{acl := ACLParams = #{path := Path}}) ->
check_acl(ClientInfo, PubSub, Topic, _AclResult, #{acl := ACLParams = #{path := Path}}) ->
ClientInfo1 = ClientInfo#{access => access(PubSub), topic => Topic},
case check_acl_request(ACLParams, ClientInfo1) of
{ok, 200, <<"ignore">>} -> ok;
@ -65,16 +56,6 @@ description() -> "ACL with HTTP API".
%% Internal functions
%%--------------------------------------------------------------------
inc_metrics(ok) ->
emqx_metrics:inc(?ACL_METRICS(ignore));
inc_metrics({stop, allow}) ->
emqx_metrics:inc(?ACL_METRICS(allow));
inc_metrics({stop, deny}) ->
emqx_metrics:inc(?ACL_METRICS(deny)).
return_with(Fun, Result) ->
Fun(Result), Result.
check_acl_request(#{pool_name := PoolName,
path := Path,
method := Method,

View File

@ -1,6 +1,6 @@
{application, emqx_auth_http,
[{description, "EMQ X Authentication/ACL with HTTP API"},
{vsn, "4.3.0"}, % strict semver, bump manually!
{vsn, "4.3.5"}, % strict semver, bump manually!
{modules, []},
{registered, [emqx_auth_http_sup]},
{applications, [kernel,stdlib,ehttpc]},

View File

@ -0,0 +1,29 @@
%% -*- mode: erlang -*-
{VSN,
[{"4.3.4",
[{load_module,emqx_auth_http_app,brutal_purge,soft_purge,[]}
]},
{"4.3.3",
[{load_module,emqx_auth_http_app,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_http,brutal_purge,soft_purge,[]}]},
{"4.3.2",
[{apply,{application,stop,[emqx_auth_http]}},
{load_module,emqx_auth_http_app,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_http,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_http_cli,brutal_purge,soft_purge,[]}]},
{<<"4.3.[0-1]">>,
[{restart_application,emqx_auth_http}]},
{<<".*">>,[]}],
[{"4.3.4",
[{load_module,emqx_auth_http_app,brutal_purge,soft_purge,[]}]},
{"4.3.3",
[{load_module,emqx_auth_http_app,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_http,brutal_purge,soft_purge,[]}]},
{"4.3.2",
[{apply,{application,stop,[emqx_auth_http]}},
{load_module,emqx_auth_http_app,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_http,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_http_cli,brutal_purge,soft_purge,[]}]},
{<<"4.3.[0-1]">>,
[{restart_application,emqx_auth_http}]},
{<<".*">>,[]}]}.

View File

@ -50,14 +50,14 @@ translate_env(EnvName) ->
case application:get_env(?APP, EnvName) of
undefined -> ok;
{ok, Req} ->
{ok, EnablePipelining} = application:get_env(?APP, enable_pipelining),
{ok, PoolSize} = application:get_env(?APP, pool_size),
{ok, ConnectTimeout} = application:get_env(?APP, connect_timeout),
URL = proplists:get_value(url, Req),
{ok, #{host := Host,
path := Path0,
port := Port,
scheme := Scheme}} = emqx_http_lib:uri_parse(URL),
Path = path(Path0),
scheme := Scheme} = URIMap} = emqx_http_lib:uri_parse(URL),
Path = path(URIMap),
MoreOpts = case Scheme of
http ->
[{transport_opts, emqx_misc:ipv6_probe([])}];
@ -71,6 +71,7 @@ translate_env(EnvName) ->
end,
SNI = case application:get_env(?APP, server_name_indication, undefined) of
"disable" -> disable;
"" -> undefined;
SNI0 -> SNI0
end,
TLSOpts = lists:filter(
@ -89,6 +90,7 @@ translate_env(EnvName) ->
end,
PoolOpts = [{host, Host},
{port, Port},
{enable_pipelining, EnablePipelining},
{pool_size, PoolSize},
{pool_type, random},
{connect_timeout, ConnectTimeout},
@ -129,7 +131,6 @@ load_hooks() ->
case application:get_env(?APP, acl_req) of
undefined -> ok;
{ok, ACLReq} ->
ok = emqx_acl_http:register_metrics(),
PoolOpts2 = proplists:get_value(pool_opts, ACLReq),
PoolName2 = proplists:get_value(pool_name, ACLReq),
{ok, _} = ehttpc_sup:start_pool(PoolName2, PoolOpts2),
@ -149,10 +150,14 @@ ensure_content_type_header(Method, Headers)
when Method =:= post orelse Method =:= put ->
Headers;
ensure_content_type_header(_Method, Headers) ->
lists:keydelete("content-type", 1, Headers).
lists:keydelete(<<"content-type">>, 1, Headers).
path("") ->
path(#{path := "", 'query' := Query}) ->
"?" ++ Query;
path(#{path := Path, 'query' := Query}) ->
Path ++ "?" ++ Query;
path(#{path := ""}) ->
"/";
path(Path) ->
path(#{path := Path}) ->
Path.

View File

@ -29,16 +29,16 @@
request(PoolName, get, Path, Headers, Params, Timeout) ->
NewPath = Path ++ "?" ++ binary_to_list(cow_qs:qs(bin_kw(Params))),
reply(ehttpc:request(ehttpc_pool:pick_worker(PoolName), get, {NewPath, Headers}, Timeout));
reply(ehttpc:request(PoolName, get, {NewPath, Headers}, Timeout));
request(PoolName, post, Path, Headers, Params, Timeout) ->
Body = case proplists:get_value("content-type", Headers) of
Body = case proplists:get_value(<<"content-type">>, Headers) of
"application/x-www-form-urlencoded" ->
cow_qs:qs(bin_kw(Params));
"application/json" ->
emqx_json:encode(bin_kw(Params))
end,
reply(ehttpc:request(ehttpc_pool:pick_worker(PoolName), post, {Path, Headers, Body}, Timeout)).
reply(ehttpc:request(PoolName, post, {Path, Headers, Body}, Timeout)).
reply({ok, StatusCode, _Headers}) ->
{ok, StatusCode, <<>>};

View File

@ -1,7 +1,7 @@
# emqx-auth-jwt
EMQ X JWT Authentication Plugin
EMQX JWT Authentication Plugin
Build
-----
@ -87,4 +87,4 @@ Apache License Version 2.0
Author
------
EMQ X Team.
EMQX Team.

View File

@ -1,6 +1,6 @@
{application, emqx_auth_jwt,
[{description, "EMQ X Authentication with JWT"},
{vsn, "4.3.1"}, % strict semver, bump manually!
{vsn, "4.3.2"}, % strict semver, bump manually!
{modules, []},
{registered, [emqx_auth_jwt_sup]},
{applications, [kernel,stdlib,jose]},

View File

@ -1,13 +1,13 @@
%% -*-: erlang -*-
{VSN,
[
{"4.3.0", [
{<<"4\\.3\\.[0-1]">>, [
{load_module, emqx_auth_jwt_svr, brutal_purge, soft_purge, []}
]},
{<<".*">>, []}
],
[
{"4.3.0", [
{<<"4\\.3\\.[0-1]">>, [
{load_module, emqx_auth_jwt_svr, brutal_purge, soft_purge, []}
]},
{<<".*">>, []}

View File

@ -91,7 +91,7 @@ do_init_jwks(Options) ->
[K, V, Reason]),
undefined;
J -> J
catch T:R:_ ->
catch T:R ->
?LOG(warning, "Build ~p JWK ~p failed: {~p, ~p}~n",
[K, V, T, R]),
undefined

View File

@ -1,7 +1,7 @@
emqx_auth_ldap
==============
EMQ X LDAP Authentication Plugin
EMQX LDAP Authentication Plugin
Build
-----
@ -92,5 +92,5 @@ Apache License Version 2.0
Author
------
EMQ X Team.
EMQX Team.

View File

@ -7,17 +7,8 @@
ignore = 'client.auth.ignore'
}).
-record(acl_metrics, {
allow = 'client.acl.allow',
deny = 'client.acl.deny',
ignore = 'client.acl.ignore'
}).
-define(METRICS(Type), tl(tuple_to_list(#Type{}))).
-define(METRICS(Type, K), #Type{}#Type.K).
-define(AUTH_METRICS, ?METRICS(auth_metrics)).
-define(AUTH_METRICS(K), ?METRICS(auth_metrics, K)).
-define(ACL_METRICS, ?METRICS(acl_metrics)).
-define(ACL_METRICS(K), ?METRICS(acl_metrics, K)).

View File

@ -73,6 +73,7 @@
{verify, cuttlefish:conf_get("auth.ldap.ssl.verify", Conf, undefined)},
{server_name_indication, case cuttlefish:conf_get("auth.ldap.ssl.server_name_indication", Conf, undefined) of
"disable" -> disable;
"" -> undefined;
SNI -> SNI
end}]
end,

View File

@ -22,24 +22,15 @@
-include_lib("eldap/include/eldap.hrl").
-include_lib("emqx/include/logger.hrl").
-export([ register_metrics/0
, check_acl/5
-export([ check_acl/5
, description/0
]).
-import(proplists, [get_value/2]).
-import(emqx_auth_ldap_cli, [search/4]).
-spec(register_metrics() -> ok).
register_metrics() ->
lists:foreach(fun emqx_metrics:ensure/1, ?ACL_METRICS).
check_acl(ClientInfo, PubSub, Topic, NoMatchAction, State) ->
case do_check_acl(ClientInfo, PubSub, Topic, NoMatchAction, State) of
ok -> emqx_metrics:inc(?ACL_METRICS(ignore)), ok;
{stop, allow} -> emqx_metrics:inc(?ACL_METRICS(allow)), {stop, allow};
{stop, deny} -> emqx_metrics:inc(?ACL_METRICS(deny)), {stop, deny}
ok -> ok;
{stop, allow} -> {stop, allow};
{stop, deny} -> {stop, deny}
end.
do_check_acl(#{username := <<$$, _/binary>>}, _PubSub, _Topic, _NoMatchAction, _State) ->
@ -70,14 +61,14 @@ do_check_acl(#{username := Username}, PubSub, Topic, _NoMatchAction,
BaseDN = emqx_auth_ldap:replace_vars(CustomBaseDN, ReplaceRules),
case search(Pool, BaseDN, Filter, [Attribute, Attribute1]) of
case emqx_auth_ldap_cli:search(Pool, BaseDN, Filter, [Attribute, Attribute1]) of
{error, noSuchObject} ->
ok;
{ok, #eldap_search_result{entries = []}} ->
ok;
{ok, #eldap_search_result{entries = [Entry]}} ->
Topics = get_value(Attribute, Entry#eldap_entry.attributes)
++ get_value(Attribute1, Entry#eldap_entry.attributes),
Topics = proplists:get_value(Attribute, Entry#eldap_entry.attributes, [])
++ proplists:get_value(Attribute1, Entry#eldap_entry.attributes, []),
match(Topic, Topics);
Error ->
?LOG(error, "[LDAP] search error:~p", [Error]),
@ -95,4 +86,3 @@ match(Topic, [Filter | Topics]) ->
description() ->
"ACL with LDAP".

View File

@ -1,6 +1,6 @@
{application, emqx_auth_ldap,
[{description, "EMQ X Authentication/ACL with LDAP"},
{vsn, "4.3.0"}, % strict semver, bump manually!
{vsn, "4.3.4"}, % strict semver, bump manually!
{modules, []},
{registered, [emqx_auth_ldap_sup]},
{applications, [kernel,stdlib,eldap2,ecpool]},

View File

@ -0,0 +1,40 @@
%% -*-: erlang -*-
{VSN,
[ {"4.3.3", [
%% There are only changes to the schema file, so we don't need
%% any commands here.
]},
{"4.3.0",
[ {load_module, emqx_acl_ldap, brutal_purge, soft_purge, []}
, {load_module, emqx_auth_ldap_cli, brutal_purge, soft_purge, []}
, {load_module, emqx_auth_ldap_app, brutal_purge, soft_purge, []}
]},
{"4.3.1",
[ {load_module, emqx_auth_ldap_cli, brutal_purge, soft_purge, []}
, {load_module, emqx_acl_ldap, brutal_purge, soft_purge, []}
, {load_module, emqx_auth_ldap_app, brutal_purge, soft_purge, []}
]},
{"4.3.2",
[ {load_module, emqx_acl_ldap, brutal_purge, soft_purge, []}
, {load_module, emqx_auth_ldap_app, brutal_purge, soft_purge, []}
]},
{<<".*">>, []}
],
[ {"4.3.3", []},
{"4.3.0",
[ {load_module, emqx_acl_ldap, brutal_purge, soft_purge, []}
, {load_module, emqx_auth_ldap_cli, brutal_purge, soft_purge, []}
, {load_module, emqx_auth_ldap_app, brutal_purge, soft_purge, []}
]},
{"4.3.1",
[ {load_module, emqx_auth_ldap_cli, brutal_purge, soft_purge, []}
, {load_module, emqx_acl_ldap, brutal_purge, soft_purge, []}
, {load_module, emqx_auth_ldap_app, brutal_purge, soft_purge, []}
]},
{"4.3.2",
[ {load_module, emqx_acl_ldap, brutal_purge, soft_purge, []}
, {load_module, emqx_auth_ldap_app, brutal_purge, soft_purge, []}
]},
{<<".*">>, []}
]
}.

View File

@ -54,7 +54,6 @@ load_auth_hook(DeviceDn) ->
emqx:hook('client.authenticate', fun emqx_auth_ldap:check/3, [Params#{pool => ?APP}]).
load_acl_hook(DeviceDn) ->
ok = emqx_acl_ldap:register_metrics(),
Params = maps:from_list(DeviceDn),
emqx:hook('client.check_acl', fun emqx_acl_ldap:check_acl/5 , [Params#{pool => ?APP}]).

View File

@ -76,8 +76,8 @@ connect(Opts) ->
search(Pool, Base, Filter) ->
ecpool:with_client(Pool,
fun(C) ->
case application:get_env(?APP, bind_as_user) of
{ok, true} ->
case application:get_env(?APP, bind_as_user, false) of
true ->
{ok, Opts} = application:get_env(?APP, ldap),
BindDn = get_value(bind_dn, Opts),
BindPassword = get_value(bind_password, Opts),
@ -91,7 +91,7 @@ search(Pool, Base, Filter) ->
catch
error:Reason -> {error, Reason}
end;
{ok, false} ->
false ->
eldap2:search(C, [{base, Base},
{filter, Filter},
{deref, eldap2:derefFindingBaseObj()}])
@ -101,8 +101,8 @@ search(Pool, Base, Filter) ->
search(Pool, Base, Filter, Attributes) ->
ecpool:with_client(Pool,
fun(C) ->
case application:get_env(?APP, bind_as_user) of
{ok, true} ->
case application:get_env(?APP, bind_as_user, false) of
true ->
{ok, Opts} = application:get_env(?APP, ldap),
BindDn = get_value(bind_dn, Opts),
BindPassword = get_value(bind_password, Opts),
@ -117,7 +117,7 @@ search(Pool, Base, Filter, Attributes) ->
catch
error:Reason -> {error, Reason}
end;
{ok, false} ->
false ->
eldap2:search(C, [{base, Base},
{filter, Filter},
{attributes, Attributes},

View File

@ -1,38 +1,55 @@
-define(APP, emqx_auth_mnesia).
-type(login():: {clientid, binary()}
-type(login() :: {clientid, binary()}
| {username, binary()}).
-type(acl_target() :: login() | all).
-type(acl_target_type() :: clientid | username | all).
-type(access():: allow | deny).
-type(action():: pub | sub).
-type(legacy_action():: action() | pubsub).
-type(created_at():: integer()).
-record(emqx_user, {
login :: login(),
password :: binary(),
created_at :: integer()
created_at :: created_at()
}).
-record(emqx_acl, {
filter:: {login() | all, emqx_topic:topic()},
action :: pub | sub | pubsub,
access :: allow | deny,
created_at :: integer()
-define(ACL_TABLE, emqx_acl).
-define(MIGRATION_MARK_KEY, emqx_acl2_migration_started).
-record(?ACL_TABLE, {
filter :: {acl_target(), emqx_topic:topic()} | ?MIGRATION_MARK_KEY,
action :: legacy_action(),
access :: access(),
created_at :: created_at()
}).
-define(MIGRATION_MARK_RECORD, #?ACL_TABLE{filter = ?MIGRATION_MARK_KEY, action = pub, access = deny, created_at = 0}).
-type(rule() :: {access(), action(), emqx_topic:topic(), created_at()}).
-define(ACL_TABLE2, emqx_acl2).
-record(?ACL_TABLE2, {
who :: acl_target(),
rules :: [ rule() ]
}).
-type(acl_record() :: {acl_target(), emqx_topic:topic(), action(), access(), created_at()}).
-record(auth_metrics, {
success = 'client.auth.success',
failure = 'client.auth.failure',
ignore = 'client.auth.ignore'
}).
-record(acl_metrics, {
allow = 'client.acl.allow',
deny = 'client.acl.deny',
ignore = 'client.acl.ignore'
}).
-define(METRICS(Type), tl(tuple_to_list(#Type{}))).
-define(METRICS(Type, K), #Type{}#Type.K).
-define(AUTH_METRICS, ?METRICS(auth_metrics)).
-define(AUTH_METRICS(K), ?METRICS(auth_metrics, K)).
-define(ACL_METRICS, ?METRICS(acl_metrics)).
-define(ACL_METRICS(K), ?METRICS(acl_metrics, K)).

View File

@ -18,51 +18,35 @@
-include("emqx_auth_mnesia.hrl").
-include_lib("stdlib/include/ms_transform.hrl").
-define(TABLE, emqx_acl).
%% ACL Callbacks
-export([ init/0
, register_metrics/0
, check_acl/5
, description/0
]).
]).
init() ->
ok = ekka_mnesia:create_table(emqx_acl, [
{type, bag},
{disc_copies, [node()]},
{attributes, record_info(fields, emqx_acl)},
{storage_properties, [{ets, [{read_concurrency, true}]}]}]),
ok = ekka_mnesia:copy_table(emqx_acl, disc_copies).
-spec(register_metrics() -> ok).
register_metrics() ->
lists:foreach(fun emqx_metrics:ensure/1, ?ACL_METRICS).
ok = emqx_acl_mnesia_db:create_table(),
ok = emqx_acl_mnesia_db:create_table2().
check_acl(ClientInfo = #{ clientid := Clientid }, PubSub, Topic, _NoMatchAction, _Params) ->
Username = maps:get(username, ClientInfo, undefined),
Acls = case Username of
undefined ->
emqx_acl_mnesia_cli:lookup_acl({clientid, Clientid}) ++
emqx_acl_mnesia_cli:lookup_acl(all);
emqx_acl_mnesia_db:lookup_acl({clientid, Clientid}) ++
emqx_acl_mnesia_db:lookup_acl(all);
_ ->
emqx_acl_mnesia_cli:lookup_acl({clientid, Clientid}) ++
emqx_acl_mnesia_cli:lookup_acl({username, Username}) ++
emqx_acl_mnesia_cli:lookup_acl(all)
emqx_acl_mnesia_db:lookup_acl({clientid, Clientid}) ++
emqx_acl_mnesia_db:lookup_acl({username, Username}) ++
emqx_acl_mnesia_db:lookup_acl(all)
end,
case match(ClientInfo, PubSub, Topic, Acls) of
allow ->
emqx_metrics:inc(?ACL_METRICS(allow)),
{stop, allow};
deny ->
emqx_metrics:inc(?ACL_METRICS(deny)),
{stop, deny};
_ ->
emqx_metrics:inc(?ACL_METRICS(ignore)),
ok
end.
@ -83,7 +67,6 @@ match(ClientInfo, PubSub, Topic, [ {_, ACLTopic, Action, Access, _} | Acls]) ->
match_topic(ClientInfo, Topic, ACLTopic) when is_binary(Topic) ->
emqx_topic:match(Topic, feed_var(ClientInfo, ACLTopic)).
match_actions(_, pubsub) -> true;
match_actions(subscribe, sub) -> true;
match_actions(publish, pub) -> true;
match_actions(_, _) -> false.

View File

@ -16,8 +16,6 @@
-module(emqx_acl_mnesia_api).
-include("emqx_auth_mnesia.hrl").
-include_lib("stdlib/include/ms_transform.hrl").
-import(proplists, [ get_value/2
@ -99,26 +97,22 @@
]).
list_clientid(_Bindings, Params) ->
MatchSpec = ets:fun2ms(
fun({emqx_acl, {{clientid, Clientid}, Topic}, Action, Access, CreatedAt}) -> {{clientid,Clientid}, Topic, Action,Access, CreatedAt} end),
return({ok, emqx_auth_mnesia_api:paginate(emqx_acl, MatchSpec, Params, fun emqx_acl_mnesia_cli:comparing/2, fun format/1)}).
Table = emqx_acl_mnesia_db:login_acl_table(clientid),
return({ok, emqx_auth_mnesia_api:paginate_qh(Table, count(Table), Params, fun emqx_acl_mnesia_db:comparing/2, fun format/1)}).
list_username(_Bindings, Params) ->
MatchSpec = ets:fun2ms(
fun({emqx_acl, {{username, Username}, Topic}, Action, Access, CreatedAt}) -> {{username, Username}, Topic, Action,Access, CreatedAt} end),
return({ok, emqx_auth_mnesia_api:paginate(emqx_acl, MatchSpec, Params, fun emqx_acl_mnesia_cli:comparing/2, fun format/1)}).
Table = emqx_acl_mnesia_db:login_acl_table(username),
return({ok, emqx_auth_mnesia_api:paginate_qh(Table, count(Table), Params, fun emqx_acl_mnesia_db:comparing/2, fun format/1)}).
list_all(_Bindings, Params) ->
MatchSpec = ets:fun2ms(
fun({emqx_acl, {all, Topic}, Action, Access, CreatedAt}) -> {all, Topic, Action,Access, CreatedAt}end
),
return({ok, emqx_auth_mnesia_api:paginate(emqx_acl, MatchSpec, Params, fun emqx_acl_mnesia_cli:comparing/2, fun format/1)}).
Table = emqx_acl_mnesia_db:login_acl_table(all),
return({ok, emqx_auth_mnesia_api:paginate_qh(Table, count(Table), Params, fun emqx_acl_mnesia_db:comparing/2, fun format/1)}).
lookup(#{clientid := Clientid}, _Params) ->
return({ok, format(emqx_acl_mnesia_cli:lookup_acl({clientid, urldecode(Clientid)}))});
return({ok, format(emqx_acl_mnesia_db:lookup_acl({clientid, urldecode(Clientid)}))});
lookup(#{username := Username}, _Params) ->
return({ok, format(emqx_acl_mnesia_cli:lookup_acl({username, urldecode(Username)}))}).
return({ok, format(emqx_acl_mnesia_db:lookup_acl({username, urldecode(Username)}))}).
add(_Bindings, Params) ->
[ P | _] = Params,
@ -144,15 +138,15 @@ do_add(Params) ->
Username = get_value(<<"username">>, Params, undefined),
Login = case {Clientid, Username} of
{undefined, undefined} -> all;
{_, undefined} -> {clientid, urldecode(Clientid)};
{undefined, _} -> {username, urldecode(Username)}
{_, undefined} -> {clientid, Clientid};
{undefined, _} -> {username, Username}
end,
Topic = urldecode(get_value(<<"topic">>, Params)),
Action = urldecode(get_value(<<"action">>, Params)),
Access = urldecode(get_value(<<"access">>, Params)),
Topic = get_value(<<"topic">>, Params),
Action = get_value(<<"action">>, Params),
Access = get_value(<<"access">>, Params),
Re = case validate([login, topic, action, access], [Login, Topic, Action, Access]) of
ok ->
emqx_acl_mnesia_cli:add_acl(Login, Topic, erlang:binary_to_atom(Action, utf8), erlang:binary_to_atom(Access, utf8));
emqx_acl_mnesia_db:add_acl(Login, Topic, erlang:binary_to_atom(Action, utf8), erlang:binary_to_atom(Access, utf8));
Err -> Err
end,
maps:merge(#{topic => Topic,
@ -165,15 +159,19 @@ do_add(Params) ->
end).
delete(#{clientid := Clientid, topic := Topic}, _) ->
return(emqx_acl_mnesia_cli:remove_acl({clientid, urldecode(Clientid)}, urldecode(Topic)));
return(emqx_acl_mnesia_db:remove_acl({clientid, urldecode(Clientid)}, urldecode(Topic)));
delete(#{username := Username, topic := Topic}, _) ->
return(emqx_acl_mnesia_cli:remove_acl({username, urldecode(Username)}, urldecode(Topic)));
return(emqx_acl_mnesia_db:remove_acl({username, urldecode(Username)}, urldecode(Topic)));
delete(#{topic := Topic}, _) ->
return(emqx_acl_mnesia_cli:remove_acl(all, urldecode(Topic))).
return(emqx_acl_mnesia_db:remove_acl(all, urldecode(Topic))).
%%------------------------------------------------------------------------------
%% Interval Funcs
%%------------------------------------------------------------------------------
count(QH) ->
qlc:fold(fun(_, Count) -> Count + 1 end, 0, QH).
format({{clientid, Clientid}, Topic, Action, Access, _CreatedAt}) ->
#{clientid => Clientid, topic => Topic, action => Action, access => Access};
format({{username, Username}, Topic, Action, Access, _CreatedAt}) ->

View File

@ -16,110 +16,28 @@
-module(emqx_acl_mnesia_cli).
-include("emqx_auth_mnesia.hrl").
-include_lib("emqx/include/logger.hrl").
-include_lib("stdlib/include/ms_transform.hrl").
-define(TABLE, emqx_acl).
%% Acl APIs
-export([ add_acl/4
, lookup_acl/1
, all_acls/0
, all_acls/1
, remove_acl/2
]).
-export([cli/1]).
-export([comparing/2]).
%%--------------------------------------------------------------------
%% Acl API
%%--------------------------------------------------------------------
%% @doc Add Acls
-spec(add_acl(login() | all, emqx_topic:topic(), pub | sub | pubsub, allow | deny) ->
ok | {error, any()}).
add_acl(Login, Topic, Action, Access) ->
Filter = {Login, Topic},
Acl = #?TABLE{
filter = Filter,
action = Action,
access = Access,
created_at = erlang:system_time(millisecond)
},
ret(mnesia:transaction(
fun() ->
OldRecords = mnesia:wread({?TABLE, Filter}),
case Action of
pubsub ->
update_permission(pub, Acl, OldRecords),
update_permission(sub, Acl, OldRecords);
_ ->
update_permission(Action, Acl, OldRecords)
end
end)).
%% @doc Lookup acl by login
-spec(lookup_acl(login() | all) -> list()).
lookup_acl(undefined) -> [];
lookup_acl(Login) ->
MatchSpec = ets:fun2ms(fun({?TABLE, {Filter, ACLTopic}, Action, Access, CreatedAt})
when Filter =:= Login ->
{Filter, ACLTopic, Action, Access, CreatedAt}
end),
lists:sort(fun comparing/2, ets:select(?TABLE, MatchSpec)).
%% @doc Remove acl
-spec(remove_acl(login() | all, emqx_topic:topic()) -> ok | {error, any()}).
remove_acl(Login, Topic) ->
ret(mnesia:transaction(fun mnesia:delete/1, [{?TABLE, {Login, Topic}}])).
%% @doc All logins
-spec(all_acls() -> list()).
all_acls() ->
all_acls(clientid) ++
all_acls(username) ++
all_acls(all).
all_acls(clientid) ->
MatchSpec = ets:fun2ms(
fun({?TABLE, {{clientid, Clientid}, Topic}, Action, Access, CreatedAt}) ->
{{clientid, Clientid}, Topic, Action, Access, CreatedAt}
end),
lists:sort(fun comparing/2, ets:select(?TABLE, MatchSpec));
all_acls(username) ->
MatchSpec = ets:fun2ms(
fun({?TABLE, {{username, Username}, Topic}, Action, Access, CreatedAt}) ->
{{username, Username}, Topic, Action, Access, CreatedAt}
end),
lists:sort(fun comparing/2, ets:select(?TABLE, MatchSpec));
all_acls(all) ->
MatchSpec = ets:fun2ms(
fun({?TABLE, {all, Topic}, Action, Access, CreatedAt}) ->
{all, Topic, Action, Access, CreatedAt}
end
),
lists:sort(fun comparing/2, ets:select(?TABLE, MatchSpec)).
%%--------------------------------------------------------------------
%% ACL Cli
%%--------------------------------------------------------------------
cli(["list"]) ->
[print_acl(Acl) || Acl <- all_acls()];
[print_acl(Acl) || Acl <- emqx_acl_mnesia_db:all_acls()];
cli(["list", "clientid"]) ->
[print_acl(Acl) || Acl <- all_acls(clientid)];
[print_acl(Acl) || Acl <- emqx_acl_mnesia_db:all_acls(clientid)];
cli(["list", "username"]) ->
[print_acl(Acl) || Acl <- all_acls(username)];
[print_acl(Acl) || Acl <- emqx_acl_mnesia_db:all_acls(username)];
cli(["list", "_all"]) ->
[print_acl(Acl) || Acl <- all_acls(all)];
[print_acl(Acl) || Acl <- emqx_acl_mnesia_db:all_acls(all)];
cli(["add", "clientid", Clientid, Topic, Action, Access]) ->
case validate(action, Action) andalso validate(access, Access) of
true ->
case add_acl(
case emqx_acl_mnesia_db:add_acl(
{clientid, iolist_to_binary(Clientid)},
iolist_to_binary(Topic),
list_to_existing_atom(Action),
@ -135,7 +53,7 @@ cli(["add", "clientid", Clientid, Topic, Action, Access]) ->
cli(["add", "username", Username, Topic, Action, Access]) ->
case validate(action, Action) andalso validate(access, Access) of
true ->
case add_acl(
case emqx_acl_mnesia_db:add_acl(
{username, iolist_to_binary(Username)},
iolist_to_binary(Topic),
list_to_existing_atom(Action),
@ -151,7 +69,7 @@ cli(["add", "username", Username, Topic, Action, Access]) ->
cli(["add", "_all", Topic, Action, Access]) ->
case validate(action, Action) andalso validate(access, Access) of
true ->
case add_acl(
case emqx_acl_mnesia_db:add_acl(
all,
iolist_to_binary(Topic),
list_to_existing_atom(Action),
@ -165,16 +83,16 @@ cli(["add", "_all", Topic, Action, Access]) ->
end;
cli(["show", "clientid", Clientid]) ->
[print_acl(Acl) || Acl <- lookup_acl({clientid, iolist_to_binary(Clientid)})];
[print_acl(Acl) || Acl <- emqx_acl_mnesia_db:lookup_acl({clientid, iolist_to_binary(Clientid)})];
cli(["show", "username", Username]) ->
[print_acl(Acl) || Acl <- lookup_acl({username, iolist_to_binary(Username)})];
[print_acl(Acl) || Acl <- emqx_acl_mnesia_db:lookup_acl({username, iolist_to_binary(Username)})];
cli(["del", "clientid", Clientid, Topic])->
cli(["delete", "clientid", Clientid, Topic]);
cli(["delete", "clientid", Clientid, Topic])->
case remove_acl({clientid, iolist_to_binary(Clientid)}, iolist_to_binary(Topic)) of
case emqx_acl_mnesia_db:remove_acl({clientid, iolist_to_binary(Clientid)}, iolist_to_binary(Topic)) of
ok -> emqx_ctl:print("ok~n");
{error, Reason} -> emqx_ctl:print("Error: ~p~n", [Reason])
end;
@ -183,7 +101,7 @@ cli(["del", "username", Username, Topic])->
cli(["delete", "username", Username, Topic]);
cli(["delete", "username", Username, Topic])->
case remove_acl({username, iolist_to_binary(Username)}, iolist_to_binary(Topic)) of
case emqx_acl_mnesia_db:remove_acl({username, iolist_to_binary(Username)}, iolist_to_binary(Topic)) of
ok -> emqx_ctl:print("ok~n");
{error, Reason} -> emqx_ctl:print("Error: ~p~n", [Reason])
end;
@ -192,7 +110,7 @@ cli(["del", "_all", Topic])->
cli(["delete", "_all", Topic]);
cli(["delete", "_all", Topic])->
case remove_acl(all, iolist_to_binary(Topic)) of
case emqx_acl_mnesia_db:remove_acl(all, iolist_to_binary(Topic)) of
ok -> emqx_ctl:print("ok~n");
{error, Reason} -> emqx_ctl:print("Error: ~p~n", [Reason])
end;
@ -215,13 +133,6 @@ cli(_) ->
%% Internal functions
%%--------------------------------------------------------------------
comparing({_, _, _, _, CreatedAt1},
{_, _, _, _, CreatedAt2}) ->
CreatedAt1 >= CreatedAt2.
ret({atomic, ok}) -> ok;
ret({aborted, Error}) -> {error, Error}.
validate(action, "pub") -> true;
validate(action, "sub") -> true;
validate(action, "pubsub") -> true;
@ -244,27 +155,3 @@ print_acl({all, Topic, Action, Access, _}) ->
"Acl($all topic = ~p action = ~p access = ~p)~n",
[Topic, Action, Access]
).
update_permission(Action, Acl0, OldRecords) ->
Acl = Acl0 #?TABLE{action = Action},
maybe_delete_shadowed_records(Action, OldRecords),
mnesia:write(Acl).
maybe_delete_shadowed_records(_, []) ->
ok;
maybe_delete_shadowed_records(Action1, [Rec = #emqx_acl{action = Action2} | Rest]) ->
if Action1 =:= Action2 ->
ok = mnesia:delete_object(Rec);
Action2 =:= pubsub ->
%% Perform migration from the old data format on the
%% fly. This is needed only for the enterprise version,
%% delete this branch on 5.0
mnesia:delete_object(Rec),
mnesia:write(Rec#?TABLE{action = other_action(Action1)});
true ->
ok
end,
maybe_delete_shadowed_records(Action1, Rest).
other_action(pub) -> sub;
other_action(sub) -> pub.

View File

@ -0,0 +1,339 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2020-2021 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%--------------------------------------------------------------------
-module(emqx_acl_mnesia_db).
-include("emqx_auth_mnesia.hrl").
-include_lib("stdlib/include/ms_transform.hrl").
-include_lib("stdlib/include/qlc.hrl").
%% ACL APIs
-export([ create_table/0
, create_table2/0
]).
-export([ add_acl/4
, lookup_acl/1
, all_acls_export/0
, all_acls/0
, all_acls/1
, remove_acl/2
, merge_acl_records/3
, login_acl_table/1
, is_migration_started/0
]).
-export([comparing/2]).
%%--------------------------------------------------------------------
%% ACL API
%%--------------------------------------------------------------------
%% @doc Create table `emqx_acl` of old format rules
-spec(create_table() -> ok).
create_table() ->
ok = ekka_mnesia:create_table(?ACL_TABLE, [
{type, bag},
{disc_copies, [node()]},
{attributes, record_info(fields, ?ACL_TABLE)},
{storage_properties, [{ets, [{read_concurrency, true}]}]}]),
ok = ekka_mnesia:copy_table(?ACL_TABLE, disc_copies).
%% @doc Create table `emqx_acl2` of new format rules
-spec(create_table2() -> ok).
create_table2() ->
ok = ekka_mnesia:create_table(?ACL_TABLE2, [
{type, ordered_set},
{disc_copies, [node()]},
{attributes, record_info(fields, ?ACL_TABLE2)},
{storage_properties, [{ets, [{read_concurrency, true}]}]}]),
ok = ekka_mnesia:copy_table(?ACL_TABLE2, disc_copies).
%% @doc Add Acls
-spec(add_acl(acl_target(), emqx_topic:topic(), legacy_action(), access()) ->
ok | {error, any()}).
add_acl(Login, Topic, Action, Access) ->
ret(mnesia:transaction(fun() ->
case is_migration_started() of
true -> add_acl_new(Login, Topic, Action, Access);
false -> add_acl_old(Login, Topic, Action, Access)
end
end)).
%% @doc Lookup acl by login
-spec(lookup_acl(acl_target()) -> list(acl_record())).
lookup_acl(undefined) -> [];
lookup_acl(Login) ->
% After migration to ?ACL_TABLE2, ?ACL_TABLE never has any rules. This lookup should be removed later.
MatchSpec = ets:fun2ms(fun(#?ACL_TABLE{filter = {Filter, _}} = Rec)
when Filter =:= Login -> Rec
end),
OldRecs = ets:select(?ACL_TABLE, MatchSpec),
NewAcls = ets:lookup(?ACL_TABLE2, Login),
MergedAcl = merge_acl_records(Login, OldRecs, NewAcls),
lists:sort(fun comparing/2, acl_to_list(MergedAcl)).
%% @doc Remove ACL
-spec remove_acl(acl_target(), emqx_topic:topic()) -> ok | {error, any()}.
remove_acl(Login, Topic) ->
ret(mnesia:transaction(fun() ->
mnesia:delete({?ACL_TABLE, {Login, Topic}}),
case mnesia:wread({?ACL_TABLE2, Login}) of
[] -> ok;
[#?ACL_TABLE2{rules = Rules} = Acl] ->
case delete_topic_rules(Topic, Rules) of
[] -> mnesia:delete({?ACL_TABLE2, Login});
[_ | _] = RemainingRules ->
mnesia:write(Acl#?ACL_TABLE2{rules = RemainingRules})
end
end
end)).
%% @doc All ACL rules
-spec(all_acls() -> list(acl_record())).
all_acls() ->
all_acls(username) ++
all_acls(clientid) ++
all_acls(all).
%% @doc All ACL rules of specified type
-spec(all_acls(acl_target_type()) -> list(acl_record())).
all_acls(AclTargetType) ->
lists:sort(fun comparing/2, qlc:eval(login_acl_table(AclTargetType))).
%% @doc All ACL rules fetched transactionally
-spec(all_acls_export() -> list(acl_record())).
all_acls_export() ->
AclTargetTypes = [username, clientid, all],
MatchSpecNew = lists:flatmap(fun login_match_spec_new/1, AclTargetTypes),
MatchSpecOld = lists:flatmap(fun login_match_spec_old/1, AclTargetTypes),
{atomic, Records} = mnesia:transaction(
fun() ->
QH = acl_table(MatchSpecNew, MatchSpecOld, fun mnesia:table/2, fun lookup_mnesia/2),
qlc:eval(QH)
end),
Records.
%% @doc QLC table of logins matching spec
-spec(login_acl_table(acl_target_type()) -> qlc:query_handle()).
login_acl_table(AclTargetType) ->
MatchSpecNew = login_match_spec_new(AclTargetType),
MatchSpecOld = login_match_spec_old(AclTargetType),
acl_table(MatchSpecNew, MatchSpecOld, fun ets:table/2, fun lookup_ets/2).
%% @doc Combine old `emqx_acl` ACL records with a new `emqx_acl2` ACL record for a given login
-spec(merge_acl_records(acl_target(), [#?ACL_TABLE{}], [#?ACL_TABLE2{}]) -> #?ACL_TABLE2{}).
merge_acl_records(Login, OldRecs, Acls) ->
OldRules = old_recs_to_rules(OldRecs),
NewRules = case Acls of
[] -> [];
[#?ACL_TABLE2{rules = Rules}] -> Rules
end,
#?ACL_TABLE2{who = Login, rules = merge_rules(NewRules, OldRules)}.
%% @doc Checks if background migration of ACL rules from `emqx_acl` to `emqx_acl2` format started.
%% Should be run in transaction
-spec(is_migration_started() -> boolean()).
is_migration_started() ->
case mnesia:read({?ACL_TABLE, ?MIGRATION_MARK_KEY}) of
[?MIGRATION_MARK_RECORD | _] -> true;
[] -> false
end.
%%--------------------------------------------------------------------
%% Internal functions
%%--------------------------------------------------------------------
add_acl_new(Login, Topic, Action, Access) ->
Rule = {Access, Action, Topic, erlang:system_time(millisecond)},
Rules = normalize_rule(Rule),
OldAcl = mnesia:wread({?ACL_TABLE2, Login}),
NewAcl = case OldAcl of
[#?ACL_TABLE2{rules = OldRules} = Acl] ->
Acl#?ACL_TABLE2{rules = merge_rules(Rules, OldRules)};
[] ->
#?ACL_TABLE2{who = Login, rules = Rules}
end,
mnesia:write(NewAcl).
add_acl_old(Login, Topic, Action, Access) ->
Filter = {Login, Topic},
Acl = #?ACL_TABLE{
filter = Filter,
action = Action,
access = Access,
created_at = erlang:system_time(millisecond)
},
OldRecords = mnesia:wread({?ACL_TABLE, Filter}),
case Action of
pubsub ->
update_permission(pub, Acl, OldRecords),
update_permission(sub, Acl, OldRecords);
_ ->
update_permission(Action, Acl, OldRecords)
end.
old_recs_to_rules(OldRecs) ->
lists:flatmap(fun old_rec_to_rules/1, OldRecs).
old_rec_to_rules(#?ACL_TABLE{filter = {_, Topic}, action = Action, access = Access, created_at = CreatedAt}) ->
normalize_rule({Access, Action, Topic, CreatedAt}).
normalize_rule({Access, pubsub, Topic, CreatedAt}) ->
[{Access, pub, Topic, CreatedAt}, {Access, sub, Topic, CreatedAt}];
normalize_rule({Access, Action, Topic, CreatedAt}) ->
[{Access, Action, Topic, CreatedAt}].
merge_rules([], OldRules) -> OldRules;
merge_rules([NewRule | RestNewRules], OldRules) ->
merge_rules(RestNewRules, merge_rule(NewRule, OldRules)).
merge_rule({_, Action, Topic, _ } = NewRule, OldRules) ->
[NewRule | lists:filter(
fun({_, OldAction, OldTopic, _}) ->
{Action, Topic} =/= {OldAction, OldTopic}
end, OldRules)].
acl_to_list(#?ACL_TABLE2{who = Login, rules = Rules}) ->
[{Login, Topic, Action, Access, CreatedAt} || {Access, Action, Topic, CreatedAt} <- Rules].
delete_topic_rules(Topic, Rules) ->
[Rule || {_, _, T, _} = Rule <- Rules, T =/= Topic].
comparing({_, _, _, _, CreatedAt} = Rec1,
{_, _, _, _, CreatedAt} = Rec2) ->
Rec1 >= Rec2;
comparing({_, _, _, _, CreatedAt1},
{_, _, _, _, CreatedAt2}) ->
CreatedAt1 >= CreatedAt2.
login_match_spec_old(all) ->
ets:fun2ms(fun(#?ACL_TABLE{filter = {all, _}} = Record) ->
Record
end);
login_match_spec_old(Type) when (Type =:= username) or (Type =:= clientid) ->
ets:fun2ms(fun(#?ACL_TABLE{filter = {{RecordType, _}, _}} = Record)
when RecordType =:= Type -> Record
end).
login_match_spec_new(all) ->
ets:fun2ms(fun(#?ACL_TABLE2{who = all} = Record) ->
Record
end);
login_match_spec_new(Type) when (Type =:= username) or (Type =:= clientid) ->
ets:fun2ms(fun(#?ACL_TABLE2{who = {RecordType, _}} = Record)
when RecordType =:= Type -> Record
end).
acl_table(MatchSpecNew, MatchSpecOld, TableFun, LookupFun) ->
TraverseFun =
fun() ->
CursorNew =
qlc:cursor(
TableFun(?ACL_TABLE2, [{traverse, {select, MatchSpecNew}}])),
CursorOld =
qlc:cursor(
TableFun(?ACL_TABLE, [{traverse, {select, MatchSpecOld}}])),
traverse_new(CursorNew, CursorOld, #{}, LookupFun)
end,
qlc:table(TraverseFun, []).
% These are traverse funs for qlc table created by `acl_table/4`.
% Traversing consumes memory: it collects logins present in `?ACL_TABLE` and
% at the same time having rules in `?ACL_TABLE2`.
% Such records appear if ACLs are inserted before migration started.
% After migration, number of such logins is zero, so traversing starts working in
% constant memory.
traverse_new(CursorNew, CursorOld, FoundKeys, LookupFun) ->
Acls = qlc:next_answers(CursorNew, 1),
case Acls of
[] ->
qlc:delete_cursor(CursorNew),
traverse_old(CursorOld, FoundKeys);
[#?ACL_TABLE2{who = Login, rules = Rules} = Acl] ->
Keys = lists:usort([{Login, Topic} || {_, _, Topic, _} <- Rules]),
OldRecs = lists:flatmap(fun(Key) -> LookupFun(?ACL_TABLE, Key) end, Keys),
MergedAcl = merge_acl_records(Login, OldRecs, [Acl]),
NewFoundKeys =
lists:foldl(fun(#?ACL_TABLE{filter = Key}, Found) -> maps:put(Key, true, Found) end,
FoundKeys,
OldRecs),
case acl_to_list(MergedAcl) of
[] ->
traverse_new(CursorNew, CursorOld, NewFoundKeys, LookupFun);
List ->
List ++ fun() -> traverse_new(CursorNew, CursorOld, NewFoundKeys, LookupFun) end
end
end.
traverse_old(CursorOld, FoundKeys) ->
OldAcls = qlc:next_answers(CursorOld),
case OldAcls of
[] ->
qlc:delete_cursor(CursorOld),
[];
_ ->
Records = [ {Login, Topic, Action, Access, CreatedAt}
|| #?ACL_TABLE{filter = {Login, Topic}, action = LegacyAction, access = Access, created_at = CreatedAt} <- OldAcls,
{_, Action, _, _} <- normalize_rule({Access, LegacyAction, Topic, CreatedAt}),
not maps:is_key({Login, Topic}, FoundKeys)
],
case Records of
[] -> traverse_old(CursorOld, FoundKeys);
List -> List ++ fun() -> traverse_old(CursorOld, FoundKeys) end
end
end.
lookup_mnesia(Tab, Key) ->
mnesia:read({Tab, Key}).
lookup_ets(Tab, Key) ->
ets:lookup(Tab, Key).
update_permission(Action, Acl0, OldRecords) ->
Acl = Acl0 #?ACL_TABLE{action = Action},
maybe_delete_shadowed_records(Action, OldRecords),
mnesia:write(Acl).
maybe_delete_shadowed_records(_, []) ->
ok;
maybe_delete_shadowed_records(Action1, [Rec = #emqx_acl{action = Action2} | Rest]) ->
if Action1 =:= Action2 ->
ok = mnesia:delete_object(Rec);
Action2 =:= pubsub ->
%% Perform migration from the old data format on the
%% fly. This is needed only for the enterprise version,
%% delete this branch on 5.0
mnesia:delete_object(Rec),
mnesia:write(Rec#?ACL_TABLE{action = other_action(Action1)});
true ->
ok
end,
maybe_delete_shadowed_records(Action1, Rest).
other_action(pub) -> sub;
other_action(sub) -> pub.
ret({atomic, ok}) -> ok;
ret({aborted, Error}) -> {error, Error}.

View File

@ -0,0 +1,215 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2020-2021 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%--------------------------------------------------------------------
-module(emqx_acl_mnesia_migrator).
-include("emqx_auth_mnesia.hrl").
-include_lib("emqx/include/logger.hrl").
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
-behaviour(gen_statem).
-define(CHECK_ALL_NODES_INTERVAL, 60000).
-type(migration_delay_reason() :: old_nodes | bad_nodes).
-export([
callback_mode/0,
init/1
]).
-export([
waiting_all_nodes/3,
checking_old_table/3,
migrating/3
]).
-export([
start_link/0,
start_link/1,
start_supervised/0,
stop_supervised/0,
migrate_records/0,
is_migrating_on_node/1,
is_old_table_migrated/0
]).
%%--------------------------------------------------------------------
%% External interface
%%--------------------------------------------------------------------
start_link() ->
start_link(?MODULE).
start_link(Name) when is_atom(Name) ->
start_link(#{
name => Name
});
start_link(#{name := Name} = Opts) ->
gen_statem:start_link({local, Name}, ?MODULE, Opts, []).
start_supervised() ->
try
{ok, _} = supervisor:restart_child(emqx_auth_mnesia_sup, ?MODULE),
ok
catch
exit:{noproc, _} -> ok
end.
stop_supervised() ->
try
ok = supervisor:terminate_child(emqx_auth_mnesia_sup, ?MODULE),
ok = supervisor:delete_child(emqx_auth_mnesia_sup, ?MODULE)
catch
exit:{noproc, _} -> ok
end.
%%--------------------------------------------------------------------
%% gen_statem callbacks
%%--------------------------------------------------------------------
callback_mode() -> state_functions.
init(Opts) ->
ok = emqx_acl_mnesia_db:create_table(),
ok = emqx_acl_mnesia_db:create_table2(),
Name = maps:get(name, Opts, ?MODULE),
CheckNodesInterval = maps:get(check_nodes_interval, Opts, ?CHECK_ALL_NODES_INTERVAL),
GetNodes = maps:get(get_nodes, Opts, fun all_nodes/0),
Data =
#{name => Name,
check_nodes_interval => CheckNodesInterval,
get_nodes => GetNodes},
{ok, waiting_all_nodes, Data, [{state_timeout, 0, check_nodes}]}.
%%--------------------------------------------------------------------
%% state callbacks
%%--------------------------------------------------------------------
waiting_all_nodes(state_timeout, check_nodes, Data) ->
#{name := Name, check_nodes_interval := CheckNodesInterval, get_nodes := GetNodes} = Data,
case is_all_nodes_migrating(Name, GetNodes()) of
true ->
?tp(info, emqx_acl_mnesia_migrator_check_old_table, #{}),
{next_state, checking_old_table, Data, [{next_event, internal, check_old_table}]};
{false, Reason, Nodes} ->
?tp(info,
emqx_acl_mnesia_migrator_bad_nodes_delay,
#{delay => CheckNodesInterval,
reason => Reason,
name => Name,
nodes => Nodes}),
{keep_state_and_data, [{state_timeout, CheckNodesInterval, check_nodes}]}
end.
checking_old_table(internal, check_old_table, Data) ->
case is_old_table_migrated() of
true ->
?tp(info, emqx_acl_mnesia_migrator_finish, #{}),
{next_state, finished, Data, [{hibernate, true}]};
false ->
?tp(info, emqx_acl_mnesia_migrator_start_migration, #{}),
{next_state, migrating, Data, [{next_event, internal, start_migration}]}
end.
migrating(internal, start_migration, Data) ->
ok = migrate_records(),
{next_state, checking_old_table, Data, [{next_event, internal, check_old_table}]}.
%% @doc Returns `true` if migration is started in the local node, otherwise crash.
-spec(is_migrating_on_node(atom()) -> true).
is_migrating_on_node(Name) ->
true = is_pid(erlang:whereis(Name)).
%% @doc Run migration of records
-spec(migrate_records() -> ok).
migrate_records() ->
ok = add_migration_mark(),
Key = peek_record(),
do_migrate_records(Key).
%% @doc Run migration of records
-spec(is_all_nodes_migrating(atom(), list(node())) -> true | {false, migration_delay_reason(), list(node())}).
is_all_nodes_migrating(Name, Nodes) ->
case rpc:multicall(Nodes, ?MODULE, is_migrating_on_node, [Name]) of
{Results, []} ->
OldNodes = [ Node || {Node, Result} <- lists:zip(Nodes, Results), Result =/= true ],
case OldNodes of
[] -> true;
_ -> {false, old_nodes, OldNodes}
end;
{_, [_BadNode | _] = BadNodes} ->
{false, bad_nodes, BadNodes}
end.
%%--------------------------------------------------------------------
%% Internal functions
%%--------------------------------------------------------------------
all_nodes() ->
ekka_mnesia:cluster_nodes(all).
is_old_table_migrated() ->
Result =
mnesia:transaction(fun() ->
case mnesia:first(?ACL_TABLE) of
?MIGRATION_MARK_KEY ->
case mnesia:next(?ACL_TABLE, ?MIGRATION_MARK_KEY) of
'$end_of_table' -> true;
_OtherKey -> false
end;
'$end_of_table' -> false;
_OtherKey -> false
end
end),
case Result of
{atomic, true} ->
true;
_ ->
false
end.
add_migration_mark() ->
{atomic, ok} = mnesia:transaction(fun() -> mnesia:write(?MIGRATION_MARK_RECORD) end),
ok.
peek_record() ->
Key = mnesia:dirty_first(?ACL_TABLE),
case Key of
?MIGRATION_MARK_KEY ->
mnesia:dirty_next(?ACL_TABLE, Key);
_ -> Key
end.
do_migrate_records('$end_of_table') -> ok;
do_migrate_records({_Login, _Topic} = Key) ->
?tp(emqx_acl_mnesia_migrator_record_selected, #{key => Key}),
_ = mnesia:transaction(fun migrate_one_record/1, [Key]),
do_migrate_records(peek_record()).
migrate_one_record({Login, _Topic} = Key) ->
case mnesia:wread({?ACL_TABLE, Key}) of
[] ->
?tp(emqx_acl_mnesia_migrator_record_missed, #{key => Key}),
record_missing;
OldRecs ->
Acls = mnesia:wread({?ACL_TABLE2, Login}),
UpdatedAcl = emqx_acl_mnesia_db:merge_acl_records(Login, OldRecs, Acls),
ok = mnesia:write(UpdatedAcl),
ok = mnesia:delete({?ACL_TABLE, Key}),
?tp(emqx_acl_mnesia_migrator_record_migrated, #{key => Key})
end.

View File

@ -1,6 +1,6 @@
{application, emqx_auth_mnesia,
[{description, "EMQ X Authentication with Mnesia"},
{vsn, "4.3.0"}, % strict semver, bump manually
{vsn, "4.3.6"}, % strict semver, bump manually
{modules, []},
{registered, []},
{applications, [kernel,stdlib,mnesia]},

View File

@ -0,0 +1,47 @@
%% -*- mode: erlang -*-
%% Unless you know what you are doing, DO NOT edit manually!!
{VSN,
[{"4.3.5",
[{load_module,emqx_auth_mnesia_api,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia,brutal_purge,soft_purge,[]}]},
{<<"4\\.3\\.[0-3]">>,
[{load_module,emqx_auth_mnesia_cli,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia,brutal_purge,soft_purge,[]},
{add_module,emqx_acl_mnesia_db},
{add_module,emqx_acl_mnesia_migrator,[emqx_acl_mnesia_db]},
{update,emqx_auth_mnesia_sup,supervisor},
{apply,{emqx_acl_mnesia_migrator,start_supervised,[]}},
{load_module,emqx_auth_mnesia_api,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_mnesia,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia_app,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_mnesia_api,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_mnesia_cli,brutal_purge,soft_purge,[]}]},
{"4.3.4",
[{load_module,emqx_auth_mnesia_api,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia_cli,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_mnesia,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia_app,brutal_purge,soft_purge,[]}]},
{<<".*">>,[]}],
[{"4.3.5",
[{load_module,emqx_auth_mnesia_api,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia,brutal_purge,soft_purge,[]}]},
{<<"4\\.3\\.[0-3]">>,
[{load_module,emqx_auth_mnesia_cli,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia,brutal_purge,soft_purge,[]},
{apply,{emqx_acl_mnesia_migrator,stop_supervised,[]}},
{update,emqx_auth_mnesia_sup,supervisor},
{load_module,emqx_acl_mnesia_cli,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_mnesia_api,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia_api,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_mnesia,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia_app,brutal_purge,soft_purge,[]},
{delete_module,emqx_acl_mnesia_migrator},
{delete_module,emqx_acl_mnesia_db}]},
{"4.3.4",
[{load_module,emqx_auth_mnesia_api,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia_cli,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_mnesia,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mnesia_app,brutal_purge,soft_purge,[]}]},
{<<".*">>,[]}]}.

View File

@ -1,5 +1,5 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2020-2021 EMQ Technologies Co., Ltd. All Rights Reserved.
%% Copyright (c) 2020-2022 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@ -32,25 +32,32 @@
, description/0
]).
-export([ match_password/3
, hash_type/0
]).
init(#{clientid_list := ClientidList, username_list := UsernameList}) ->
ok = ekka_mnesia:create_table(?TABLE, [
{disc_copies, [node()]},
{attributes, record_info(fields, emqx_user)},
{storage_properties, [{ets, [{read_concurrency, true}]}]}]),
_ = [ add_default_user({{clientid, iolist_to_binary(Clientid)}, iolist_to_binary(Password)})
|| {Clientid, Password} <- ClientidList],
_ = [ add_default_user({{username, iolist_to_binary(Username)}, iolist_to_binary(Password)})
|| {Username, Password} <- UsernameList],
ok = ekka_mnesia:copy_table(?TABLE, disc_copies).
lists:foreach(fun({Clientid, Password}) ->
emqx_auth_mnesia_cli:add_default_user(clientid, iolist_to_binary(Clientid), iolist_to_binary(Password))
end, ClientidList),
%% @private
add_default_user({Login, Password}) when is_tuple(Login) ->
emqx_auth_mnesia_cli:add_user(Login, Password).
lists:foreach(fun({Username, Password}) ->
emqx_auth_mnesia_cli:add_default_user(username, iolist_to_binary(Username), iolist_to_binary(Password))
end, UsernameList),
ok = ekka_mnesia:copy_table(?TABLE, disc_copies).
-spec(register_metrics() -> ok).
register_metrics() ->
lists:foreach(fun emqx_metrics:ensure/1, ?AUTH_METRICS).
hash_type() ->
application:get_env(emqx_auth_mnesia, password_hash, sha256).
check(ClientInfo = #{ clientid := Clientid
, password := NPassword
}, AuthResult, #{hash_type := HashType}) ->
@ -65,7 +72,8 @@ check(ClientInfo = #{ clientid := Clientid
List ->
case match_password(NPassword, HashType, List) of
false ->
?LOG(error, "[Mnesia] Auth from mnesia failed: ~p", [ClientInfo]),
Info = maps:without([password], ClientInfo),
?LOG(info, "[Mnesia] Auth from mnesia failed: ~p", [Info]),
emqx_metrics:inc(?AUTH_METRICS(failure)),
{stop, AuthResult#{anonymous => false, auth_result => password_error}};
_ ->

View File

@ -23,7 +23,7 @@
-import(proplists, [get_value/2]).
-import(minirest, [return/1]).
-export([paginate/5]).
-export([paginate_qh/5]).
-export([ list_clientid/2
, lookup_clientid/2
@ -133,15 +133,15 @@ add_clientid(_Bindings, Params) ->
end.
do_add_clientid([ Params | ParamsN ], ReList ) ->
Clientid = urldecode(get_value(<<"clientid">>, Params)),
Clientid = get_value(<<"clientid">>, Params),
do_add_clientid(ParamsN, [{Clientid, format_msg(do_add_clientid(Params))} | ReList]);
do_add_clientid([], ReList) ->
{ok, ReList}.
do_add_clientid(Params) ->
Clientid = urldecode(get_value(<<"clientid">>, Params)),
Password = urldecode(get_value(<<"password">>, Params)),
Clientid = get_value(<<"clientid">>, Params),
Password = get_value(<<"password">>, Params),
Login = {clientid, Clientid},
case validate([login, password], [Login, Password]) of
ok ->
@ -152,7 +152,7 @@ do_add_clientid(Params) ->
update_clientid(#{clientid := Clientid}, Params) ->
Password = get_value(<<"password">>, Params),
case validate([password], [Password]) of
ok -> return(emqx_auth_mnesia_cli:update_user({clientid, urldecode(Clientid)}, urldecode(Password)));
ok -> return(emqx_auth_mnesia_cli:update_user({clientid, urldecode(Clientid)}, Password));
Err -> return(Err)
end.
@ -182,15 +182,15 @@ add_username(_Bindings, Params) ->
end.
do_add_username([ Params | ParamsN ], ReList ) ->
Username = urldecode(get_value(<<"username">>, Params)),
Username = get_value(<<"username">>, Params),
do_add_username(ParamsN, [{Username, format_msg(do_add_username(Params))} | ReList]);
do_add_username([], ReList) ->
{ok, ReList}.
do_add_username(Params) ->
Username = urldecode(get_value(<<"username">>, Params)),
Password = urldecode(get_value(<<"password">>, Params)),
Username = get_value(<<"username">>, Params),
Password = get_value(<<"password">>, Params),
Login = {username, Username},
case validate([login, password], [Login, Password]) of
ok ->
@ -201,7 +201,7 @@ do_add_username(Params) ->
update_username(#{username := Username}, Params) ->
Password = get_value(<<"password">>, Params),
case validate([password], [Password]) of
ok -> return(emqx_auth_mnesia_cli:update_user({username, urldecode(Username)}, urldecode(Password)));
ok -> return(emqx_auth_mnesia_cli:update_user({username, urldecode(Username)}, Password));
Err -> return(Err)
end.
@ -212,9 +212,12 @@ delete_username(#{username := Username}, _) ->
%% Paging Query
%%------------------------------------------------------------------------------
paginate(Tables, MatchSpec, Params, ComparingFun, RowFun) ->
Qh = query_handle(Tables, MatchSpec),
Count = count(Tables, MatchSpec),
paginate(Table, MatchSpec, Params, ComparingFun, RowFun) ->
Qh = query_handle(Table, MatchSpec),
Count = count(Table, MatchSpec),
paginate_qh(Qh, Count, Params, ComparingFun, RowFun).
paginate_qh(Qh, Count, Params, ComparingFun, RowFun) ->
Page = page(Params),
Limit = limit(Params),
Cursor = qlc:cursor(Qh),
@ -231,24 +234,12 @@ paginate(Tables, MatchSpec, Params, ComparingFun, RowFun) ->
query_handle(Table, MatchSpec) when is_atom(Table) ->
Options = {traverse, {select, MatchSpec}},
qlc:q([R|| R <- ets:table(Table, Options)]);
query_handle([Table], MatchSpec) when is_atom(Table) ->
Options = {traverse, {select, MatchSpec}},
qlc:q([R|| R <- ets:table(Table, Options)]);
query_handle(Tables, MatchSpec) ->
Options = {traverse, {select, MatchSpec}},
qlc:append([qlc:q([E || E <- ets:table(T, Options)]) || T <- Tables]).
qlc:q([R || R <- ets:table(Table, Options)]).
count(Table, MatchSpec) when is_atom(Table) ->
[{MatchPattern, Where, _Re}] = MatchSpec,
NMatchSpec = [{MatchPattern, Where, [true]}],
ets:select_count(Table, NMatchSpec);
count([Table], MatchSpec) when is_atom(Table) ->
[{MatchPattern, Where, _Re}] = MatchSpec,
NMatchSpec = [{MatchPattern, Where, [true]}],
ets:select_count(Table, NMatchSpec);
count(Tables, MatchSpec) ->
lists:sum([count(T, MatchSpec) || T <- Tables]).
ets:select_count(Table, NMatchSpec).
page(Params) ->
binary_to_integer(proplists:get_value(<<"_page">>, Params, <<"1">>)).
@ -263,13 +254,11 @@ limit(Params) ->
%% Interval Funcs
%%------------------------------------------------------------------------------
format([{?TABLE, {clientid, ClientId}, Password, _InterTime}]) ->
#{clientid => ClientId,
password => Password};
format([{?TABLE, {clientid, ClientId}, _Password, _InterTime}]) ->
#{clientid => ClientId};
format([{?TABLE, {username, Username}, Password, _InterTime}]) ->
#{username => Username,
password => Password};
format([{?TABLE, {username, Username}, _Password, _InterTime}]) ->
#{username => Username};
format([]) ->
#{}.

View File

@ -57,12 +57,9 @@ load_auth_hook() ->
UsernameList = application:get_env(?APP, username_list, []),
ok = emqx_auth_mnesia:init(#{clientid_list => ClientidList, username_list => UsernameList}),
ok = emqx_auth_mnesia:register_metrics(),
Params = #{
hash_type => application:get_env(emqx_auth_mnesia, password_hash, sha256)
},
Params = #{hash_type => emqx_auth_mnesia:hash_type()},
emqx:hook('client.authenticate', fun emqx_auth_mnesia:check/3, [Params]).
load_acl_hook() ->
ok = emqx_acl_mnesia:init(),
ok = emqx_acl_mnesia:register_metrics(),
emqx:hook('client.check_acl', fun emqx_acl_mnesia:check_acl/5, [#{}]).

View File

@ -22,6 +22,8 @@
-define(TABLE, emqx_user).
%% Auth APIs
-export([ add_user/2
, force_add_user/2
, add_default_user/3
, update_user/2
, remove_user/1
, lookup_user/1
@ -56,6 +58,65 @@ insert_user(User = #emqx_user{login = Login}) ->
[_|_] -> mnesia:abort(existed)
end.
-spec(add_default_user(clientid | username, tuple(), binary()) -> ok | {error, any()}).
add_default_user(Type, Key, Password) ->
Login = {Type, Key},
case add_user(Login, Password) of
ok -> ok;
{error, existed} ->
NewPwd = encrypted_data(Password),
[#emqx_user{password = OldPwd}] = emqx_auth_mnesia_cli:lookup_user(Login),
HashType = emqx_auth_mnesia:hash_type(),
case emqx_auth_mnesia:match_password(NewPwd, HashType, [OldPwd]) of
true -> ok;
false ->
%% We can't force add default,
%% otherwise passwords that have been updated via HTTP API will be reset after reboot.
TypeCtl =
case Type of
clientid -> clientid;
username -> user
end,
?LOG(warning,
"[Auth Mnesia] auth.client.x.~p=~s password in the emqx_auth_mnesia.conf\n"
"does not match the password in the database(mnesia).\n"
"1. If you have already changed the password via the HTTP API, this warning has no effect.\n"
"You can remove the `auth.client.x.~p=~s` from emqx_auth_mnesia.conf to resolve this warning.\n"
"2. If you just want to update the password by manually changing the configuration file,\n"
"you need to delete the old user and password using `emqx_ctl ~p delete ~s` first\n"
"the new password in emqx_auth_mnesia.conf can take effect after reboot.",
[Type, Key, Type, Key, TypeCtl, Key]),
ok
end;
Error -> Error
end.
force_add_user(Login, Password) ->
User = #emqx_user{
login = Login,
password = encrypted_data(Password),
created_at = erlang:system_time(millisecond)
},
case ret(mnesia:transaction(fun insert_or_update_user/2, [Password, User])) of
{ok, override} ->
?LOG(warning, "[Mnesia] (~p)'s password has be updated.", [Login]),
ok;
Other -> Other
end.
insert_or_update_user(NewPwd, User = #emqx_user{login = Login}) ->
case mnesia:read(?TABLE, Login) of
[] -> mnesia:write(User);
[#emqx_user{password = Pwd}] ->
case emqx_auth_mnesia:match_password(NewPwd, emqx_auth_mnesia:hash_type(), [Pwd]) of
true -> ok;
false ->
ok = mnesia:write(User),
{ok, override}
end
end.
%% @doc Update User
-spec(update_user(tuple(), binary()) -> ok | {error, any()}).
update_user(Login, NewPassword) ->
@ -105,11 +166,11 @@ comparing({?TABLE, _, _, CreatedAt1},
{?TABLE, _, _, CreatedAt2}) ->
CreatedAt1 >= CreatedAt2.
ret({atomic, ok}) -> ok;
ret({atomic, Res}) -> Res;
ret({aborted, Error}) -> {error, Error}.
encrypted_data(Password) ->
HashType = application:get_env(emqx_auth_mnesia, password_hash, sha256),
HashType = emqx_auth_mnesia:hash_type(),
SaltBin = salt(),
<<SaltBin/binary, (hash(Password, SaltBin, HashType))/binary>>.

View File

@ -33,4 +33,16 @@ start_link() ->
%%--------------------------------------------------------------------
init([]) ->
{ok, {{one_for_one, 10, 100}, []}}.
{ok, {{one_for_one, 10, 100}, [
child_spec(emqx_acl_mnesia_migrator, worker, [])
]}}.
child_spec(M, worker, Args) ->
#{id => M,
start => {M, start_link, Args},
restart => permanent,
shutdown => 5000,
type => worker,
modules => [M]
}.

View File

@ -22,6 +22,7 @@
-include("emqx_auth_mnesia.hrl").
-include_lib("eunit/include/eunit.hrl").
-include_lib("common_test/include/ct.hrl").
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
-import(emqx_ct_http, [ request_api/3
, request_api/5
@ -39,10 +40,17 @@ all() ->
emqx_ct:all(?MODULE).
groups() ->
[].
[{async_migration_tests, [sequence], [
t_old_and_new_acl_migration_by_migrator,
t_old_and_new_acl_migration_repeated_by_migrator,
t_migration_concurrency
]}].
init_per_suite(Config) ->
emqx_ct_helpers:start_apps([emqx_modules, emqx_management, emqx_auth_mnesia], fun set_special_configs/1),
emqx_ct_helpers:start_apps( [emqx_modules, emqx_management, emqx_auth_mnesia]
, fun set_special_configs/1
),
supervisor:terminate_child(emqx_auth_mnesia_sup, emqx_acl_mnesia_migrator),
create_default_app(),
Config.
@ -50,14 +58,32 @@ end_per_suite(_Config) ->
delete_default_app(),
emqx_ct_helpers:stop_apps([emqx_modules, emqx_management, emqx_auth_mnesia]).
init_per_testcase(t_check_acl_as_clientid, Config) ->
init_per_testcase_clean(_, Config) ->
mnesia:clear_table(?ACL_TABLE),
mnesia:clear_table(?ACL_TABLE2),
Config.
init_per_testcase_emqx_hook(t_check_acl_as_clientid, Config) ->
emqx:hook('client.check_acl', fun emqx_acl_mnesia:check_acl/5, [#{key_as => clientid}]),
Config;
init_per_testcase(_, Config) ->
init_per_testcase_emqx_hook(_, Config) ->
emqx:hook('client.check_acl', fun emqx_acl_mnesia:check_acl/5, [#{key_as => username}]),
Config.
init_per_testcase_migration(t_management_before_migration, Config) ->
Config;
init_per_testcase_migration(_, Config) ->
emqx_acl_mnesia_migrator:migrate_records(),
Config.
init_per_testcase(Case, Config) ->
PerTestInitializers = [
fun init_per_testcase_clean/2,
fun init_per_testcase_migration/2,
fun init_per_testcase_emqx_hook/2
],
lists:foldl(fun(Init, Conf) -> Init(Case, Conf) end, Config, PerTestInitializers).
end_per_testcase(_, Config) ->
emqx:unhook('client.check_acl', fun emqx_acl_mnesia:check_acl/5),
Config.
@ -76,25 +102,34 @@ set_special_configs(_App) ->
%% Testcases
%%------------------------------------------------------------------------------
t_management(_Config) ->
clean_all_acls(),
?assertEqual("Acl with Mnesia", emqx_acl_mnesia:description()),
?assertEqual([], emqx_acl_mnesia_cli:all_acls()),
t_management_before_migration(_Config) ->
{atomic, IsStarted} = mnesia:transaction(fun emqx_acl_mnesia_db:is_migration_started/0),
?assertNot(IsStarted),
run_acl_tests().
ok = emqx_acl_mnesia_cli:add_acl({clientid, <<"test_clientid">>}, <<"topic/%c">>, sub, allow),
ok = emqx_acl_mnesia_cli:add_acl({clientid, <<"test_clientid">>}, <<"topic/+">>, pub, deny),
ok = emqx_acl_mnesia_cli:add_acl({username, <<"test_username">>}, <<"topic/%u">>, sub, deny),
ok = emqx_acl_mnesia_cli:add_acl({username, <<"test_username">>}, <<"topic/+">>, pub, allow),
ok = emqx_acl_mnesia_cli:add_acl(all, <<"#">>, pubsub, deny),
t_management_after_migration(_Config) ->
{atomic, IsStarted} = mnesia:transaction(fun emqx_acl_mnesia_db:is_migration_started/0),
?assert(IsStarted),
run_acl_tests().
run_acl_tests() ->
?assertEqual("Acl with Mnesia", emqx_acl_mnesia:description()),
?assertEqual([], emqx_acl_mnesia_db:all_acls()),
ok = emqx_acl_mnesia_db:add_acl({clientid, <<"test_clientid">>}, <<"topic/%c">>, sub, allow),
ok = emqx_acl_mnesia_db:add_acl({clientid, <<"test_clientid">>}, <<"topic/+">>, pub, deny),
ok = emqx_acl_mnesia_db:add_acl({username, <<"test_username">>}, <<"topic/%u">>, sub, deny),
ok = emqx_acl_mnesia_db:add_acl({username, <<"test_username">>}, <<"topic/+">>, pub, allow),
ok = emqx_acl_mnesia_db:add_acl(all, <<"#">>, pubsub, deny),
%% Sleeps below are needed to hide the race condition between
%% mnesia and ets dirty select in check_acl, that make this test
%% flaky
timer:sleep(100),
?assertEqual(2, length(emqx_acl_mnesia_cli:lookup_acl({clientid, <<"test_clientid">>}))),
?assertEqual(2, length(emqx_acl_mnesia_cli:lookup_acl({username, <<"test_username">>}))),
?assertEqual(2, length(emqx_acl_mnesia_cli:lookup_acl(all))),
?assertEqual(6, length(emqx_acl_mnesia_cli:all_acls())),
?assertEqual(2, length(emqx_acl_mnesia_db:lookup_acl({clientid, <<"test_clientid">>}))),
?assertEqual(2, length(emqx_acl_mnesia_db:lookup_acl({username, <<"test_username">>}))),
?assertEqual(2, length(emqx_acl_mnesia_db:lookup_acl(all))),
?assertEqual(6, length(emqx_acl_mnesia_db:all_acls())),
User1 = #{zone => external, clientid => <<"test_clientid">>},
User2 = #{zone => external, clientid => <<"no_exist">>, username => <<"test_username">>},
@ -110,30 +145,32 @@ t_management(_Config) ->
deny = emqx_access_control:check_acl(User3, publish, <<"topic/A/B">>),
%% Test merging of pubsub capability:
ok = emqx_acl_mnesia_cli:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, pubsub, deny),
ok = emqx_acl_mnesia_db:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, pubsub, deny),
timer:sleep(100),
deny = emqx_access_control:check_acl(User1, subscribe, <<"topic/mix">>),
deny = emqx_access_control:check_acl(User1, publish, <<"topic/mix">>),
ok = emqx_acl_mnesia_cli:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, pub, allow),
ok = emqx_acl_mnesia_db:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, pub, allow),
timer:sleep(100),
deny = emqx_access_control:check_acl(User1, subscribe, <<"topic/mix">>),
allow = emqx_access_control:check_acl(User1, publish, <<"topic/mix">>),
ok = emqx_acl_mnesia_cli:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, pubsub, allow),
ok = emqx_acl_mnesia_db:add_acl( {clientid, <<"test_clientid">>}
, <<"topic/mix">>, pubsub, allow
),
timer:sleep(100),
allow = emqx_access_control:check_acl(User1, subscribe, <<"topic/mix">>),
allow = emqx_access_control:check_acl(User1, publish, <<"topic/mix">>),
ok = emqx_acl_mnesia_cli:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, sub, deny),
ok = emqx_acl_mnesia_db:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, sub, deny),
timer:sleep(100),
deny = emqx_access_control:check_acl(User1, subscribe, <<"topic/mix">>),
allow = emqx_access_control:check_acl(User1, publish, <<"topic/mix">>),
ok = emqx_acl_mnesia_cli:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, pub, deny),
ok = emqx_acl_mnesia_db:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, pub, deny),
timer:sleep(100),
deny = emqx_access_control:check_acl(User1, subscribe, <<"topic/mix">>),
deny = emqx_access_control:check_acl(User1, publish, <<"topic/mix">>),
%% Test implicit migration of pubsub to pub and sub:
ok = emqx_acl_mnesia_cli:remove_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>),
ok = mnesia:dirty_write(#emqx_acl{
ok = emqx_acl_mnesia_db:remove_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>),
ok = mnesia:dirty_write(#?ACL_TABLE{
filter = {{clientid, <<"test_clientid">>}, <<"topic/mix">>},
action = pubsub,
access = allow,
@ -142,34 +179,138 @@ t_management(_Config) ->
timer:sleep(100),
allow = emqx_access_control:check_acl(User1, subscribe, <<"topic/mix">>),
allow = emqx_access_control:check_acl(User1, publish, <<"topic/mix">>),
ok = emqx_acl_mnesia_cli:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, pub, deny),
ok = emqx_acl_mnesia_db:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, pub, deny),
timer:sleep(100),
allow = emqx_access_control:check_acl(User1, subscribe, <<"topic/mix">>),
deny = emqx_access_control:check_acl(User1, publish, <<"topic/mix">>),
ok = emqx_acl_mnesia_cli:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, sub, deny),
ok = emqx_acl_mnesia_db:add_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>, sub, deny),
timer:sleep(100),
deny = emqx_access_control:check_acl(User1, subscribe, <<"topic/mix">>),
deny = emqx_access_control:check_acl(User1, publish, <<"topic/mix">>),
ok = emqx_acl_mnesia_cli:remove_acl({clientid, <<"test_clientid">>}, <<"topic/%c">>),
ok = emqx_acl_mnesia_cli:remove_acl({clientid, <<"test_clientid">>}, <<"topic/+">>),
ok = emqx_acl_mnesia_cli:remove_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>),
ok = emqx_acl_mnesia_cli:remove_acl({username, <<"test_username">>}, <<"topic/%u">>),
ok = emqx_acl_mnesia_cli:remove_acl({username, <<"test_username">>}, <<"topic/+">>),
ok = emqx_acl_mnesia_cli:remove_acl(all, <<"#">>),
ok = emqx_acl_mnesia_db:remove_acl({clientid, <<"test_clientid">>}, <<"topic/%c">>),
ok = emqx_acl_mnesia_db:remove_acl({clientid, <<"test_clientid">>}, <<"topic/+">>),
ok = emqx_acl_mnesia_db:remove_acl({clientid, <<"test_clientid">>}, <<"topic/mix">>),
ok = emqx_acl_mnesia_db:remove_acl({username, <<"test_username">>}, <<"topic/%u">>),
ok = emqx_acl_mnesia_db:remove_acl({username, <<"test_username">>}, <<"topic/+">>),
ok = emqx_acl_mnesia_db:remove_acl(all, <<"#">>),
timer:sleep(100),
?assertEqual([], emqx_acl_mnesia_cli:all_acls()).
?assertEqual([], emqx_acl_mnesia_db:all_acls()).
t_old_and_new_acl_combination(_Config) ->
create_conflicting_records(),
?assertEqual(combined_conflicting_records(), emqx_acl_mnesia_db:all_acls()),
?assertEqual(
lists:usort(combined_conflicting_records()),
lists:usort(emqx_acl_mnesia_db:all_acls_export())).
t_old_and_new_acl_migration(_Config) ->
create_conflicting_records(),
emqx_acl_mnesia_migrator:migrate_records(),
?assertEqual(combined_conflicting_records(), emqx_acl_mnesia_db:all_acls()),
?assertEqual(
lists:usort(combined_conflicting_records()),
lists:usort(emqx_acl_mnesia_db:all_acls_export())),
% check that old table is not popoulated anymore
ok = emqx_acl_mnesia_db:add_acl({clientid, <<"test_clientid">>}, <<"topic/%c">>, sub, allow),
?assert(emqx_acl_mnesia_migrator:is_old_table_migrated()).
t_migration_concurrency(_Config) ->
Key = {{clientid,<<"client6">>}, <<"t">>},
Record = #?ACL_TABLE{filter = Key, action = pubsub, access = deny, created_at = 0},
{atomic, ok} = mnesia:transaction(fun mnesia:write/1, [Record]),
LockWaitAndDelete =
fun() ->
[_Rec] = mnesia:wread({?ACL_TABLE, Key}),
{{Pid, Ref}, _} =
?wait_async_action(spawn_monitor(fun emqx_acl_mnesia_migrator:migrate_records/0),
#{?snk_kind := emqx_acl_mnesia_migrator_record_selected},
1000),
mnesia:delete({?ACL_TABLE, Key}),
{Pid, Ref}
end,
?check_trace(
begin
{atomic, {Pid, Ref}} = mnesia:transaction(LockWaitAndDelete),
receive {'DOWN', Ref, process, Pid, _} -> ok end
end,
fun(_, Trace) ->
?assertMatch([_], ?of_kind(emqx_acl_mnesia_migrator_record_missed, Trace))
end),
?assert(emqx_acl_mnesia_migrator:is_old_table_migrated()),
?assertEqual([], emqx_acl_mnesia_db:all_acls()).
t_old_and_new_acl_migration_by_migrator(_Config) ->
create_conflicting_records(),
meck:new(fake_nodes, [non_strict]),
meck:expect(fake_nodes, all, fun() -> [node(), 'somebadnode@127.0.0.1'] end),
?check_trace(
begin
% check all nodes every 30 ms
{ok, _} = emqx_acl_mnesia_migrator:start_link(#{
name => ct_migrator,
check_nodes_interval => 30,
get_nodes => fun fake_nodes:all/0
}),
timer:sleep(100)
end,
fun(_, Trace) ->
?assertEqual([], ?of_kind(emqx_acl_mnesia_migrator_start_migration, Trace))
end),
?check_trace(
begin
meck:expect(fake_nodes, all, fun() -> [node()] end),
timer:sleep(100)
end,
fun(_, Trace) ->
?assertMatch([_], ?of_kind(emqx_acl_mnesia_migrator_finish, Trace))
end),
meck:unload(fake_nodes),
?assertEqual(combined_conflicting_records(), emqx_acl_mnesia_db:all_acls()),
?assert(emqx_acl_mnesia_migrator:is_old_table_migrated()).
t_old_and_new_acl_migration_repeated_by_migrator(_Config) ->
create_conflicting_records(),
emqx_acl_mnesia_migrator:migrate_records(),
?check_trace(
begin
{ok, _} = emqx_acl_mnesia_migrator:start_link(ct_migrator),
timer:sleep(100)
end,
fun(_, Trace) ->
?assertEqual([], ?of_kind(emqx_acl_mnesia_migrator_start_migration, Trace)),
?assertMatch([_], ?of_kind(emqx_acl_mnesia_migrator_finish, Trace))
end).
t_start_stop_supervised(_Config) ->
?assertEqual(undefined, whereis(emqx_acl_mnesia_migrator)),
ok = emqx_acl_mnesia_migrator:start_supervised(),
?assert(is_pid(whereis(emqx_acl_mnesia_migrator))),
ok = emqx_acl_mnesia_migrator:stop_supervised(),
?assertEqual(undefined, whereis(emqx_acl_mnesia_migrator)).
t_acl_cli(_Config) ->
meck:new(emqx_ctl, [non_strict, passthrough]),
meck:expect(emqx_ctl, print, fun(Arg) -> emqx_ctl:format(Arg) end),
meck:expect(emqx_ctl, print, fun(Arg) -> emqx_ctl:format(Arg, []) end),
meck:expect(emqx_ctl, print, fun(Msg, Arg) -> emqx_ctl:format(Msg, Arg) end),
meck:expect(emqx_ctl, usage, fun(Usages) -> emqx_ctl:format_usage(Usages) end),
meck:expect(emqx_ctl, usage, fun(Cmd, Descr) -> emqx_ctl:format_usage(Cmd, Descr) end),
clean_all_acls(),
?assertEqual(0, length(emqx_acl_mnesia_cli:cli(["list"]))),
emqx_acl_mnesia_cli:cli(["add", "clientid", "test_clientid", "topic/A", "pub", "deny"]),
@ -202,8 +343,6 @@ t_acl_cli(_Config) ->
meck:unload(emqx_ctl).
t_rest_api(_Config) ->
clean_all_acls(),
Params1 = [#{<<"clientid">> => <<"test_clientid">>,
<<"topic">> => <<"topic/A">>,
<<"action">> => <<"pub">>,
@ -273,13 +412,28 @@ t_rest_api(_Config) ->
{ok, Res3} = request_http_rest_list(["$all"]),
?assertMatch([], get_http_data(Res3)).
%%------------------------------------------------------------------------------
%% Helpers
%%------------------------------------------------------------------------------
clean_all_acls() ->
[ mnesia:dirty_delete({emqx_acl, Login})
|| Login <- mnesia:dirty_all_keys(emqx_acl)].
create_conflicting_records() ->
Records = [
#?ACL_TABLE{ filter = {{clientid,<<"client6">>}, <<"t">>}
, action = pubsub, access = deny, created_at = 0
},
#?ACL_TABLE{ filter = {{clientid,<<"client5">>}, <<"t">>}
, action = pubsub, access = deny, created_at = 1
},
#?ACL_TABLE2{who = {clientid,<<"client5">>}, rules = [{allow, sub, <<"t">>, 2}]}
],
mnesia:transaction(fun() -> lists:foreach(fun mnesia:write/1, Records) end).
combined_conflicting_records() ->
% pubsub's are split, ACL_TABLE2 rules shadow ACL_TABLE rules
[
{{clientid,<<"client5">>},<<"t">>,sub,allow,2},
{{clientid,<<"client5">>},<<"t">>,pub,deny,1},
{{clientid,<<"client6">>},<<"t">>,sub,deny,0},
{{clientid,<<"client6">>},<<"t">>,pub,deny,0}
].
%%--------------------------------------------------------------------
%% HTTP Request

View File

@ -46,11 +46,15 @@ all() ->
groups() ->
[].
init_per_suite(t_boot) ->
ok;
init_per_suite(Config) ->
ok = emqx_ct_helpers:start_apps([emqx_management, emqx_auth_mnesia], fun set_special_configs/1),
create_default_app(),
Config.
end_per_suite(t_boot) ->
ok;
end_per_suite(_Config) ->
delete_default_app(),
emqx_ct_helpers:stop_apps([emqx_management, emqx_auth_mnesia]).
@ -65,10 +69,85 @@ set_special_configs(emqx) ->
set_special_configs(_App) ->
ok.
set_default(ClientId, UserName, Pwd, HashType) ->
application:set_env(emqx_auth_mnesia, clientid_list, [{ClientId, Pwd}]),
application:set_env(emqx_auth_mnesia, username_list, [{UserName, Pwd}]),
application:set_env(emqx_auth_mnesia, password_hash, HashType),
ok.
%%------------------------------------------------------------------------------
%% Testcases
%%------------------------------------------------------------------------------
t_boot(_Config) ->
clean_all_users(),
emqx_ct_helpers:stop_apps([emqx_auth_mnesia]),
ClientId = <<"clientid-test">>,
UserName = <<"username-test">>,
Pwd = <<"emqx123456">>,
ok = emqx_ct_helpers:start_apps([emqx_auth_mnesia],
fun(_) -> set_default(ClientId, UserName, Pwd, sha256) end),
Ok = {stop, #{anonymous => false, auth_result => success}},
Failed = {stop, #{anonymous => false, auth_result => password_error}},
?assertEqual(Ok,
emqx_auth_mnesia:check(#{clientid => ClientId, password => Pwd}, #{}, #{hash_type => sha256})),
?assertEqual(Ok,
emqx_auth_mnesia:check(#{clientid => <<"NotExited">>, username => UserName, password => Pwd},
#{}, #{hash_type => sha256})),
?assertEqual(Failed,
emqx_auth_mnesia:check(#{clientid => ClientId, password => <<Pwd/binary, "bad">>},
#{}, #{hash_type => sha256})),
?assertEqual(Failed,
emqx_auth_mnesia:check(#{clientid => ClientId, username => UserName, password => <<Pwd/binary, "bad">>},
#{}, #{hash_type => sha256})),
emqx_ct_helpers:stop_apps([emqx_auth_mnesia]),
%% change default pwd
NewPwd = <<"emqx654321">>,
ok = emqx_ct_helpers:start_apps([emqx_auth_mnesia],
fun(_) -> set_default(ClientId, UserName, NewPwd, sha256) end),
?assertEqual(Failed,
emqx_auth_mnesia:check(#{clientid => ClientId, password => NewPwd},
#{}, #{hash_type => sha256})),
?assertEqual(Failed,
emqx_auth_mnesia:check(#{clientid => <<"NotExited">>, username => UserName, password => NewPwd},
#{}, #{hash_type => sha256})),
clean_all_users(),
emqx_ct_helpers:stop_apps([emqx_auth_mnesia]),
ok = emqx_ct_helpers:start_apps([emqx_auth_mnesia],
fun(_) -> set_default(ClientId, UserName, NewPwd, sha256) end),
?assertEqual(Ok,
emqx_auth_mnesia:check(#{clientid => ClientId, password => NewPwd},
#{}, #{hash_type => sha256})),
?assertEqual(Ok,
emqx_auth_mnesia:check(#{clientid => <<"NotExited">>, username => UserName, password => NewPwd},
#{}, #{hash_type => sha256})),
emqx_ct_helpers:stop_apps([emqx_auth_mnesia]),
%% change hash_type
NewPwd2 = <<"emqx6543210">>,
ok = emqx_ct_helpers:start_apps([emqx_auth_mnesia],
fun(_) -> set_default(ClientId, UserName, NewPwd2, plain) end),
?assertEqual(Failed,
emqx_auth_mnesia:check(#{clientid => ClientId, password => NewPwd2},
#{}, #{hash_type => plain})),
?assertEqual(Failed,
emqx_auth_mnesia:check(#{clientid => <<"NotExited">>, username => UserName, password => NewPwd2},
#{}, #{hash_type => plain})),
clean_all_users(),
emqx_ct_helpers:stop_apps([emqx_auth_mnesia]),
ok = emqx_ct_helpers:start_apps([emqx_auth_mnesia],
fun(_) -> set_default(ClientId, UserName, NewPwd2, plain) end),
?assertEqual(Ok,
emqx_auth_mnesia:check(#{clientid => ClientId, password => NewPwd2},
#{}, #{hash_type => plain})),
?assertEqual(Ok,
emqx_auth_mnesia:check(#{clientid => <<"NotExited">>, username => UserName, password => NewPwd2},
#{}, #{hash_type => plain})),
clean_all_users(),
ok.
t_management(_Config) ->
clean_all_users(),

View File

@ -1,7 +1,7 @@
emqx_auth_mongo
===============
EMQ X Authentication/ACL with MongoDB
EMQX Authentication/ACL with MongoDB
Build the Plugin
----------------
@ -188,5 +188,5 @@ Apache License Version 2.0
Author
------
EMQ X Team.
EMQX Team.

View File

@ -78,7 +78,7 @@ auth.mongo.database = mqtt
## If not specified, the server's names returned in server's certificate is validated against
## what's provided `auth.mongo.server` config's host part.
## Setting to 'disable' will make EMQ X ignore unmatched server names.
## Setting to 'disable' will make EMQX ignore unmatched server names.
## If set with a host name, the server's names returned in server's certificate is validated
## against this value.
##

View File

@ -21,17 +21,8 @@
ignore = 'client.auth.ignore'
}).
-record(acl_metrics, {
allow = 'client.acl.allow',
deny = 'client.acl.deny',
ignore = 'client.acl.ignore'
}).
-define(METRICS(Type), tl(tuple_to_list(#Type{}))).
-define(METRICS(Type, K), #Type{}#Type.K).
-define(AUTH_METRICS, ?METRICS(auth_metrics)).
-define(AUTH_METRICS(K), ?METRICS(auth_metrics, K)).
-define(ACL_METRICS, ?METRICS(acl_metrics)).
-define(ACL_METRICS(K), ?METRICS(acl_metrics, K)).

View File

@ -141,6 +141,7 @@
Filter([{verify, Verify},
{server_name_indication, case cuttlefish:conf_get(Prefix ++ ".server_name_indication", Conf, undefined) of
"disable" -> disable;
"" -> undefined;
SNI -> SNI
end},
{keyfile, cuttlefish:conf_get(Prefix ++ ".keyfile", Conf, undefined)},

View File

@ -1,7 +1,6 @@
{deps,
%% NOTE: mind poolboy version when updating mongodb-erlang version
[{mongodb, {git,"https://github.com/emqx/mongodb-erlang", {tag, "v3.0.7"}}},
%% mongodb-erlang uses a special fork https://github.com/comtihon/poolboy.git
[%% mongodb-erlang uses a special fork https://github.com/comtihon/poolboy.git
%% (which has overflow_ttl feature added).
%% However, it references `{branch, "master}` (commit 9c06a9a on 2021-04-07).
%% By accident, We have always been using the upstream fork due to
@ -29,4 +28,3 @@
{cover_enabled, true}.
{cover_opts, [verbose]}.
{cover_export_enabled, true}.

View File

@ -21,17 +21,12 @@
-include_lib("emqx/include/logger.hrl").
%% ACL callbacks
-export([ register_metrics/0
, check_acl/5
-export([ check_acl/5
, description/0
]).
-spec(register_metrics() -> ok).
register_metrics() ->
lists:foreach(fun emqx_metrics:ensure/1, ?ACL_METRICS).
check_acl(#{username := <<$$, _/binary>>}, _PubSub, _Topic, _AclResult, _State) ->
ok;
check_acl(ClientInfo, PubSub, Topic, _AclResult, Env = #{aclquery := AclQuery}) ->
#aclquery{collection = Coll, selector = SelectorList} = AclQuery,
Pool = maps:get(pool, Env, ?APP),
@ -43,20 +38,16 @@ check_acl(ClientInfo, PubSub, Topic, _AclResult, Env = #{aclquery := AclQuery})
[] -> ok;
Rows ->
try match(ClientInfo, Topic, topics(PubSub, Rows)) of
matched -> emqx_metrics:inc(?ACL_METRICS(allow)),
{stop, allow};
nomatch -> emqx_metrics:inc(?ACL_METRICS(deny)),
{stop, deny}
matched -> {stop, allow};
nomatch -> {stop, deny}
catch
_Err:Reason->
?LOG(error, "[MongoDB] Check mongo ~p ACL failed, got ACL config: ~p, error: :~p",
[PubSub, Rows, Reason]),
emqx_metrics:inc(?ACL_METRICS(ignore)),
ignore
end
end.
match(_ClientInfo, _Topic, []) ->
nomatch;
match(ClientInfo, Topic, [TopicFilter|More]) ->

View File

@ -1,6 +1,6 @@
{application, emqx_auth_mongo,
[{description, "EMQ X Authentication/ACL with MongoDB"},
{vsn, "4.3.0"}, % strict semver, bump manually!
{vsn, "4.3.3"}, % strict semver, bump manually!
{modules, []},
{registered, [emqx_auth_mongo_sup]},
{applications, [kernel,stdlib,mongodb,ecpool]},

View File

@ -0,0 +1,25 @@
%% -*- mode: erlang -*-
%% Unless you know what you are doing, DO NOT edit manually!!
{VSN,
[{"4.3.2",
[{load_module,emqx_auth_mongo_app,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mongo,brutal_purge,soft_purge,[]}]},
{"4.3.1",
[{load_module,emqx_auth_mongo_app,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mongo,brutal_purge,soft_purge,[]}]},
{"4.3.0",
[{load_module,emqx_auth_mongo_app,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mongo,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_mongo,brutal_purge,soft_purge,[]}]},
{<<".*">>,[]}],
[{"4.3.2",
[{load_module,emqx_auth_mongo_app,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mongo,brutal_purge,soft_purge,[]}]},
{"4.3.1",
[{load_module,emqx_auth_mongo_app,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mongo,brutal_purge,soft_purge,[]}]},
{"4.3.0",
[{load_module,emqx_auth_mongo_app,brutal_purge,soft_purge,[]},
{load_module,emqx_auth_mongo,brutal_purge,soft_purge,[]},
{load_module,emqx_acl_mongo,brutal_purge,soft_purge,[]}]},
{<<".*">>,[]}]}.

View File

@ -35,6 +35,10 @@
, query_multi/3
]).
-export([ available/2
, available/3
]).
-spec(register_metrics() -> ok).
register_metrics() ->
lists:foreach(fun emqx_metrics:ensure/1, ?AUTH_METRICS).
@ -97,6 +101,56 @@ is_superuser(Pool, #superquery{collection = Coll, field = Field, selector = Sele
end
end.
%%--------------------------------------------------------------------
%% Availability Test
%%--------------------------------------------------------------------
available(Pool, #superquery{collection = Collection, selector = Selector}) ->
available(Pool, Collection, maps:from_list(replvars(Selector, test_client_info())));
available(Pool, #authquery{collection = Collection, selector = Selector}) ->
available(Pool, Collection, maps:from_list(replvars(Selector, test_client_info())));
available(Pool, #aclquery{collection = Collection, selector = Selectors}) ->
Fun =
fun(Selector) ->
maps:from_list(emqx_auth_mongo:replvars(Selector, test_client_info()))
end,
available(Pool, Collection, lists:map(Fun, Selectors), fun query_multi/3).
available(Pool, Collection, Query) ->
available(Pool, Collection, Query, fun query/3).
available(Pool, Collection, Query, Fun) ->
try Fun(Pool, Collection, Query) of
{error, Reason} ->
?LOG(error, "[MongoDB] ~p availability test error: ~0p", [Collection, Reason]),
{error, Reason};
Error = #{<<"code">> := Code} ->
CodeName = maps:get(<<"codeName">>, Error, undefined),
ErrorMessage = maps:get(<<"errmsg">>, Error, undefined),
?LOG(error, "[MongoDB] ~p availability test error, code: ~p Name: ~0p Message: ~0p",
[Collection, Code, CodeName, ErrorMessage]),
{error, {mongo_error, Code}};
_Return ->
%% Any success result is fine.
ok
catch E:R:S ->
?LOG(error, "[MongoDB] ~p availability test error, ~p: ~0p: ~0p", [Collection, E, R, S]),
{error, R}
end.
%% Test client info
test_client_info() ->
#{
clientid => <<"EMQX_availability_test_client">>,
username => <<"EMQX_availability_test_username">>,
cn => <<"EMQX_availability_test_cn">>,
dn => <<"EMQX_availability_test_dn">>
}.
%%--------------------------------------------------------------------
%% Internal func
%%--------------------------------------------------------------------
replvars(VarList, ClientInfo) ->
lists:map(fun(Var) -> replvar(Var, ClientInfo) end, VarList).
@ -129,6 +183,9 @@ query_multi(Pool, Collection, SelectorList) ->
lists:reverse(lists:flatten(lists:foldl(fun(Selector, Acc1) ->
Batch = ecpool:with_client(Pool, fun(Conn) ->
case mongo_api:find(Conn, Collection, Selector, #{}) of
{error, Reason} ->
?LOG(error, "[MongoDB] query_multi failed, got error: ~p", [Reason]),
[];
[] -> [];
{ok, Cursor} ->
mc_cursor:foldl(fun(O, Acc2) -> [O|Acc2] end, [], Cursor, 1000)

View File

@ -36,27 +36,65 @@
start(_StartType, _StartArgs) ->
{ok, Sup} = emqx_auth_mongo_sup:start_link(),
with_env(auth_query, fun reg_authmod/1),
with_env(acl_query, fun reg_aclmod/1),
ok = safe_start(),
{ok, Sup}.
prep_stop(State) ->
ok = emqx:unhook('client.authenticate', fun emqx_auth_mongo:check/3),
ok = emqx:unhook('client.check_acl', fun emqx_acl_mongo:check_acl/5),
ok = unload_hook(),
_ = stop_pool(),
State.
stop(_State) ->
ok.
unload_hook() ->
ok = emqx:unhook('client.authenticate', fun emqx_auth_mongo:check/3),
ok = emqx:unhook('client.check_acl', fun emqx_acl_mongo:check_acl/5).
stop_pool() ->
ecpool:stop_sup_pool(?APP).
safe_start() ->
try
ok = with_env(auth_query, fun reg_authmod/1),
ok = with_env(acl_query, fun reg_aclmod/1),
ok
catch _E:R:_S ->
unload_hook(),
_ = stop_pool(),
{error, R}
end.
reg_authmod(AuthQuery) ->
emqx_auth_mongo:register_metrics(),
SuperQuery = r(super_query, application:get_env(?APP, super_query, undefined)),
ok = emqx:hook('client.authenticate', fun emqx_auth_mongo:check/3,
[#{authquery => AuthQuery, superquery => SuperQuery, pool => ?APP}]).
case emqx_auth_mongo:available(?APP, AuthQuery) of
ok ->
emqx_auth_mongo:register_metrics(),
HookFun = fun emqx_auth_mongo:check/3,
HookOptions = #{authquery => AuthQuery, superquery => undefined, pool => ?APP},
case r(super_query, application:get_env(?APP, super_query, undefined)) of
undefined ->
ok = emqx:hook('client.authenticate', HookFun, [HookOptions]);
SuperQuery ->
case emqx_auth_mongo:available(?APP, SuperQuery) of
ok ->
ok = emqx:hook('client.authenticate', HookFun,
[HookOptions#{superquery => SuperQuery}]);
{error, Reason} ->
{error, Reason}
end
end;
{error, Reason} ->
{error, Reason}
end.
reg_aclmod(AclQuery) ->
emqx_acl_mongo:register_metrics(),
ok = emqx:hook('client.check_acl', fun emqx_acl_mongo:check_acl/5, [#{aclquery => AclQuery, pool => ?APP}]).
case emqx_auth_mongo:available(?APP, AclQuery) of
ok ->
ok = emqx:hook('client.check_acl', fun emqx_acl_mongo:check_acl/5,
[#{aclquery => AclQuery, pool => ?APP}]);
{error, Reason} ->
{error, Reason}
end.
%%--------------------------------------------------------------------
%% Internal functions

View File

@ -164,4 +164,4 @@ Apache License Version 2.0
Author
------
EMQ X Team.
EMQX Team.

View File

@ -123,7 +123,7 @@ auth.mysql.acl_query = select allow, ipaddr, username, clientid, access, topic f
## If not specified, the server's names returned in server's certificate is validated against
## what's provided `auth.mysql.server` config's host part.
## Setting to 'disable' will make EMQ X ignore unmatched server names.
## Setting to 'disable' will make EMQX ignore unmatched server names.
## If set with a host name, the server's names returned in server's certificate is validated
## against this value.
##

View File

@ -7,17 +7,8 @@
ignore = 'client.auth.ignore'
}).
-record(acl_metrics, {
allow = 'client.acl.allow',
deny = 'client.acl.deny',
ignore = 'client.acl.ignore'
}).
-define(METRICS(Type), tl(tuple_to_list(#Type{}))).
-define(METRICS(Type, K), #Type{}#Type.K).
-define(AUTH_METRICS, ?METRICS(auth_metrics)).
-define(AUTH_METRICS(K), ?METRICS(auth_metrics, K)).
-define(ACL_METRICS, ?METRICS(acl_metrics)).
-define(ACL_METRICS(K), ?METRICS(acl_metrics, K)).

View File

@ -109,6 +109,7 @@
end,
SNI = case cuttlefish:conf_get("auth.mysql.ssl.server_name_indication", Conf, undefined) of
"disable" -> disable;
"" -> undefined;
SNI0 -> SNI0
end,
Options ++ [{ssl, Filter([{server_name_indication, SNI},

View File

@ -22,20 +22,15 @@
-include_lib("emqx/include/logger.hrl").
%% ACL Callbacks
-export([ register_metrics/0
, check_acl/5
-export([ check_acl/5
, description/0
]).
-spec(register_metrics() -> ok).
register_metrics() ->
lists:foreach(fun emqx_metrics:ensure/1, ?ACL_METRICS).
check_acl(ClientInfo, PubSub, Topic, NoMatchAction, #{pool := Pool} = State) ->
case do_check_acl(Pool, ClientInfo, PubSub, Topic, NoMatchAction, State) of
ok -> emqx_metrics:inc(?ACL_METRICS(ignore)), ok;
{stop, allow} -> emqx_metrics:inc(?ACL_METRICS(allow)), {stop, allow};
{stop, deny} -> emqx_metrics:inc(?ACL_METRICS(deny)), {stop, deny}
ok -> ok;
{stop, allow} -> {stop, allow};
{stop, deny} -> {stop, deny}
end.
do_check_acl(_Pool, #{username := <<$$, _/binary>>}, _PubSub, _Topic, _NoMatchAction, _State) ->

View File

@ -1,6 +1,6 @@
{application, emqx_auth_mysql,
[{description, "EMQ X Authentication/ACL with MySQL"},
{vsn, "4.3.0"}, % strict semver, bump manually!
{vsn, "4.3.2"}, % strict semver, bump manually!
{modules, []},
{registered, [emqx_auth_mysql_sup]},
{applications, [kernel,stdlib,mysql,ecpool]},

Some files were not shown because too many files have changed in this diff Show More