This commit is contained in:
Thales Macedo Garitezi 2021-12-15 18:13:18 -03:00
parent eaa05d7227
commit 757a944ade
No known key found for this signature in database
GPG Key ID: DD279F8152A9B6DD
29 changed files with 3665 additions and 71 deletions

43
apps/emqx/mix.exs Normal file
View File

@ -0,0 +1,43 @@
defmodule EMQX.MixProject do
use Mix.Project
def project do
[
app: :emqx,
version: "5.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"
]
end
def application do
[
mod: {:emqx_app, []},
extra_applications: [:logger, :os_mon, :syntax_tools]
]
end
defp deps do
[
# {:gproc, "0.9.0"},
# {:recon, "2.5.2"},
{:cowboy, github: "emqx/cowboy", tag: "2.8.3"},
{:esockd, github: "emqx/esockd", tag: "5.9.0"},
{:gproc, github: "uwiger", tag: "0.8.0"},
{:ekka, github: "emqx/ekka", tag: "0.11.1"},
# {:gen_rpc, github: "emqx/gen_rpc", tag: "2.5.1"},
# {:cuttlefish, github: "emqx/cuttlefish", tag: "v4.0.1"},
{:hocon, github: "emqx/hocon", tag: "0.22.0"},
# {:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4"},
# {:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "0.14.0"},
# {:jiffy, github: "emqx/jiffy", tag: "1.0.5"},
{:lc, github: "qzhuyan/lc", tag: "0.1.2"},
]
end
end

View File

@ -245,6 +245,10 @@ put_raw(KeyPath, Config) -> do_put(?RAW_CONF, KeyPath, Config).
%%============================================================================
init_load(SchemaMod) ->
ConfFiles = application:get_env(emqx, config_files, []),
?SLOG(warning, #{ msg => ">>>>>>>>> config:init_load enter"
, schema_mod => SchemaMod
, conf_files => ConfFiles
}),
init_load(SchemaMod, ConfFiles).
%% @doc Initial load of the given config files.
@ -259,7 +263,7 @@ init_load(SchemaMod, Conf) when is_list(Conf) orelse is_binary(Conf) ->
false -> fun hocon:files/2
end,
Res = Parser(Conf, ParseOptions),
io:format(user, "~n>>>>>>>>>>>>>>>>>> config:init_load parse res ~120p ~n", [Res]),
%% io:format(user, "~n>>>>>>>>>>>>>>>>>> config:init_load parse res ~120p ~n", [Res]),
case Res of
{ok, RawRichConf} ->
init_load(SchemaMod, RawRichConf);
@ -271,8 +275,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]),
%% 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} =
@ -386,8 +390,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]),
%% io:format(user, ">>>>>>> config:save_to_config_map ~p ~100p ~n",
%% [Conf, RawConf]),
?MODULE:put(Conf),
?MODULE:put_raw(RawConf).

38
apps/emqx_authn/mix.exs Normal file
View File

@ -0,0 +1,38 @@
defmodule EMQXAuthn.MixProject do
use Mix.Project
def project do
[
app: :emqx_authn,
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 Authentication"
]
end
def application do
[
registered: [:emqx_authn_sup, :emqx_authn_registry],
mod: {:emqx_authn_app, []},
extra_applications: [:logger]
]
end
defp deps do
[
{:emqx, in_umbrella: true, runtime: false},
{:emqx_resource, in_umbrella: true},
# {:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.2.1"},
# {:esasl, github: "emqx/esasl", tag: "0.1.0"},
# {:epgsql, github: "epgsql/epgsql", tag: "4.4.0"},
# {:mysql, github: "emqx/mysql-otp", tag: "1.7.1"},
{:jose, "1.11.2"},
]
end
end

32
apps/emqx_conf/mix.exs Normal file
View File

