From 9edb7ac3ed945d8d4333d03be4df9329c063c40b Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Wed, 8 Dec 2021 15:50:59 -0300 Subject: [PATCH] it lives?!?! --- apps/emqx/include/emqx_release.hrl | 3 +- apps/emqx/src/emqx_config.erl | 8 +- apps/emqx_authn/rebar.config | 4 +- apps/emqx_authz/mix.exs | 29 ++++++ apps/emqx_auto_subscribe/mix.exs | 32 ++++++ apps/emqx_bridge/mix.exs | 33 +++++++ apps/emqx_conf/src/emqx_conf_app.erl | 1 + apps/emqx_connector/mix.exs | 34 +++++++ apps/emqx_dashboard/mix.exs | 33 +++++++ .../src/emqx_dashboard_admin.erl | 5 +- apps/emqx_exhook/mix.exs | 59 +++++++++++ apps/emqx_gateway/mix.exs | 62 ++++++++++++ apps/emqx_limiter/mix.exs | 32 ++++++ apps/emqx_machine/rebar.config | 0 apps/emqx_machine/src/emqx_machine_boot.erl | 2 + apps/emqx_management/mix.exs | 36 +++++++ apps/emqx_modules/mix.exs | 31 ++++++ apps/emqx_modules/src/emqx_modules_app.erl | 12 +++ apps/emqx_plugin_libs/rebar.config | 0 apps/emqx_prometheus/mix.exs | 33 +++++++ apps/emqx_resource/mix.exs | 34 +++++++ apps/emqx_retainer/mix.exs | 32 ++++++ apps/emqx_statsd/mix.exs | 31 ++++++ mix.exs | 99 +++++++++++++++++-- mix.lock | 24 ++++- 25 files changed, 653 insertions(+), 16 deletions(-) create mode 100644 apps/emqx_authz/mix.exs create mode 100644 apps/emqx_auto_subscribe/mix.exs create mode 100644 apps/emqx_bridge/mix.exs create mode 100644 apps/emqx_connector/mix.exs create mode 100644 apps/emqx_dashboard/mix.exs create mode 100644 apps/emqx_exhook/mix.exs create mode 100644 apps/emqx_gateway/mix.exs create mode 100644 apps/emqx_limiter/mix.exs create mode 100644 apps/emqx_machine/rebar.config create mode 100644 apps/emqx_management/mix.exs create mode 100644 apps/emqx_modules/mix.exs create mode 100644 apps/emqx_plugin_libs/rebar.config create mode 100644 apps/emqx_prometheus/mix.exs create mode 100644 apps/emqx_resource/mix.exs create mode 100644 apps/emqx_retainer/mix.exs create mode 100644 apps/emqx_statsd/mix.exs diff --git a/apps/emqx/include/emqx_release.hrl b/apps/emqx/include/emqx_release.hrl index 1424eb8a5..2bf033793 100644 --- a/apps/emqx/include/emqx_release.hrl +++ b/apps/emqx/include/emqx_release.hrl @@ -24,4 +24,5 @@ %% NOTE: This version number should be manually bumped for each release --define(EMQX_RELEASE, "5.0-beta.2"). +%% FIXME!!! +-define(EMQX_RELEASE, "5.0-beta.2-3fdc075b"). diff --git a/apps/emqx/src/emqx_config.erl b/apps/emqx/src/emqx_config.erl index 9979629bf..b9dabbb27 100644 --- a/apps/emqx/src/emqx_config.erl +++ b/apps/emqx/src/emqx_config.erl @@ -258,7 +258,9 @@ init_load(SchemaMod, Conf) when is_list(Conf) orelse is_binary(Conf) -> true -> fun hocon:binary/2; false -> fun hocon:files/2 end, - case Parser(Conf, ParseOptions) of + Res = Parser(Conf, ParseOptions), + io:format(user, "~n>>>>>>>>>>>>>>>>>> config:init_load parse res ~120p ~n", [Res]), + case Res of {ok, RawRichConf} -> init_load(SchemaMod, RawRichConf); {error, Reason} -> @@ -269,6 +271,8 @@ init_load(SchemaMod, Conf) when is_list(Conf) orelse is_binary(Conf) -> error(failed_to_load_hocon_conf) end; init_load(SchemaMod, RawConf) when is_map(RawConf) -> + io:format(user, ">>>>>>>>>> config:init_load is_map ~p ~100p ~n", + [SchemaMod, RawConf]), ok = save_schema_mod_and_names(SchemaMod), %% check configs agains the schema, with environment variables applied on top {_AppEnvs, CheckedConf} = @@ -382,6 +386,8 @@ save_to_app_env(AppEnvs) -> -spec save_to_config_map(config(), raw_config()) -> ok. save_to_config_map(Conf, RawConf) -> + io:format(user, ">>>>>>> config:save_to_config_map ~p ~100p ~n", + [Conf, RawConf]), ?MODULE:put(Conf), ?MODULE:put_raw(RawConf). diff --git a/apps/emqx_authn/rebar.config b/apps/emqx_authn/rebar.config index 73696b033..26ce7001f 100644 --- a/apps/emqx_authn/rebar.config +++ b/apps/emqx_authn/rebar.config @@ -1,4 +1,6 @@ -{deps, []}. +{deps, [ + {jose, "1.11.2"} +]}. {edoc_opts, [{preprocess, true}]}. {erl_opts, [warn_unused_vars, diff --git a/apps/emqx_authz/mix.exs b/apps/emqx_authz/mix.exs new file mode 100644 index 000000000..075691772 --- /dev/null +++ b/apps/emqx_authz/mix.exs @@ -0,0 +1,29 @@ +defmodule EMQXAuthz.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_authz, + version: "0.1.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + # start_permanent: Mix.env() == :prod, + deps: deps() + ] + end + + def application do + [ + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx_connector, in_umbrella: true, runtime: false} + ] + end +end diff --git a/apps/emqx_auto_subscribe/mix.exs b/apps/emqx_auto_subscribe/mix.exs new file mode 100644 index 000000000..6d1728a71 --- /dev/null +++ b/apps/emqx_auto_subscribe/mix.exs @@ -0,0 +1,32 @@ +defmodule EMQXAutoSubscribe.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_auto_subscribe, + version: "0.1.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + start_permanent: Mix.env() == :prod, + deps: deps(), + description: "EMQ X Auto Subscribe" + ] + end + + def application do + [ + registered: [], + mod: {:emqx_auto_subscribe_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx, in_umbrella: true, runtime: false} + ] + end +end diff --git a/apps/emqx_bridge/mix.exs b/apps/emqx_bridge/mix.exs new file mode 100644 index 000000000..f9a94ad47 --- /dev/null +++ b/apps/emqx_bridge/mix.exs @@ -0,0 +1,33 @@ +defmodule EMQXBridge.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_bridge, + version: "0.1.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + # start_permanent: Mix.env() == :prod, + deps: deps(), + description: "EMQ X Bridge" + ] + end + + def application do + [ + registered: [], + mod: {:emqx_bridge_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx, in_umbrella: true, runtime: false}, + # {:emqx_connector, in_umbrella: true} + ] + end +end diff --git a/apps/emqx_conf/src/emqx_conf_app.erl b/apps/emqx_conf/src/emqx_conf_app.erl index 0a33605fe..65cd88503 100644 --- a/apps/emqx_conf/src/emqx_conf_app.erl +++ b/apps/emqx_conf/src/emqx_conf_app.erl @@ -25,6 +25,7 @@ -include("emqx_conf.hrl"). start(_StartType, _StartArgs) -> + io:format(user, ">>>>>>>>>>>>>> emqx_conf_app starting <<<<<<<<<<<~n", []), init_conf(), emqx_conf_sup:start_link(). diff --git a/apps/emqx_connector/mix.exs b/apps/emqx_connector/mix.exs new file mode 100644 index 000000000..97cfa9490 --- /dev/null +++ b/apps/emqx_connector/mix.exs @@ -0,0 +1,34 @@ +defmodule EMQXConnector.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_connector, + version: "0.1.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + # start_permanent: Mix.env() == :prod, + deps: deps() + ] + end + + def application do + [ + mod: {:emqx_connector_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx_resource, in_umbrella: true, runtime: false}, + {:epgsql, github: "epgsql/epgsql", tag: "4.4.0"}, + {:mysql, github: "emqx/mysql-otp", tag: "1.7.1"}, + # {:ecpool, github: "emqx/ecpool", tag: "0.5.1"}, + # {:emqtt, github: "emqx/emqtt", tag: "1.4.3"} + ] + end +end diff --git a/apps/emqx_dashboard/mix.exs b/apps/emqx_dashboard/mix.exs new file mode 100644 index 000000000..ff8f1eac6 --- /dev/null +++ b/apps/emqx_dashboard/mix.exs @@ -0,0 +1,33 @@ +defmodule EMQXDashboard.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_dashboard, + version: "4.4.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + # start_permanent: Mix.env() == :prod, + deps: deps(), + description: "EMQ X Web Dashboard" + ] + end + + def application do + [ + registered: [:emqx_dashboard_sup], + mod: {:emqx_dashboard_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx, in_umbrella: true, runtime: false}, + # {:minirest, github: "emqx/minirest", tag: "1.2.4"} + ] + end +end diff --git a/apps/emqx_dashboard/src/emqx_dashboard_admin.erl b/apps/emqx_dashboard/src/emqx_dashboard_admin.erl index 8f40427e5..e2353b063 100644 --- a/apps/emqx_dashboard/src/emqx_dashboard_admin.erl +++ b/apps/emqx_dashboard/src/emqx_dashboard_admin.erl @@ -212,13 +212,16 @@ sha256(SaltBin, Password) -> crypto:hash('sha256', <>). add_default_user() -> + io:format(user, "~n>>>>>>>>>>> add_default_user/0~n", []), add_default_user(binenv(default_username), binenv(default_password)). binenv(Key) -> iolist_to_binary(emqx_conf:get([emqx_dashboard, Key], "")). add_default_user(Username, Password) when ?EMPTY_KEY(Username) orelse ?EMPTY_KEY(Password) -> - ok; + %% FIXME!!! + io:format(user, "~n>>>>>>>>>>> add_default_user empty ~n", []), + {ok, empty}; add_default_user(Username, Password) -> case lookup_user(Username) of diff --git a/apps/emqx_exhook/mix.exs b/apps/emqx_exhook/mix.exs new file mode 100644 index 000000000..52d00a23b --- /dev/null +++ b/apps/emqx_exhook/mix.exs @@ -0,0 +1,59 @@ +defmodule EMQXExhook.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_exhook, + version: "5.0.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + compilers: [:protos | Mix.compilers()], + aliases: ["compile.protos": &protos/1], + # start_permanent: Mix.env() == :prod, + deps: deps(), + description: "EMQ X Extension for Hook" + ] + end + + def application do + [ + registered: [], + mod: {:emqx_exhook_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx, in_umbrella: true, runtime: false}, + # {:grpc, github: "emqx/grpc-erl", tag: "0.6.2"} + ] + end + + defp protos(_args) do + app_path = Path.expand("..", __ENV__.file) + config = [ + :use_packages, + :maps, + :strings_as_binaries, + rename: {:msg_name, :snake_case}, + rename: {:msg_fqname, :base_name}, + i: '.', + report_errors: false, + o: app_path |> Path.join("src") |> to_charlist(), + module_name_prefix: 'emqx_', + module_name_suffix: '_pb' + ] + + app_path + |> Path.join("priv/protos/*.proto") + |> Path.wildcard() + |> Enum.map(&to_charlist/1) + |> Enum.each(&:gpb_compile.file(&1, config)) + + :ok + end +end diff --git a/apps/emqx_gateway/mix.exs b/apps/emqx_gateway/mix.exs new file mode 100644 index 000000000..3cdebd4b0 --- /dev/null +++ b/apps/emqx_gateway/mix.exs @@ -0,0 +1,62 @@ +defmodule EMQXGateway.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_gateway, + version: "0.1.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + compilers: [:protos | Mix.compilers()], + aliases: ["compile.protos": &protos/1], + start_permanent: Mix.env() == :prod, + deps: deps(), + description: "The Gateway Management Application" + ] + end + + def application do + [ + registered: [], + mod: {:emqx_gateway_app, []}, + extra_applications: [:logger] + ] + end + + defp protos(_args) do + app_path = Path.expand("..", __ENV__.file) + config = [ + :use_packages, + :maps, + :strings_as_binaries, + rename: {:msg_name, :snake_case}, + rename: {:msg_fqname, :base_name}, + i: '.', + report_errors: false, + o: app_path |> Path.join("src/exproto") |> to_charlist(), + module_name_prefix: 'emqx_', + module_name_suffix: '_pb' + ] + + app_path + |> Path.join("src/exproto/protos/*.proto") + |> Path.wildcard() + |> Enum.map(&to_charlist/1) + |> Enum.each(&:gpb_compile.file(&1, config)) + + :ok + end + + defp deps do + [ + # {:gpb, "4.19.1", runtime: false}, + {:emqx, in_umbrella: true, runtime: false}, + # {:lwm2m_coap, github: "emqx/lwm2m-coap", tag: "v2.0.0"}, + # {:grpc, github: "emqx/grpc-erl", tag: "0.6.2"}, + # {:esockd, github: "emqx/esockd", tag: "5.7.4"} + ] + end +end diff --git a/apps/emqx_limiter/mix.exs b/apps/emqx_limiter/mix.exs new file mode 100644 index 000000000..438ff8f2b --- /dev/null +++ b/apps/emqx_limiter/mix.exs @@ -0,0 +1,32 @@ +defmodule EMQXLimiter.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_limiter, + version: "1.0.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + # start_permanent: Mix.env() == :prod, + deps: deps(), + description: "EMQ X Hierachical Limiter" + ] + end + + def application do + [ + registered: [:emqx_limiter_sup], + mod: {:emqx_limiter_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx, in_umbrella: true, runtime: false}, + ] + end +end diff --git a/apps/emqx_machine/rebar.config b/apps/emqx_machine/rebar.config new file mode 100644 index 000000000..e69de29bb diff --git a/apps/emqx_machine/src/emqx_machine_boot.erl b/apps/emqx_machine/src/emqx_machine_boot.erl index 9fab5854e..49b3eb9e0 100644 --- a/apps/emqx_machine/src/emqx_machine_boot.erl +++ b/apps/emqx_machine/src/emqx_machine_boot.erl @@ -27,6 +27,8 @@ -endif. post_boot() -> + io:format(user, ">>>>>>>>>>>>>>>>>>>> roots ~p~n", + [emqx_conf_schema:roots()]), ok = ensure_apps_started(), _ = emqx_plugins:load(), ok = print_vsn(), diff --git a/apps/emqx_management/mix.exs b/apps/emqx_management/mix.exs new file mode 100644 index 000000000..ee6bb533c --- /dev/null +++ b/apps/emqx_management/mix.exs @@ -0,0 +1,36 @@ +defmodule EMQXManagement.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_management, + version: "4.4.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + # start_permanent: Mix.env() == :prod, + deps: deps(), + description: "EMQ X Management API and CLI" + ] + end + + def application do + [ + registered: [:emqx_management_sup], + mod: {:emqx_mgmt_app, []}, + extra_applications: [:logger, :syntax_tools] + ] + end + + defp deps do + [ + {:emqx, in_umbrella: true, runtime: false}, + # {:emqx_rule_engine, in_umbrella: true}, + # {:ekka, github: "emqx/ekka", tag: "0.11.1", runtime: false}, + # {:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.2.1"}, + # {:minirest, github: "emqx/minirest", tag: "1.2.4"} + ] + end +end diff --git a/apps/emqx_modules/mix.exs b/apps/emqx_modules/mix.exs new file mode 100644 index 000000000..a842654d3 --- /dev/null +++ b/apps/emqx_modules/mix.exs @@ -0,0 +1,31 @@ +defmodule EMQXModules.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_modules, + version: "4.3.2", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + # start_permanent: Mix.env() == :prod, + deps: deps() + ] + end + + def application do + [ + registered: [:emqx_mod_sup], + mod: {:emqx_modules_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx, in_umbrella: true, runtime: false}, + ] + end +end diff --git a/apps/emqx_modules/src/emqx_modules_app.erl b/apps/emqx_modules/src/emqx_modules_app.erl index 55c882f94..b72c6b9f7 100644 --- a/apps/emqx_modules/src/emqx_modules_app.erl +++ b/apps/emqx_modules/src/emqx_modules_app.erl @@ -24,6 +24,18 @@ start(_Type, _Args) -> {ok, Sup} = emqx_modules_sup:start_link(), + io:format(user, "~n>>>>>>>>>>>> modules_app:start sup children ~p~n", + [supervisor:which_children(Sup)]), + io:format(user, "~n>>>>>>>>>>>> modules_app:start get_release ~p~n", + [emqx_app:get_release()]), + io:format(user, "~n>>>>>>>>>>>> modules_app:start official_version ~p~n", + [emqx_telemetry:official_version(emqx_app:get_release())]), + io:format(user, "~n>>>>>>>>>>>> modules_app:start config files ~p~n", + [application:get_env(emqx, config_files, [])]), + io:format(user, "~n>>>>>>>>>>>> modules_app:start retainer config ~p~n", + [emqx:get_config([emqx_retainer], undefined)]), + io:format(user, "~n>>>>>>>>>>>> modules_app:start authz_api_settings:api_spec ~p~n", + [emqx_authz_api_settings:api_spec()]), maybe_enable_modules(), {ok, Sup}. diff --git a/apps/emqx_plugin_libs/rebar.config b/apps/emqx_plugin_libs/rebar.config new file mode 100644 index 000000000..e69de29bb diff --git a/apps/emqx_prometheus/mix.exs b/apps/emqx_prometheus/mix.exs new file mode 100644 index 000000000..d4b13b3b8 --- /dev/null +++ b/apps/emqx_prometheus/mix.exs @@ -0,0 +1,33 @@ +defmodule EMQXPrometheus.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_prometheus, + version: "4.3.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + # start_permanent: Mix.env() == :prod, + deps: deps(), + description: "Prometheus for EMQ X" + ] + end + + def application do + [ + registered: [:emqx_prometheus_sup], + mod: {:emqx_prometheus_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx, in_umbrella: true, runtime: false}, + # {:prometheus, github: "emqx/prometheus.erl", tag: "v3.1.1"} + ] + end +end diff --git a/apps/emqx_resource/mix.exs b/apps/emqx_resource/mix.exs new file mode 100644 index 000000000..1b35204ad --- /dev/null +++ b/apps/emqx_resource/mix.exs @@ -0,0 +1,34 @@ +defmodule EMQXResource.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_resource, + version: "0.1.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + # start_permanent: Mix.env() == :prod, + start_permanent: false, + deps: deps() + ] + end + + def application do + [ + mod: {:emqx_resource_app, []}, + extra_applications: [:logger, :syntax_tools] + ] + end + + defp deps do + [ + # {:jsx, "3.1.0"}, + # {:gproc, "0.9.0"}, + {:hocon, github: "emqx/hocon", tag: "0.22.0", runtime: false}, + {:emqx, in_umbrella: true, runtime: false} + ] + end +end diff --git a/apps/emqx_retainer/mix.exs b/apps/emqx_retainer/mix.exs new file mode 100644 index 000000000..2565db62e --- /dev/null +++ b/apps/emqx_retainer/mix.exs @@ -0,0 +1,32 @@ +defmodule EMQXRetainer.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_retainer, + version: "4.3.1", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + start_permanent: Mix.env() == :prod, + deps: deps(), + description: "EMQ X Retainer" + ] + end + + def application do + [ + registered: [:emqx_retainer_sup], + mod: {:emqx_retainer_app, []}, + # extra_applications: [:logger] + ] + end + + defp deps do + [ + # {:emqx, in_umbrella: true, runtime: false} + ] + end +end diff --git a/apps/emqx_statsd/mix.exs b/apps/emqx_statsd/mix.exs new file mode 100644 index 000000000..6823daefe --- /dev/null +++ b/apps/emqx_statsd/mix.exs @@ -0,0 +1,31 @@ +defmodule EMQXStatsd.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_statsd, + version: "0.1.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + start_permanent: Mix.env() == :prod, + deps: deps(), + description: "EMQ X Statsd" + ] + end + + def application do + [ + mod: {:emqx_statsd_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:estatsd, github: "emqx/estatsd", tag: "0.1.0"} + ] + end +end diff --git a/mix.exs b/mix.exs index 0798ad486..05c035b3d 100644 --- a/mix.exs +++ b/mix.exs @@ -3,21 +3,31 @@ defmodule EMQXUmbrella.MixProject do def project do [ - apps_path: "apps", - app: :emqx, + # apps_path: "apps", + app: :emqx_mix, version: pkg_vsn(), - start_permanent: Mix.env() == :prod, + # start_permanent: Mix.env() == :prod, + start_permanent: false, deps: deps(), releases: releases() ] end + def application() do + [ + mod: {:emqx_machine_app, []}, + # extra_applications: [:mnesia, :runtime_tools], + extra_applications: [] + ] + end + + defp elixirc_paths(_), do: ["apps/emqx"] + defp deps do [ {:jiffy, github: "emqx/jiffy", tag: "1.0.5", override: true}, {:jsx, "~> 3.1", override: true}, {:gun, github: "emqx/gun", tag: "1.3.4", override: true}, - {:hocon, github: "emqx/hocon", tag: "0.20.5", override: true}, {:cuttlefish, github: "emqx/cuttlefish", manager: :rebar3, @@ -39,18 +49,77 @@ defmodule EMQXUmbrella.MixProject do {:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "0.14.0", override: true}, {:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.4.0", override: true}, #### - {:emqx, path: "apps/emqx"}, + {:quicer, github: "emqx/quic", tag: "0.0.9", override: true}, + {:ecpool, github: "emqx/ecpool", tag: "0.5.1"}, + {:ehttpc, github: "emqx/ehttpc", tag: "0.1.12"}, + {:hocon, github: "emqx/hocon", tag: "0.22.0", override: true, runtime: false}, + {:mria, github: "emqx/mria", tag: "0.1.4", override: true}, + {:minirest, github: "emqx/minirest", tag: "1.2.7"}, + {:rulesql, github: "emqx/rulesql", tag: "0.1.4"}, + #### + {:emqx, path: "apps/emqx", in_umbrella: true}, + {:emqx_authz, path: "apps/emqx_authz", in_umbrella: true}, + {:emqx_conf, path: "apps/emqx_conf", in_umbrella: true}, + {:emqx_connector, path: "apps/emqx_connector", in_umbrella: true}, + {:emqx_resource, path: "apps/emqx_resource", in_umbrella: true, complile: :mix}, + {:emqx_authn, path: "apps/emqx_authn", in_umbrella: true}, + {:emqx_plugin_libs, path: "apps/emqx_plugin_libs", in_umbrella: true}, + {:emqx_bridge, path: "apps/emqx_bridge", in_umbrella: true}, + {:emqx_retainer, path: "apps/emqx_retainer", in_umbrella: true}, + {:emqx_statsd, path: "apps/emqx_statsd", in_umbrella: true}, + {:emqx_auto_subscribe, path: "apps/emqx_auto_subscribe", in_umbrella: true}, + {:emqx_machine, path: "apps/emqx_machine", in_umbrella: true}, + {:emqx_modules, path: "apps/emqx_modules", in_umbrella: true}, + {:emqx_dashboard, path: "apps/emqx_dashboard", in_umbrella: true}, + {:emqx_gateway, path: "apps/emqx_gateway", in_umbrella: true}, + {:emqx_prometheus, path: "apps/emqx_prometheus", in_umbrella: true}, + {:emqx_rule_engine, path: "apps/emqx_rule_engine", in_umbrella: true}, + {:emqx_exhook, path: "apps/emqx_exhook", in_umbrella: true}, + {:emqx_psk, path: "apps/emqx_psk", in_umbrella: true}, + {:emqx_limiter, path: "apps/emqx_limiter", in_umbrella: true}, + # undef minirest error without this one... + {:emqx_management, path: "apps/emqx_management", in_umbrella: true}, ] ++ ((enable_bcrypt() && [{:bcrypt, github: "emqx/erlang-bcrypt", tag: "0.6.0"}]) || []) end defp releases do [ - emqx: fn -> - [ - applications: EmqxReleaseHelper.applications(), - steps: [:assemble, &EmqxReleaseHelper.run/1] + # emqx: fn -> + # [ + # applications: EmqxReleaseHelper.applications(), + # steps: [:assemble, &EmqxReleaseHelper.run/1] + # ] + # end + emqx: [ + applications: [ + runtime_tools: :permanent, + emqx: :load, + # emqx_conf: :load, # as per rebar.config.erl + emqx_conf: :permanent, + emqx_machine: :permanent, + mnesia: :load, + ekka: :load, + emqx_plugin_libs: :load, + emqx_resource: :permanent, + emqx_connector: :permanent, + emqx_authn: :permanent, + emqx_authz: :permanent, + # emqx_auto_subscribe: :permanent, + emqx_gateway: :permanent, + emqx_exhook: :permanent, + emqx_bridge: :permanent, + emqx_rule_engine: :permanent, + emqx_modules: :permanent, + emqx_management: :permanent, + emqx_dashboard: :permanent, + emqx_retainer: :permanent, + emqx_statsd: :permanent, + emqx_prometheus: :permanent, + emqx_psk: :permanent, + emqx_limiter: :permanent, + emqx_mix: :none, ] - end + ] ] end @@ -72,6 +141,16 @@ defmodule EMQXUmbrella.MixProject do |> Enum.reverse() |> tl() |> Enum.reverse() + |> fix_vsn() |> Enum.join("-") end + + # FIXME: remove hack + defp fix_vsn([vsn | extras]) do + if Version.parse(vsn) == :error do + [vsn <> ".0" | extras] + else + [vsn | extras] + end + end end diff --git a/mix.lock b/mix.lock index 5d1ad99e8..3bdd0360c 100644 --- a/mix.lock +++ b/mix.lock @@ -1,12 +1,22 @@ %{ "bcrypt": {:git, "https://github.com/emqx/erlang-bcrypt.git", "dc2ba66acf2332c111362d01137746eefecc5e90", [tag: "0.6.0"]}, + "bson": {:git, "https://github.com/comtihon/bson-erlang.git", "14308ab927cfa69324742c3de720578094e0bb19", [tag: "v0.2.2"]}, "cowboy": {:git, "https://github.com/emqx/cowboy.git", "b89d4689a04149b1a4a3641280aa5c5643f921b2", [tag: "2.8.2"]}, + "cowboy_swagger": {:git, "https://github.com/inaka/cowboy_swagger", "bc441df7988da0f5c5d11ae0861c394dc30995c5", [tag: "2.5.0"]}, "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, "cuttlefish": {:git, "https://github.com/emqx/cuttlefish.git", "6c346563e89ebbd95dbc1c29017adaf9abf85ca1", []}, + "ecpool": {:git, "https://github.com/emqx/ecpool.git", "0516d2cebd14654ef8c583c347e4a0b01363b86d", [tag: "0.5.1"]}, "eetcd": {:hex, :eetcd, "0.3.4", "27e8b4775230c53a9ef602f62a1603591302b40b2eb195d567edffb35b6cf1a2", [:rebar3], [{:gun, "1.3.3", [hex: :gun, repo: "hexpm", optional: false]}], "hexpm", "b763c0e1a9741d39a62f5a19186a342863eacbc769151c4e81db5790efecefca"}, + "ehttpc": {:git, "https://github.com/emqx/ehttpc.git", "7b1a76b2353b385725e62f948cd399c7040467f8", [tag: "0.1.12"]}, "ekka": {:git, "https://github.com/emqx/ekka", "005fd6bb94199dc2ecb4ba03284f253b408e02d9", [tag: "0.11.1"]}, + "eldap2": {:git, "https://github.com/emqx/eldap2", "f595f67b094db3b9dc07941337706621e815431f", [tag: "v0.2.2"]}, + "emqtt": {:git, "https://github.com/emqx/emqtt", "25892ef48a979a9dfbd74d86133cb28cf11f3cf4", [tag: "1.4.3"]}, "emqx_http_lib": {:git, "https://github.com/emqx/emqx_http_lib.git", "9a1aafcbad1bb35392ebabc0cf102c7bce660432", [tag: "0.4.0"]}, + "epgsql": {:git, "https://github.com/epgsql/epgsql.git", "895c8f9d53f08d09ec6a0301c56d3d6f270929f2", [tag: "4.4.0"]}, + "eredis": {:git, "https://github.com/emqx/eredis", "75f2b8eedbe631136326680225efbcd2684e93e7", [tag: "1.2.5"]}, + "eredis_cluster": {:git, "https://github.com/emqx/eredis_cluster", "624749b4aef25668e9c7a545427fdc663a04faef", [tag: "0.6.7"]}, "esockd": {:git, "https://github.com/emqx/esockd.git", "9b959fc11a1c398a589892f335235be6c5b4a454", [tag: "5.8.0"]}, + "estatsd": {:git, "https://github.com/emqx/estatsd.git", "5184d846b7ecb83509bd4d32695c60428c0198cd", [tag: "0.1.0"]}, "gen_coap": {:git, "https://github.com/emqx/gen_coap.git", "9bf5e7f795badf68e2fb4eb226f576308f5b1bb4", [tag: "v0.3.2"]}, "gen_rpc": {:git, "https://github.com/emqx/gen_rpc.git", "fb7418dc8cf7e97d153fba073bee0fac07dce753", [tag: "2.5.1"]}, "getopt": {:git, "https://github.com/emqx/getopt.git", "215f2083408e1fe562d441aea6062bf5d9e1fb67", [tag: "v1.0.2"]}, @@ -14,18 +24,28 @@ "gproc": {:hex, :gproc, "0.9.0", "853ccb7805e9ada25d227a157ba966f7b34508f386a3e7e21992b1b484230699", [:rebar3], [], "hexpm", "587e8af698ccd3504cf4ba8d90f893ede2b0f58cabb8a916e2bf9321de3cf10b"}, "grpc": {:git, "https://github.com/emqx/grpc-erl.git", "f8ba39eb075fb2a7f370563045d5e5d0914f2703", [tag: "0.6.2"]}, "gun": {:git, "https://github.com/emqx/gun.git", "e1b5e14139e2a936ad6561bf960f70f1e80b81e2", [tag: "1.3.4"]}, - "hocon": {:git, "https://github.com/emqx/hocon.git", "2021a1b82c1f654c98181ba2dbfec5457c5c6eb7", [tag: "0.20.5"]}, + "hocon": {:git, "https://github.com/emqx/hocon.git", "b6baf9c5fcbc3e9f0e72959cb18e863de4cc1d33", [tag: "0.22.0"]}, "jiffy": {:git, "https://github.com/emqx/jiffy.git", "baa1f4e750ae3c5c9e54f9c2e52280b7fc24a8d9", [tag: "1.0.5"]}, + "jose": {:hex, :jose, "1.11.2", "f4c018ccf4fdce22c71e44d471f15f723cb3efab5d909ab2ba202b5bf35557b3", [:mix, :rebar3], [], "hexpm", "98143fbc48d55f3a18daba82d34fe48959d44538e9697c08f34200fa5f0947d2"}, "jsx": {:hex, :jsx, "3.1.0", "d12516baa0bb23a59bb35dccaf02a1bd08243fcbb9efe24f2d9d056ccff71268", [:rebar3], [], "hexpm", "0c5cc8fdc11b53cc25cf65ac6705ad39e54ecc56d1c22e4adb8f5a53fb9427f3"}, "lc": {:git, "https://github.com/qzhuyan/lc.git", "6f98d098e5aaf4fcd6afbbb2acca96855c474600", [tag: "0.1.2"]}, - "mria": {:git, "https://github.com/emqx/mria", "f0efc591339f960b5126ec4e1a0fed85d1578eb5", [tag: "0.1.2"]}, + "minirest": {:git, "https://github.com/emqx/minirest.git", "f3f80b3e07295d8b6db22ed456318e0cc9dd167f", [tag: "1.2.7"]}, + "mnesia_rocksdb": {:git, "https://github.com/k32/mnesia_rocksdb", "42715650a3b84fe13d23a1e7f65815ff36386b0f", [tag: "0.1.3-k32"]}, + "mongodb": {:git, "https://github.com/emqx/mongodb-erlang", "2ffe62f42dafb98eaafead9d340a674c5f9279a5", [tag: "v3.0.10"]}, + "mria": {:git, "https://github.com/emqx/mria.git", "0887b3fa2b3576175ac38d32e35177635f01621a", [tag: "0.1.4"]}, + "mysql": {:git, "https://github.com/emqx/mysql-otp.git", "bdabac44cc8836a9e23897b7e1b77c7df7e04f70", [tag: "1.7.1"]}, "pbkdf2": {:git, "https://github.com/emqx/erlang-pbkdf2.git", "45d9981209ea07a83a58cf85aaf8236457da4342", [tag: "2.0.4"]}, "poolboy": {:git, "https://github.com/emqx/poolboy.git", "29be47db8c2be38b18c908e43a80ebb7b9b6116b", [tag: "1.5.2"]}, + "prometheus": {:git, "https://github.com/emqx/prometheus.erl", "a41488df09472448057d264ef520cf2f71d925f8", [tag: "v3.1.1"]}, "quicer": {:git, "https://github.com/emqx/quic.git", "ef73617d0f10f0f30f3aa77eb4a2f6ae071a2e29", [tag: "0.0.9"]}, "ranch": {:hex, :ranch, "2.1.0", "2261f9ed9574dcfcc444106b9f6da155e6e540b2f82ba3d42b339b93673b72a3", [:make, :rebar3], [], "hexpm", "244ee3fa2a6175270d8e1fc59024fd9dbc76294a321057de8f803b1479e76916"}, "recon": {:git, "https://github.com/ferd/recon", "f7b6c08e6e9e2219db58bfb012c58c178822e01e", [tag: "2.5.1"]}, "replayq": {:git, "https://github.com/emqx/replayq", "9e5ba14d65ff1885ad85b6d33a859c01c322f273", [tag: "0.3.1"]}, + "rocksdb": {:git, "https://github.com/k32/erlang-rocksdb.git", "c2b51da17d357fc8fca50668e13576d69f3d4161", [tag: "1.7.1-k32"]}, + "rulesql": {:git, "https://github.com/emqx/rulesql.git", "fec11b1a3cbf98480d19c06d3aca10442e1e02a9", [tag: "0.1.4"]}, + "sext": {:hex, :sext, "1.8.0", "90a95b889f5c781b70bbcf44278b763148e313c376b60d87ce664cb1c1dd29b5", [:rebar3], [], "hexpm", "bc6016cb8690baf677eacacfe6e7cadfec8dc7e286cbbed762f6cd55b0678e73"}, "snabbkaffe": {:git, "https://github.com/kafka4beam/snabbkaffe.git", "ea1fbffddf8a3b5939bff61cc72ba45c3dceb058", [tag: "0.14.0"]}, "ssl_verify_fun": {:git, "https://github.com/deadtrickster/ssl_verify_fun.erl.git", "c5718226b0b9f3d1a38ef6ca3c3b4c75f53dda92", [tag: "1.1.4"]}, + "trails": {:hex, :trails, "2.3.0", "b09703f056705f4943e14fff077b98c711a6f48fad40f4ff0b350794074ad69c", [:rebar3], [{:cowboy, "2.8.0", [hex: :cowboy, repo: "hexpm", optional: false]}, {:ranch, "2.0.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "40804001eb80417aa9d02400f39b7216956c3f251539a8a6096a69b3fac0ea07"}, "typerefl": {:git, "https://github.com/k32/typerefl.git", "a751e0664752b1824206ca34377ac2d2c3ed53bc", [tag: "0.8.4"]}, }