diff --git a/apps/dgiot/erlang.mk b/apps/dgiot/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_api/Makefile b/apps/dgiot_api/Makefile deleted file mode 100644 index 11b4976d03..0000000000 --- a/apps/dgiot_api/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -PROJECT = dgiot_api -PROJECT_DESCRIPTION = dgiot_api - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = cuttlefish -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -COVER = true - -include erlang.mk - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_api.conf -i priv/dgiot_api.schema -d data diff --git a/apps/dgiot_api/rebar.config b/apps/dgiot_api/rebar.config index b9d8bab193..e8e0e60c28 100644 --- a/apps/dgiot_api/rebar.config +++ b/apps/dgiot_api/rebar.config @@ -6,3 +6,26 @@ % {config, "config/sys.config"}, {apps, [dgiot_api]} ]}. + +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_bridge/rebar.config b/apps/dgiot_bridge/rebar.config index 9780e57204..30982fd5f1 100644 --- a/apps/dgiot_bridge/rebar.config +++ b/apps/dgiot_bridge/rebar.config @@ -1,2 +1,24 @@ -{deps, [ -]}. +{deps, []}. + +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_device/erlang.mk b/apps/dgiot_device/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_device/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_device/rebar.config b/apps/dgiot_device/rebar.config index 0e038ed028..19c93855c5 100644 --- a/apps/dgiot_device/rebar.config +++ b/apps/dgiot_device/rebar.config @@ -1,3 +1,26 @@ {deps, [ {ibrowse, {git, "https://gitee.com/fastdgiot/ibrowse.git", {tag, "v4.4.2"}}} ]}. + +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_evidence/.travis.yml b/apps/dgiot_evidence/.travis.yml deleted file mode 100644 index 7e574529f3..0000000000 --- a/apps/dgiot_evidence/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: erlang - -otp_release: - - 21.3 - -before_install: - - git clone https://github.com/erlang/rebar3.git; cd rebar3; ./bootstrap; sudo mv rebar3 /usr/local/bin/; cd .. - -script: - - make xref - - make eunit - - make ct - -after_success: - - make coveralls - -sudo: false diff --git a/apps/dgiot_evidence/Makefile b/apps/dgiot_evidence/Makefile deleted file mode 100644 index d20202a19a..0000000000 --- a/apps/dgiot_evidence/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -PROJECT = dgiot_evidence -PROJECT_DESCRIPTION = dgiot_evidence Plugin -PROJECT_VERSION = 1.6.4 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -COVER = true - -include erlang.mk - -app:: rebar.config - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_evidence.conf -i priv/dgiot_evidence.schema -d data - diff --git a/apps/dgiot_evidence/erlang.mk b/apps/dgiot_evidence/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_evidence/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_evidence/rebar.config b/apps/dgiot_evidence/rebar.config index 6d6bfe1a49..30982fd5f1 100644 --- a/apps/dgiot_evidence/rebar.config +++ b/apps/dgiot_evidence/rebar.config @@ -1,3 +1,24 @@ -{deps, [ +{deps, []}. -]}. +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_ffmpeg/Makefile b/apps/dgiot_ffmpeg/Makefile deleted file mode 100644 index 4b682e293c..0000000000 --- a/apps/dgiot_ffmpeg/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -## shallow clone for speed - -REBAR_GIT_CLONE_OPTIONS += --depth 1 -export REBAR_GIT_CLONE_OPTIONS - -REBAR = rebar3 - -CT_NODE_NAME = emqxct@127.0.0.1 - -all: compile - -compile: unlock - $(REBAR) compile - -clean: distclean - -ct: compile - $(REBAR) as test ct -v --readable=false --name $(CT_NODE_NAME) - -eunit: compile - $(REBAR) as test eunit - -unlock: - $(REBAR) unlock - -xref: - $(REBAR) xref - -cover: - $(REBAR) cover - -distclean: - @rm -rf _build - @rm -f data/app.*.config data/vm.*.args rebar.lock - -CUTTLEFISH_SCRIPT = _build/default/lib/cuttlefish/cuttlefish - -$(CUTTLEFISH_SCRIPT): - @${REBAR} get-deps - @if [ ! -f cuttlefish ]; then make -C _build/default/lib/cuttlefish; fi - -app.config: $(CUTTLEFISH_SCRIPT) - $(verbose) $(CUTTLEFISH_SCRIPT) -l info -e etc/ -c etc/dgiot_ffmpeg.conf -i priv/dgiot_ffmpeg.schema -d data diff --git a/apps/dgiot_ffmpeg/rebar.config b/apps/dgiot_ffmpeg/rebar.config index 8d771890b5..9b314fe172 100644 --- a/apps/dgiot_ffmpeg/rebar.config +++ b/apps/dgiot_ffmpeg/rebar.config @@ -1,14 +1,11 @@ -{deps, - [{minirest, {git, "https://github.com/emqx/minirest", {tag, "v0.2.6"}}}, - {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.0.0"}}} - ]}. +{deps, []}. {profiles, [{test, [{deps, - [{emqx_ct_helpers, {git, "https://github.com/emqx/emqx-ct-helpers", {branch, "develop"}}}, - {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.1.1"}}}, - meck + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}, + meck ]} ]} ]}. diff --git a/apps/dgiot_gb26875/Makefile b/apps/dgiot_gb26875/Makefile deleted file mode 100644 index a91e2f4e3d..0000000000 --- a/apps/dgiot_gb26875/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -PROJECT = dgiot_gb26875 -PROJECT_DESCRIPTION = dgiot_gb26875 Protocol Plugin -PROJECT_VERSION = 4.3.0 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish lager -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 -dep_lager = git https://github.com/basho/lager master - -DIALYZER_DIRS := ebin/ -DIALYZER_OPTS := --verbose --statistics -Werror_handling \ - -Wrace_conditions #-Wunmatched_returns - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -include erlang.mk - -app:: rebar.config - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_gb26875.conf -d data diff --git a/apps/dgiot_group/Makefile b/apps/dgiot_group/Makefile deleted file mode 100644 index 797cf9741f..0000000000 --- a/apps/dgiot_group/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -PROJECT = shuwa_group -PROJECT_DESCRIPTION = shuwa_group Plugin -PROJECT_VERSION = 1.5.4 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -DIALYZER_DIRS := ebin/ -DIALYZER_OPTS := --verbose --statistics -Werror_handling \ - -Wrace_conditions #-Wunmatched_returns - -include erlang.mk - -app.shuwa_group:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_group.conf -i priv/dgiot_group.schema -d data diff --git a/apps/dgiot_group/erlang.mk b/apps/dgiot_group/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_group/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_group/rebar.config b/apps/dgiot_group/rebar.config index 6d6bfe1a49..30982fd5f1 100644 --- a/apps/dgiot_group/rebar.config +++ b/apps/dgiot_group/rebar.config @@ -1,3 +1,24 @@ -{deps, [ +{deps, []}. -]}. +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_grpc/Makefile b/apps/dgiot_grpc/Makefile deleted file mode 100644 index 5c37cbadc0..0000000000 --- a/apps/dgiot_grpc/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -PROJECT = dgiot_grpc -PROJECT_DESCRIPTION = dgiot_grpc Plugin -PROJECT_VERSION = 1.5.4 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -DIALYZER_DIRS := ebin/ -DIALYZER_OPTS := --verbose --statistics -Werror_handling \ - -Wrace_conditions #-Wunmatched_returns - -ERLC_OPTS += +'{parse_transform, lager_transform}' - - -include erlang.mk - -app.dgiot_group:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_grpc.conf -i priv/dgiot_grpc.schema -d data diff --git a/apps/dgiot_grpc/erlang.mk b/apps/dgiot_grpc/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_grpc/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_http/Makefile b/apps/dgiot_http/Makefile deleted file mode 100644 index d7a6f29f9c..0000000000 --- a/apps/dgiot_http/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -PROJECT = dgiot_api -PROJECT_DESCRIPTION = dgiot_api - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = cuttlefish -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -COVER = true - -include erlang.mk - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_http.conf -i priv/dgiot_http.schema -d data diff --git a/apps/dgiot_http/rebar.config b/apps/dgiot_http/rebar.config index 8d8f2282eb..0fad829c7b 100644 --- a/apps/dgiot_http/rebar.config +++ b/apps/dgiot_http/rebar.config @@ -6,3 +6,27 @@ % {config, "config/sys.config"}, {apps, [dgiot_http]} ]}. + + +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_iq60/Makefile b/apps/dgiot_iq60/Makefile deleted file mode 100644 index 50e7f3556b..0000000000 --- a/apps/dgiot_iq60/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -PROJECT = dgiot_iq60 -PROJECT_DESCRIPTION = dgiot_iq60 Plugin -PROJECT_VERSION = 1.5.4 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -DIALYZER_DIRS := ebin/ -DIALYZER_OPTS := --verbose --statistics -Werror_handling \ - -Wrace_conditions #-Wunmatched_returns - -ERLC_OPTS += +'{parse_transform, lager_transform}' - - -include erlang.mk - -app.dgiot_group:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_iq60.conf -i priv/dgiot_iq60.schema -d data diff --git a/apps/dgiot_iq60/erlang.mk b/apps/dgiot_iq60/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_iq60/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_license/.travis.yml b/apps/dgiot_license/.travis.yml deleted file mode 100644 index 7e574529f3..0000000000 --- a/apps/dgiot_license/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: erlang - -otp_release: - - 21.3 - -before_install: - - git clone https://github.com/erlang/rebar3.git; cd rebar3; ./bootstrap; sudo mv rebar3 /usr/local/bin/; cd .. - -script: - - make xref - - make eunit - - make ct - -after_success: - - make coveralls - -sudo: false diff --git a/apps/dgiot_license/Makefile b/apps/dgiot_license/Makefile deleted file mode 100644 index 2eccd73d85..0000000000 --- a/apps/dgiot_license/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -PROJECT = dgiot_license -PROJECT_DESCRIPTION = dgiot_license Plugin -PROJECT_VERSION = 1.5.4 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -COVER = true - -include erlang.mk - -app:: rebar.config - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_license.conf -i priv/dgiot_license.schema -d data - diff --git a/apps/dgiot_license/rebar.config b/apps/dgiot_license/rebar.config index 6d6bfe1a49..30982fd5f1 100644 --- a/apps/dgiot_license/rebar.config +++ b/apps/dgiot_license/rebar.config @@ -1,3 +1,24 @@ -{deps, [ +{deps, []}. -]}. +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_location/Makefile b/apps/dgiot_location/Makefile deleted file mode 100644 index a23ae7cdd1..0000000000 --- a/apps/dgiot_location/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -PROJECT = dgiot_location -PROJECT_DESCRIPTION = dgiot_location Plugin -PROJECT_VERSION = 1.5.4 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -DIALYZER_DIRS := ebin/ -DIALYZER_OPTS := --verbose --statistics -Werror_handling \ - -Wrace_conditions #-Wunmatched_returns - -ERLC_OPTS += +'{parse_transform, lager_transform}' - - -include erlang.mk - -app.dgiot_group:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_location.conf -i priv/dgiot_location.schema -d data diff --git a/apps/dgiot_location/erlang.mk b/apps/dgiot_location/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_location/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_location/rebar.config b/apps/dgiot_location/rebar.config index 7d2e3f6876..e172333bc0 100644 --- a/apps/dgiot_location/rebar.config +++ b/apps/dgiot_location/rebar.config @@ -1,3 +1,26 @@ {deps, [ {locus, {git, "https://gitee.com/fastdgiot/locus.git", {tag, "2.2.2"}}} ]}. + +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_matlab/Makefile b/apps/dgiot_matlab/Makefile deleted file mode 100644 index 1447287a0f..0000000000 --- a/apps/dgiot_matlab/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -PROJECT = dgiot_matlab -PROJECT_DESCRIPTION = dgiot_matlab Plugin -PROJECT_VERSION = 1.5.4 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -DIALYZER_DIRS := ebin/ -DIALYZER_OPTS := --verbose --statistics -Werror_handling \ - -Wrace_conditions #-Wunmatched_returns - -ERLC_OPTS += +'{parse_transform, lager_transform}' - - -include erlang.mk - -app.dgiot_group:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_matlab.conf -i priv/dgiot_matlab.schema -d data diff --git a/apps/dgiot_matlab/erlang.mk b/apps/dgiot_matlab/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_matlab/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_matlab/rebar.config b/apps/dgiot_matlab/rebar.config index 6d6bfe1a49..30982fd5f1 100644 --- a/apps/dgiot_matlab/rebar.config +++ b/apps/dgiot_matlab/rebar.config @@ -1,3 +1,24 @@ -{deps, [ +{deps, []}. -]}. +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_meter/Makefile b/apps/dgiot_meter/Makefile deleted file mode 100644 index 24c429a76d..0000000000 --- a/apps/dgiot_meter/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -PROJECT = dgiot_meter -PROJECT_DESCRIPTION = dgiot_meter Plugin -PROJECT_VERSION = 1.5.4 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -DIALYZER_DIRS := ebin/ -DIALYZER_OPTS := --verbose --statistics -Werror_handling \ - -Wrace_conditions #-Wunmatched_returns - -ERLC_OPTS += +'{parse_transform, lager_transform}' - - -include erlang.mk - -app.dgiot_group:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_meter.conf -i priv/dgiot_meter.schema -d data diff --git a/apps/dgiot_meter/erlang.mk b/apps/dgiot_meter/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_meter/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_meter/rebar.config b/apps/dgiot_meter/rebar.config index 6d6bfe1a49..30982fd5f1 100644 --- a/apps/dgiot_meter/rebar.config +++ b/apps/dgiot_meter/rebar.config @@ -1,3 +1,24 @@ -{deps, [ +{deps, []}. -]}. +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_modbus/Makefile b/apps/dgiot_modbus/Makefile deleted file mode 100644 index f45c42c0dc..0000000000 --- a/apps/dgiot_modbus/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -PROJECT = shuwa_modbus -PROJECT_DESCRIPTION = shuwa_modbus Protocol Plugin -PROJECT_VERSION = 1.5.4 - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish lager -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 -dep_lager = git https://github.com/basho/lager master - -DIALYZER_DIRS := ebin/ -DIALYZER_OPTS := --verbose --statistics -Werror_handling \ - -Wrace_conditions #-Wunmatched_returns - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -include erlang.mk - -app:: rebar.config - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/shuwa_modbus.conf -d data \ No newline at end of file diff --git a/apps/dgiot_modbus/rebar.config b/apps/dgiot_modbus/rebar.config index 9780e57204..30982fd5f1 100644 --- a/apps/dgiot_modbus/rebar.config +++ b/apps/dgiot_modbus/rebar.config @@ -1,2 +1,24 @@ -{deps, [ -]}. +{deps, []}. + +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_mqtt/erlang.mk b/apps/dgiot_mqtt/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_mqtt/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_mqtt/rebar.config b/apps/dgiot_mqtt/rebar.config index 9780e57204..30982fd5f1 100644 --- a/apps/dgiot_mqtt/rebar.config +++ b/apps/dgiot_mqtt/rebar.config @@ -1,2 +1,24 @@ -{deps, [ -]}. +{deps, []}. + +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_mqtt/src/dgiot_mqtt_acl.erl b/apps/dgiot_mqtt/src/dgiot_mqtt_acl.erl new file mode 100644 index 0000000000..b5b2d49e98 --- /dev/null +++ b/apps/dgiot_mqtt/src/dgiot_mqtt_acl.erl @@ -0,0 +1,76 @@ +%%-------------------------------------------------------------------- +%% Copyright (c) 2020-2021 DGIOT 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(dgiot_mqtt_acl). + +%%-include("emqx_auth_mnesia.hrl"). + +%% ACL Callbacks +-export([ + check_acl/5 + , description/0 + ]). + +check_acl(ClientInfo = #{ clientid := _Clientid }, PubSub, Topic, _NoMatchAction, _Params) -> + _Username = maps:get(username, ClientInfo, undefined), + + Acls = [], + case match(ClientInfo, PubSub, Topic, Acls) of + allow -> + ok; +%% {stop, allow}; + deny -> +%% {stop, deny}; + {stop, allow}; + _ -> + ok + end. + +description() -> "Acl with Mnesia". + +%%-------------------------------------------------------------------- +%% Internal functions +%%------------------------------------------------------------------- + +match(_ClientInfo, _PubSub, _Topic, []) -> + nomatch; +match(ClientInfo, PubSub, Topic, [ {_, ACLTopic, Action, Access, _} | Acls]) -> + case match_actions(PubSub, Action) andalso match_topic(ClientInfo, Topic, ACLTopic) of + true -> Access; + false -> match(ClientInfo, PubSub, Topic, Acls) + end. + +match_topic(ClientInfo, Topic, ACLTopic) when is_binary(Topic) -> + emqx_topic:match(Topic, feed_var(ClientInfo, ACLTopic)). + +match_actions(subscribe, sub) -> true; +match_actions(publish, pub) -> true; +match_actions(_, _) -> false. + +feed_var(ClientInfo, Pattern) -> + feed_var(ClientInfo, emqx_topic:words(Pattern), []). +feed_var(_ClientInfo, [], Acc) -> + emqx_topic:join(lists:reverse(Acc)); +feed_var(ClientInfo = #{clientid := undefined}, [<<"%c">>|Words], Acc) -> + feed_var(ClientInfo, Words, [<<"%c">>|Acc]); +feed_var(ClientInfo = #{clientid := ClientId}, [<<"%c">>|Words], Acc) -> + feed_var(ClientInfo, Words, [ClientId |Acc]); +feed_var(ClientInfo = #{username := undefined}, [<<"%u">>|Words], Acc) -> + feed_var(ClientInfo, Words, [<<"%u">>|Acc]); +feed_var(ClientInfo = #{username := Username}, [<<"%u">>|Words], Acc) -> + feed_var(ClientInfo, Words, [Username|Acc]); +feed_var(ClientInfo, [W|Words], Acc) -> + feed_var(ClientInfo, Words, [W|Acc]). diff --git a/apps/dgiot_mqtt/src/dgiot_mqtt_auth.erl b/apps/dgiot_mqtt/src/dgiot_mqtt_auth.erl new file mode 100644 index 0000000000..ff7248a6b0 --- /dev/null +++ b/apps/dgiot_mqtt/src/dgiot_mqtt_auth.erl @@ -0,0 +1,82 @@ +%%-------------------------------------------------------------------- +%% Copyright (c) 2020-2021 DGIOT 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(dgiot_mqtt_auth). + +%%-include("emqx_auth_mnesia.hrl"). +%% +%%-include_lib("emqx/include/emqx.hrl"). +%%-include_lib("emqx/include/logger.hrl"). +%%-include_lib("emqx/include/types.hrl"). +%% +%%-include_lib("stdlib/include/ms_transform.hrl"). +%% +-define(TABLE, emqx_user). +%% Auth callbacks +-export([ + check/3 + , description/0 +]). + + +check(ClientInfo = #{clientid := _Clientid + , password := NPassword +}, AuthResult, #{hash_type := HashType}) -> + _Username = maps:get(username, ClientInfo, undefined), + List = [], + case match_password(NPassword, HashType, List) of + false -> +%% ?LOG(error, "[Mnesia] Auth from mnesia failed: ~p", [ClientInfo]), + {stop, AuthResult#{anonymous => false, auth_result => password_error}}; + _ -> + + {stop, AuthResult#{anonymous => false, auth_result => success}} + end. + +description() -> "Authentication with Mnesia". + + +match_password(Password, HashType, HashList) -> + lists:any( + fun(Secret) -> + case is_salt_hash(Secret, HashType) of + true -> + <> = Secret, + Hash =:= hash(Password, Salt, HashType); + _ -> + Secret =:= hash(Password, HashType) + end + end, HashList). + +hash(undefined, HashType) -> + hash(<<>>, HashType); +hash(Password, HashType) -> + emqx_passwd:hash(HashType, Password). + +hash(undefined, SaltBin, HashType) -> + hash(<<>>, SaltBin, HashType); +hash(Password, SaltBin, HashType) -> + emqx_passwd:hash(HashType, <>). + +is_salt_hash(_, plain) -> + true; +is_salt_hash(Secret, HashType) -> + not (byte_size(Secret) == len(HashType)). + +len(md5) -> 32; +len(sha) -> 40; +len(sha256) -> 64; +len(sha512) -> 128. diff --git a/apps/dgiot_mqtt/src/dgiot_mqtt_channel.erl b/apps/dgiot_mqtt/src/dgiot_mqtt_channel.erl index a0b102a294..62b7eaeb71 100644 --- a/apps/dgiot_mqtt/src/dgiot_mqtt_channel.erl +++ b/apps/dgiot_mqtt/src/dgiot_mqtt_channel.erl @@ -13,6 +13,7 @@ %% See the License for the specific language governing permissions and %% limitations under the License. %%-------------------------------------------------------------------- + -module(dgiot_mqtt_channel). -behavior(dgiot_channelx). -define(TYPE, <<"MQTT">>). @@ -75,6 +76,8 @@ start(ChannelId, ChannelArgs) -> init(?TYPE, ChannelId, #{ <<"product">> := Products, <<"auth">> := Auth}) -> + load_auth_hook(), + load_acl_hook(), %% io:format("Products = ~p.~n", [Products]), lists:map(fun(X) -> case X of @@ -267,3 +270,11 @@ create_rules(RuleID, ChannelId, Description, Rawsql, Target_topic) -> end end. + +load_auth_hook() -> +%% emqx:hook('client.authenticate', fun dgiot_mqtt_auth:check/3, []). + ok. + +load_acl_hook() -> +%% emqx:hook('client.check_acl', fun dgiot_mqtt_acl:check_acl/5, [#{}]). + ok. diff --git a/apps/dgiot_niisten/Makefile b/apps/dgiot_niisten/Makefile deleted file mode 100644 index 12be0dcf2b..0000000000 --- a/apps/dgiot_niisten/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -PROJECT = dgiot_acrel -PROJECT_DESCRIPTION = dgiot_acrel - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish ekaf jsx brod supervisor3 -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -ERLC_OPTS += +debug_info - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -NO_AUTOPATCH = cuttlefish - -COVER = true - -$(shell [ -f erlang.mk ] || curl -s -o erlang.mk https://raw.githubusercontent.com/emqx/erlmk/master/erlang.mk) - -include erlang.mk - -app:: rebar.config - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_niisten.conf -i priv/dgiot_niisten.schema -d data diff --git a/apps/dgiot_niisten/erlang.mk b/apps/dgiot_niisten/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_niisten/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_niisten/rebar.config b/apps/dgiot_niisten/rebar.config index 6d6bfe1a49..30982fd5f1 100644 --- a/apps/dgiot_niisten/rebar.config +++ b/apps/dgiot_niisten/rebar.config @@ -1,3 +1,24 @@ -{deps, [ +{deps, []}. -]}. +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_opc/Makefile b/apps/dgiot_opc/Makefile deleted file mode 100644 index 358716eea7..0000000000 --- a/apps/dgiot_opc/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -PROJECT = dgiot_opc -PROJECT_DESCRIPTION = dgiot_opc - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish ekaf jsx brod supervisor3 -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -ERLC_OPTS += +debug_info - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -NO_AUTOPATCH = cuttlefish - -COVER = true - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -$(shell [ -f erlang.mk ] || curl -s -o erlang.mk https://raw.githubusercontent.com/emqx/erlmk/master/erlang.mk) - -include erlang.mk - -app:: rebar.config - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_opc.conf -i priv/dgiot_opc.schema -d data diff --git a/apps/dgiot_opc/erlang.mk b/apps/dgiot_opc/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_opc/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_opc/rebar.config b/apps/dgiot_opc/rebar.config index 6d6bfe1a49..30982fd5f1 100644 --- a/apps/dgiot_opc/rebar.config +++ b/apps/dgiot_opc/rebar.config @@ -1,3 +1,24 @@ -{deps, [ +{deps, []}. -]}. +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_parse/Makefile b/apps/dgiot_parse/Makefile deleted file mode 100644 index 5143abebd1..0000000000 --- a/apps/dgiot_parse/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -PROJECT = dgiot_parse -PROJECT_DESCRIPTION = dgiot_parse - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = cuttlefish -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -COVER = true - -include erlang.mk - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_parse.conf -i priv/dgiot_parse.schema -d data diff --git a/apps/dgiot_parse/erlang.mk b/apps/dgiot_parse/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_parse/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_parse/rebar.config b/apps/dgiot_parse/rebar.config index e8124c8317..30982fd5f1 100644 --- a/apps/dgiot_parse/rebar.config +++ b/apps/dgiot_parse/rebar.config @@ -1,15 +1,24 @@ -{deps, [ +{deps, []}. -]}. {edoc_opts, [{preprocess, true}]}. {erl_opts, [warn_unused_vars, warn_shadow_vars, warn_unused_import, warn_obsolete_guard, - debug_info]}. + debug_info, + {parse_transform}]}. {xref_checks, [undefined_function_calls, undefined_functions, - locals_not_used]}. + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. {cover_enabled, true}. {cover_opts, [verbose]}. {cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_task/Makefile b/apps/dgiot_task/Makefile deleted file mode 100644 index fe2a9f2c47..0000000000 --- a/apps/dgiot_task/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -## shallow clone for speed - -REBAR_GIT_CLONE_OPTIONS += --depth 1 -export REBAR_GIT_CLONE_OPTIONS - -REBAR = rebar3 - -CT_NODE_NAME = emqxct@127.0.0.1 - -all: compile - -compile: unlock - $(REBAR) compile - -clean: distclean - -ct: compile - $(REBAR) as test ct -v --readable=false --name $(CT_NODE_NAME) - -eunit: compile - $(REBAR) as test eunit - -unlock: - $(REBAR) unlock - -xref: - $(REBAR) xref - -cover: - $(REBAR) cover - -distclean: - @rm -rf _build - @rm -f data/app.*.config data/vm.*.args rebar.lock - -CUTTLEFISH_SCRIPT = _build/default/lib/cuttlefish/cuttlefish - -$(CUTTLEFISH_SCRIPT): - @${REBAR} get-deps - @if [ ! -f cuttlefish ]; then make -C _build/default/lib/cuttlefish; fi - -app.config: $(CUTTLEFISH_SCRIPT) - $(verbose) $(CUTTLEFISH_SCRIPT) -l info -e etc/ -c etc/dgiot_task.conf -i priv/dgiot_task.schema -d data diff --git a/apps/dgiot_task/erlang.mk b/apps/dgiot_task/erlang.mk deleted file mode 100644 index 8930dfc442..0000000000 --- a/apps/dgiot_task/erlang.mk +++ /dev/null @@ -1 +0,0 @@ -include ../../erlang.mk diff --git a/apps/dgiot_task/rebar.config b/apps/dgiot_task/rebar.config index a6f7981250..30982fd5f1 100644 --- a/apps/dgiot_task/rebar.config +++ b/apps/dgiot_task/rebar.config @@ -1,3 +1,24 @@ -{deps, - [ +{deps, []}. + +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} ]}. diff --git a/apps/dgiot_tdengine/Makefile b/apps/dgiot_tdengine/Makefile deleted file mode 100644 index 8e622b2ec6..0000000000 --- a/apps/dgiot_tdengine/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -## shallow clone for speed - -REBAR_GIT_CLONE_OPTIONS += --depth 1 -export REBAR_GIT_CLONE_OPTIONS - -REBAR = rebar3 - -CT_NODE_NAME = emqxct@127.0.0.1 - -all: compile - -compile: unlock - $(REBAR) compile - -clean: distclean - -ct: compile - $(REBAR) as test ct -v --readable=false --name $(CT_NODE_NAME) - -eunit: compile - $(REBAR) as test eunit - -unlock: - $(REBAR) unlock - -xref: - $(REBAR) xref - -cover: - $(REBAR) cover - -distclean: - @rm -rf _build - @rm -f data/app.*.config data/vm.*.args rebar.lock - -CUTTLEFISH_SCRIPT = _build/default/lib/cuttlefish/cuttlefish - -$(CUTTLEFISH_SCRIPT): - @${REBAR} get-deps - @if [ ! -f cuttlefish ]; then make -C _build/default/lib/cuttlefish; fi - -app.config: $(CUTTLEFISH_SCRIPT) - $(verbose) $(CUTTLEFISH_SCRIPT) -l info -e etc/ -c etc/dgiot_tdengine.conf -i priv/dgiot_tdengine.schema -d data diff --git a/apps/dgiot_tdengine/rebar.config b/apps/dgiot_tdengine/rebar.config index 7b30a8fd87..30982fd5f1 100644 --- a/apps/dgiot_tdengine/rebar.config +++ b/apps/dgiot_tdengine/rebar.config @@ -1 +1,24 @@ {deps, []}. + +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/apps/dgiot_tdengine/rebar3 b/apps/dgiot_tdengine/rebar3 deleted file mode 100644 index b2247d6853..0000000000 Binary files a/apps/dgiot_tdengine/rebar3 and /dev/null differ diff --git a/apps/dgiot_topo/Makefile b/apps/dgiot_topo/Makefile deleted file mode 100644 index 633f289b7b..0000000000 --- a/apps/dgiot_topo/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -PROJECT = dgiot_opc -PROJECT_DESCRIPTION = dgiot_opc - -CUR_BRANCH := $(shell git branch | grep -e "^*" | cut -d' ' -f 2) -BRANCH := $(if $(filter $(CUR_BRANCH), master develop), $(CUR_BRANCH), develop) - -BUILD_DEPS = emqx cuttlefish ekaf jsx brod supervisor3 -dep_emqx = git-emqx https://github.com/emqx/emqx $(BRANCH) -dep_cuttlefish = git-emqx https://github.com/emqx/cuttlefish v2.2.1 - -ERLC_OPTS += +debug_info - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -NO_AUTOPATCH = cuttlefish - -COVER = true - -ERLC_OPTS += +'{parse_transform, lager_transform}' - -$(shell [ -f erlang.mk ] || curl -s -o erlang.mk https://raw.githubusercontent.com/emqx/erlmk/master/erlang.mk) - -include erlang.mk - -app:: rebar.config - -app.config:: - ./deps/cuttlefish/cuttlefish -l info -e etc/ -c etc/dgiot_topo.conf -i priv/dgiot_topo.schema -d data diff --git a/apps/dgiot_topo/rebar.config b/apps/dgiot_topo/rebar.config index 6d6bfe1a49..30982fd5f1 100644 --- a/apps/dgiot_topo/rebar.config +++ b/apps/dgiot_topo/rebar.config @@ -1,3 +1,24 @@ -{deps, [ +{deps, []}. -]}. +{edoc_opts, [{preprocess, true}]}. +{erl_opts, [warn_unused_vars, + warn_shadow_vars, + warn_unused_import, + warn_obsolete_guard, + debug_info, + {parse_transform}]}. + +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, deprecated_function_calls, + warnings_as_errors, deprecated_functions]}. +{cover_enabled, true}. +{cover_opts, [verbose]}. +{cover_export_enabled, true}. + +{profiles, + [{test, + [{deps, + [{emqx_ct_helpers, {git, "https://gitee.com/fastdgiot/emqx-ct-helpers", {tag, "1.2.2"}}}, + {emqtt, {git, "https://gitee.com/fastdgiot/emqtt", {tag, "1.2.3"}}}]} + ]} + ]}. diff --git a/deploy/charts/emqx/templates/StatefulSet.yaml b/deploy/charts/emqx/templates/StatefulSet.yaml index 4cad215694..dcc03b9963 100644 --- a/deploy/charts/emqx/templates/StatefulSet.yaml +++ b/deploy/charts/emqx/templates/StatefulSet.yaml @@ -10,6 +10,7 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} spec: serviceName: {{ include "emqx.fullname" . }}-headless + podManagementPolicy: {{ .Values.podManagementPolicy }} {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} volumeClaimTemplates: - metadata: @@ -120,6 +121,10 @@ spec: containerPort: {{ .Values.emqxConfig.EMQX_LISTENER__WSS__EXTERNAL | default 8084 }} - name: dashboard containerPort: {{ .Values.emqxConfig.EMQX_DASHBOARD__LISTENER__HTTP | default 18083 }} + {{- if not (empty .Values.emqxConfig.EMQX_LISTENER__TCP__INTERNAL) }} + - name: internalmqtt + containerPort: {{ .Values.emqxConfig.EMQX_LISTENER__TCP__INTERNAL }} + {{- end }} {{- if not (empty .Values.emqxConfig.EMQX_DASHBOARD__LISTENER__HTTPS) }} - name: dashboardtls containerPort: {{ .Values.emqxConfig.EMQX_DASHBOARD__LISTENER__HTTPS }} @@ -144,7 +149,7 @@ spec: {{ toYaml .Values.resources | indent 12 }} volumeMounts: - name: emqx-data - mountPath: "/opt/emqx/data/mnesia" + mountPath: "/opt/emqx/data" - name: emqx-acl mountPath: "/opt/emqx/etc/acl.conf" subPath: "acl.conf" diff --git a/deploy/charts/emqx/templates/service.yaml b/deploy/charts/emqx/templates/service.yaml index 6e31a97c3e..8a1a6a2125 100644 --- a/deploy/charts/emqx/templates/service.yaml +++ b/deploy/charts/emqx/templates/service.yaml @@ -35,6 +35,17 @@ spec: {{- else if eq .Values.service.type "ClusterIP" }} nodePort: null {{- end }} + {{- if not (empty .Values.emqxConfig.EMQX_LISTENER__TCP__INTERNAL) }} + - name: internalmqtt + port: {{ .Values.service.internalmqtt | default 11883 }} + protocol: TCP + targetPort: internalmqtt + {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.internalmqtt)) }} + nodePort: {{ .Values.service.nodePorts.internalmqtt }} + {{- else if eq .Values.service.type "ClusterIP" }} + nodePort: null + {{- end }} + {{ end }} - name: mqttssl port: {{ .Values.service.mqttssl | default 8883 }} protocol: TCP @@ -110,11 +121,18 @@ spec: type: ClusterIP sessionAffinity: None clusterIP: None + publishNotReadyAddresses: true ports: - name: mqtt port: {{ .Values.service.mqtt | default 1883 }} protocol: TCP targetPort: mqtt + {{- if not (empty .Values.emqxConfig.EMQX_LISTENER__TCP__INTERNAL) }} + - name: internalmqtt + port: {{ .Values.service.internalmqtt | default 11883 }} + protocol: TCP + targetPort: internalmqtt + {{ end }} - name: mqttssl port: {{ .Values.service.mqttssl | default 8883 }} protocol: TCP diff --git a/deploy/charts/emqx/values.yaml b/deploy/charts/emqx/values.yaml index 151ffbe335..c30e237b76 100644 --- a/deploy/charts/emqx/values.yaml +++ b/deploy/charts/emqx/values.yaml @@ -17,6 +17,11 @@ image: ## Forces the recreation of pods during helm upgrades. This can be useful to update configuration values even if the container image did not change. recreatePods: false +# Pod deployment policy +# value: OrderedReady | Parallel +# To redeploy a chart with existing PVC(s), the value must be set to Parallel to avoid deadlock +podManagementPolicy: Parallel + persistence: enabled: false size: 20Mi diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index 9e0ba9d5bb..e362c6b73e 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -41,7 +41,7 @@ LABEL org.label-schema.docker.dockerfile="Dockerfile" \ org.label-schema.url="https://emqx.io" \ org.label-schema.vcs-type="Git" \ org.label-schema.vcs-url="https://github.com/emqx/emqx" \ - maintainer="Raymond M Mouthaan , Huang Rui , EMQ X Team " + maintainer="EMQ X Team " ARG QEMU_ARCH=x86_64 ARG EMQX_NAME=emqx diff --git a/deploy/docker/README.md b/deploy/docker/README.md index 6044291cc7..51692bc07d 100644 --- a/deploy/docker/README.md +++ b/deploy/docker/README.md @@ -74,14 +74,14 @@ These environment variables will ignore for configuration file. #### EMQ X Configuration -> NOTE: All EMQ X Configuration in [etc/emqx.conf](https://github.com/emqx/emqx/blob/master/etc/emqx.conf) could config by environment. The following list is just an example, not a complete configuration. +> NOTE: All EMQ X Configuration in [etc/emqx.conf](https://github.com/emqx/emqx/blob/main-v4.3/etc/emqx.conf) could config by environment. The following list is just an example, not a complete configuration. | Options | Default | Mapped | Description | | ---------------------------| ------------------ | ------------------------- | ------------------------------------- | | EMQX_NAME | container name | none | emqx node short name | | EMQX_HOST | container IP | none | emqx node host, IP or FQDN | -The list is incomplete and may changed with [etc/emqx.conf](https://github.com/emqx/emqx/blob/master/etc/emqx.conf) and plugin configuration files. But the mapping rule is similar. +The list is incomplete and may changed with [etc/emqx.conf](https://github.com/emqx/emqx/blob/main-v4.3/etc/emqx.conf) and plugin configuration files. But the mapping rule is similar. If set ``EMQX_NAME`` and ``EMQX_HOST``, and unset ``EMQX_NODE_NAME``, ``EMQX_NODE_NAME=$EMQX_NAME@$EMQX_HOST``. diff --git a/dgiot.ipr b/dgiot.ipr index 0bbc90f61c..e92ee5d4f4 100644 --- a/dgiot.ipr +++ b/dgiot.ipr @@ -42,7 +42,7 @@ - + @@ -57,6 +57,8 @@ + + @@ -102,6 +104,8 @@ + +