@ -0,0 +1,32 @@
defmodule EMQXConf.MixProject do
use Mix.Project
def project do
[
app: :emqx_conf,
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 Configuration Management"
]
end
def application do
[
mod: {:emqx_conf_app, []},
# extra_applications: [:logger, :os_mon, :syntax_tools]
]
end
defp deps do
[
{:emqx, in_umbrella: true, runtime: false},
# {:hocon, github: "emqx/hocon"}
]
end
end

View File

@ -25,8 +25,11 @@
-include("emqx_conf.hrl").
start(_StartType, _StartArgs) ->
io:format(user, ">>>>>>>>>>>>>> emqx_conf_app starting <<<<<<<<<<<~n", []),
?SLOG(warning, #{ msg => ">>>>>>>>>>>>>> emqx_conf_app starting <<<<<<<<<<<~n"
}),
init_conf(),
?SLOG(warning, #{ msg => ">>>>>>>>>>>>>> emqx_conf_app conf init done <<<<<<<<<<<~n"
}),
emqx_conf_sup:start_link().
stop(_State) ->

View File

@ -27,6 +27,7 @@ defmodule EMQXConnector.MixProject 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"},
{:emqtt, github: "emqx/emqtt", tag: "1.4.3"},
# {:ecpool, github: "emqx/ecpool", tag: "0.5.1"},
# {:emqtt, github: "emqx/emqtt", tag: "1.4.3"}
]

View File

@ -221,8 +221,8 @@ binenv(Key) ->
add_default_user(Username, Password) when ?EMPTY_KEY(Username) orelse ?EMPTY_KEY(Password) ->
%% FIXME!!!
io:format(user, "~n>>>>>>>>>>> add_default_user empty ~n", []),
%% {ok, empty},
ok;
{ok, empty};
%% ok;
add_default_user(Username, Password) ->
case lookup_user(Username) of

View File

@ -29,7 +29,7 @@ defmodule EMQXExhook.MixProject do
defp deps do
[
{:emqx, in_umbrella: true, runtime: false},
# {:grpc, github: "emqx/grpc-erl", tag: "0.6.2"}
{:grpc, github: "emqx/grpc-erl", tag: "0.6.2"},
]
end

View File

@ -54,8 +54,8 @@ defmodule EMQXGateway.MixProject do
[
# {:gpb, "4.19.1", runtime: false},
{:emqx, in_umbrella: true, runtime: false},
{:grpc, github: "emqx/grpc-erl", tag: "0.6.2"},
# {: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

30
apps/emqx_machine/mix.exs Normal file
View File

@ -0,0 +1,30 @@
defmodule EMQXMachine.MixProject do
use Mix.Project
def project do
[
app: :emqx_machine,
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: "The EMQ X Machine"
]
end
def application do
[
registered: [],
mod: {:emqx_machine_app, []},
extra_applications: [:logger]
]
end
defp deps do
[]
end
end

View File

@ -25,6 +25,8 @@
%% @doc EMQ X boot entrypoint.
start() ->
?SLOG(warning, #{ msg => ">>>>>>>>> machine:start enter"
}),
case os:type() of
{win32, nt} -> ok;
_nix ->

View File

@ -27,8 +27,8 @@
-endif.
post_boot() ->
io:format(user, ">>>>>>>>>>>>>>>>>>>> roots ~p~n",
[emqx_conf_schema:roots()]),
%% io:format(user, ">>>>>>>>>>>>>>>>>>>> roots ~p~n",
%% [emqx_conf_schema:roots()]),
ok = ensure_apps_started(),
_ = emqx_plugins:load(),
ok = print_vsn(),
@ -110,7 +110,9 @@ reboot_apps() ->
sorted_reboot_apps() ->
Apps = [{App, app_deps(App)} || App <- reboot_apps()],
sorted_reboot_apps(Apps).
Res = sorted_reboot_apps(Apps),
io:format(user, "~n>>>>>>>>>>>>>> sorted_reboot_apps~n ~100p~n", [Res]),
Res.
app_deps(App) ->
case application:get_key(App, applications) of
@ -121,7 +123,13 @@ app_deps(App) ->
sorted_reboot_apps(Apps) ->
G = digraph:new(),
try
lists:foreach(fun({App, Deps}) -> add_app(G, App, Deps) end, Apps),
lists:foreach(fun({App, Deps}) ->
?SLOG(warning, #{ msg => ">>>>>> machine_boot:add_app"
, app => App
, deps => Deps
}),
add_app(G, App, Deps)
end, Apps),
case digraph_utils:topsort(G) of
Sorted when is_list(Sorted) ->
Sorted;

View File

@ -30,7 +30,7 @@ defmodule EMQXManagement.MixProject do
# {: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"}
{:minirest, github: "emqx/minirest", tag: "1.2.7"},
]
end
end

View File

@ -24,18 +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()]),
%% 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}.

View File

@ -0,0 +1,28 @@
defmodule EMQXPluginLibs.MixProject do
use Mix.Project
def project do
[
app: :emqx_plugin_libs,
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 Plugin utility libs"
]
end
def application do
[
extra_applications: [:logger]
]
end
defp deps do
[]
end
end

View File

@ -10,7 +10,7 @@ defmodule EMQXPrometheus.MixProject do
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.12",
# start_permanent: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
deps: deps(),
description: "Prometheus for EMQ X"
]
@ -27,7 +27,7 @@ defmodule EMQXPrometheus.MixProject do
defp deps do
[
{:emqx, in_umbrella: true, runtime: false},
# {:prometheus, github: "emqx/prometheus.erl", tag: "v3.1.1"}
{:prometheus, github: "emqx/prometheus.erl", tag: "v3.1.1"}
]
end
end

32
apps/emqx_psk/mix.exs Normal file
View File

@ -0,0 +1,32 @@
defmodule EmqxPSK.MixProject do
use Mix.Project
def project do
[
app: :emqx_psk,
version: "5.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 PSK"
]
end
def application do
[
registered: [:emqx_psk_sup],
mod: {:emqx_psk_app, []},
extra_applications: [:logger]
]
end
defp deps do
[
{:emqx, in_umbrella: true, runtime: false}
]
end
end

View File

@ -16,17 +16,17 @@ defmodule EMQXRetainer.MixProject do
]
end
def application do
[
registered: [:emqx_retainer_sup],
mod: {:emqx_retainer_app, []},
# extra_applications: [:logger]
]
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}
{:emqx, in_umbrella: true, runtime: false}
]
end
end

View File

@ -0,0 +1,34 @@
defmodule EMQXRuleEngine.MixProject do
use Mix.Project
def project do
[
app: :emqx_rule_engine,
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(),
description: "EMQ X Rule Engine"
]
end
def application do
[
registered: [:emqx_rule_engine_sup, :emqx_rule_registry],
mod: {:emqx_rule_engine_app, []},
extra_applications: [:logger, :syntax_tools]
]
end
defp deps do
[
{:emqx, in_umbrella: true, runtime: false},
# {:ekka, github: "emqx/ekka", tag: "0.11.1", runtime: false},
# {:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.2.1"}
]
end
end

View File

@ -1 +1,7 @@
import Config
config :logger,
format: "$message\n",
level: :debug,
handle_otp_reports: true,
handle_sasl_reports: true

81
mix.exs
View File

@ -3,8 +3,8 @@ defmodule EMQXUmbrella.MixProject do
def project do
[
# apps_path: "apps",
app: :emqx_mix,
apps_path: "apps",
# app: :emqx_mix,
version: pkg_vsn(),
# start_permanent: Mix.env() == :prod,
start_permanent: false,
@ -56,29 +56,31 @@ defmodule EMQXUmbrella.MixProject do
{: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"},
{:emqtt, github: "emqx/emqtt", tag: "1.4.3"},
{:esasl, github: "emqx/esasl", tag: "0.2.0"},
####
{: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},
# {: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
@ -92,14 +94,27 @@ defmodule EMQXUmbrella.MixProject do
# end
emqx: [
applications: [
logger: :permanent,
# lc: :load,
esasl: :load,
crypto: :permanent,
public_key: :permanent,
asn1: :permanent,
syntax_tools: :permanent,
ssl: :permanent,
os_mon: :permanent,
inets: :permanent,
compiler: :permanent,
runtime_tools: :permanent,
# emqx_conf: :permanent,
emqx: :load,
# emqx_conf: :load, # as per rebar.config.erl
emqx_conf: :permanent,
emqx_conf: :load, # as per rebar.config.erl
emqx_machine: :permanent,
mria: :load,
mnesia: :load,
ekka: :load,
emqx_plugin_libs: :load,
emqx_http_lib: :permanent,
emqx_resource: :permanent,
emqx_connector: :permanent,
emqx_authn: :permanent,
@ -112,13 +127,17 @@ defmodule EMQXUmbrella.MixProject do
emqx_modules: :permanent,
emqx_management: :permanent,
emqx_dashboard: :permanent,
emqx_retainer: :permanent,
emqx_statsd: :permanent,
# emqx_retainer: :permanent,
emqx_retainer: :none,
emqx_prometheus: :permanent,
emqx_psk: :permanent,
emqx_limiter: :permanent,
emqx_mix: :none,
]
# emqx_psk: :permanent,
emqx_psk: :none,
# emqx_limiter: :permanent,
emqx_limiter: :none,
observer: :load,
# emqx_mix: :none,
],
]
]
end

View File

@ -8,13 +8,14 @@
"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"]},
"ekka": {:git, "https://github.com/emqx/ekka.git", "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"]},
"emqtt": {:git, "https://github.com/emqx/emqtt.git", "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"]},
"esasl": {:git, "https://github.com/emqx/esasl.git", "96d7ac9f6c156017dd35b30df2dd722ae469c7f0", [tag: "0.2.0"]},
"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"]},
@ -36,7 +37,7 @@
"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"]},
"prometheus": {:git, "https://github.com/emqx/prometheus.erl.git", "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"]},

5
mix_release.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
mix release --overwrite
cp -r apps/emqx/etc/certs _build/dev/rel/emqx/etc/certs
cp temp/sys.config _build/dev/rel/emqx/releases/5.0.0-beta.2-3fdc075b/

3064
rel/overlays/etc/emqx.conf Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
%% The options in the {server, Opts} tuple are used when calling ssl:ssl_accept/3,
%% and the options in the {client, Opts} tuple are used when calling ssl:connect/4.
%%
%% More information at: http://erlang.org/doc/apps/ssl/ssl_distribution.html
[{server,
[{certfile, "etc/certs/cert.pem"},
{keyfile, "etc/certs/key.pem"},
{secure_renegotiate, true},
{depth, 0}]},
{client,
[{secure_renegotiate, true}]}].

122
rel/overlays/etc/vm.args Normal file
View File

@ -0,0 +1,122 @@
######################################################################
## Erlang VM Args for EMQ X Broker
######################################################################
## NOTE:
##
## Arguments configured in this file might be overridden by configs from `emqx.conf`.
##
## Some basic VM arguments are to be configured in `emqx.conf`,
## such as `node.name` for `-name` and `node.cooke` for `-setcookie`.
## Sets the maximum number of simultaneously existing processes for this system.
+P 2097152
## Sets the maximum number of simultaneously existing ports for this system.
+Q 1048576
## Sets the maximum number of ETS tables
+e 262144
## Sets the maximum number of atoms the virtual machine can handle.
#+t 1048576
## Set the location of crash dumps
#-env ERL_CRASH_DUMP log/crash.dump
## Set how many times generational garbages collections can be done without
## forcing a fullsweep collection.
-env ERL_FULLSWEEP_AFTER 1000
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
## (Disabled by default..use with caution!)
#-heart
## Specify the erlang distributed protocol.
## Can be one of: inet_tcp, inet6_tcp, inet_tls
#-proto_dist inet_tcp
## Specify SSL Options in the file if using SSL for Erlang Distribution.
## Used only when -proto_dist set to inet_tls
#-ssl_dist_optfile etc/ssl_dist.conf
## Specifies the net_kernel tick time in seconds.
## This is the approximate time a connected node may be unresponsive until
## it is considered down and thereby disconnected.
-kernel net_ticktime 120
## Sets the distribution buffer busy limit (dist_buf_busy_limit).
#+zdbbl 8192
## Sets default scheduler hint for port parallelism.
+spp true
## Sets the number of threads in async thread pool. Valid range is 0-1024.
## Increase the parameter if there are many simultaneous file I/O operations.
+A 4
## Sets the default heap size of processes to the size Size.
#+hms 233
## Sets the default binary virtual heap size of processes to the size Size.
#+hmbs 46422
## Sets the default maximum heap size of processes to the size Size.
## Defaults to 0, which means that no maximum heap size is used.
##For more information, see process_flag(max_heap_size, MaxHeapSize).
#+hmax 0
## Sets the default value for process flag message_queue_data. Defaults to on_heap.
#+hmqd on_heap | off_heap
## Sets the number of IO pollsets to use when polling for I/O.
#+IOp 1
## Sets the number of IO poll threads to use when polling for I/O.
## Increase this for the busy systems with many concurrent connection.
+IOt 4
## Sets the number of scheduler threads to create and scheduler threads to set online.
#+S 8:8
## Sets the number of dirty CPU scheduler threads to create and dirty CPU scheduler threads to set online.
#+SDcpu 8:8
## Sets the number of dirty I/O scheduler threads to create.
+SDio 8
## Suggested stack size, in kilowords, for scheduler threads.
#+sss 32
## Suggested stack size, in kilowords, for dirty CPU scheduler threads.
#+sssdcpu 40
## Suggested stack size, in kilowords, for dirty IO scheduler threads.
#+sssdio 40
## Sets scheduler bind type.
## Can be one of: u, ns, ts, ps, s, nnts, nnps, tnnps, db
#+sbt db
## Sets a user-defined CPU topology.
#+sct L0-3c0-3p0N0:L4-7c0-3p1N1
## Sets the mapping of warning messages for error_logger
#+W w
## Sets time warp mode: no_time_warp | single_time_warp | multi_time_warp
#+C no_time_warp
## Prevents loading information about source filenames and line numbers.
#+L
## Specifies how long time (in milliseconds) to spend shutting down the system.
## See: http://erlang.org/doc/man/erl.html
-shutdown_time 30000
## patches dir
-pa data/patches
## Mnesia thresholds
-mnesia dump_log_write_threshold 5000
-mnesia dump_log_time_threshold 60000

View File

@ -0,0 +1,24 @@
######################################################################
## NOTE: Do NOT replace this file during release upgrade.
## Update the vars to the end of this file instead.
######################################################################
## constants from relx template
REL_VSN="5.0-beta.2-3fdc075b-eaa05d72"
ERTS_VSN="12.1.2"
ERL_OPTS=""
RUNNER_ROOT_DIR="$(cd $(dirname $(readlink $0 || echo $0))/..; pwd -P)"
RUNNER_BIN_DIR="$RUNNER_ROOT_DIR/bin"
RUNNER_LOG_DIR="$RUNNER_ROOT_DIR/log"
RUNNER_LIB_DIR="$RUNNER_ROOT_DIR/lib"
RUNNER_ETC_DIR="$RUNNER_ROOT_DIR/etc"
RUNNER_DATA_DIR="$RUNNER_ROOT_DIR/data"
RUNNER_USER=""
EMQX_LICENSE_CONF=''
export EMQX_DESCRIPTION='EMQ X Community Edition'
## computed vars
REL_NAME="emqx"
ERTS_PATH="$RUNNER_ROOT_DIR/erts-$ERTS_VSN/bin"
## updated vars here

87
temp/sys.config Normal file
View File

@ -0,0 +1,87 @@
%% coding: utf-8
%% RUNTIME_CONFIG=false
[{logger,[{format,<<36,109,101,115,115,97,103,101,10>>},{level,debug},{handle_otp_reports,true},{handle_sasl_reports,true}]},
{ekka,
[{cluster_discovery,{manual,[]}},
{proto_dist,inet_tcp},
{cluster_autoheal,true},
{cluster_autoclean,300000},
{cluster_name,emqxcl}]},
{mria,
[{tlog_push_mode,async},
{rlog_rpc_module,gen_rpc},
{core_nodes,[]},
{node_role,core},
{db_backend,mnesia}]},
{gen_rpc,
[{socket_buffer,1048576},
{socket_recbuf,1048576},
{socket_sndbuf,1048576},
{socket_keepalive_count,9},
{socket_keepalive_interval,75},
{socket_keepalive_idle,900},
{call_receive_timeout,15000},
{authentication_timeout,5000},
{send_timeout,5000},
{connect_timeout,5000},
{tcp_server_port,5369},
{port_discovery,stateless},
{max_batch_size,256}]},
{kernel,
[{error_logger,silent},
{inet_dist_listen_max,6369},
{inet_dist_listen_min,6369},
{logger,
[{handler,default,undefined},
{handler,console,logger_std_h,
#{config =>
#{burst_limit_enable => false,burst_limit_max_count => 10000,
burst_limit_window_time => 1000,drop_mode_qlen => 3000,
flush_qlen => 8000,overload_kill_enable => true,
overload_kill_mem_size => 31457280,overload_kill_qlen => 20000,
overload_kill_restart_after => 5000,sync_mode_qlen => 100,
type => standard_io},
filters =>
[{drop_progress_reports,{fun logger_filters:progress/2,stop}}],
formatter =>
{emqx_logger_textfmt,
#{chars_limit => unlimited,depth => 100,single_line => true,
template =>
[time," [",level,"] ",
{clientid,
[{peername,[clientid,"@",peername," "],[clientid," "]}],
[{peername,[peername," "],[]}]},
msg,"\n"],
time_offset => []}},
level => debug}},
{handler,default,logger_disk_log_h,
#{config =>
#{burst_limit_enable => false,burst_limit_max_count => 10000,
burst_limit_window_time => 1000,drop_mode_qlen => 3000,
file => "log/emqx.log",flush_qlen => 8000,max_no_bytes => 10485760,
max_no_files => 10,overload_kill_enable => true,
overload_kill_mem_size => 31457280,overload_kill_qlen => 20000,
overload_kill_restart_after => 5000,sync_mode_qlen => 100,
type => wrap},
filesync_repeat_interval => no_repeat,
filters =>
[{drop_progress_reports,{fun logger_filters:progress/2,stop}}],
formatter =>
{emqx_logger_textfmt,
#{chars_limit => unlimited,depth => 100,single_line => true,
template =>
[time," [",level,"] ",
{clientid,
[{peername,[clientid,"@",peername," "],[clientid," "]}],
[{peername,[peername," "],[]}]},
msg,"\n"],
time_offset => []}},
level => warning}}]},
{logger_level,debug}]},
{emqx_machine,[{backtrace_depth,23},{global_gc_interval,900000}]},
{emqx,
[{data_dir,"data/"},
{local_override_conf_file,"data/configs/local-override.conf"},
{cluster_override_conf_file,"data/configs/cluster-override.conf"},
{config_files,
["/home/thales/dev/emqx/emqx_mix/_build/dev/rel/emqx/etc/emqx.conf"]}]}].