chore(mix): simplify build by using rebar3 for umbrella apps

By treating the apps in the umbrella as dependencies to be managed and
built by rebar3, we can simplify the maintenance of the release, at
the cost of increased build times: using Mix as before, it could track
changed files better than using rebar.  But the complexity and
possibility of discrepancies make it using rebar much more compelling.
This commit is contained in:
Thales Macedo Garitezi 2021-12-21 20:38:11 -03:00
parent 2ff46a6dbb
commit 34d6dbca61
No known key found for this signature in database
GPG Key ID: DD279F8152A9B6DD
49 changed files with 116 additions and 668 deletions

6
.formatter.exs Normal file
View File

@ -0,0 +1,6 @@
[
inputs: [
"mix.exs",
"config/*.exs"
]
]

View File

@ -1,2 +1,2 @@
erlang 24.1.5-3 erlang 24.1.2
elixir 1.13.1-otp-24 elixir 1.13.1-otp-24

View File

@ -1,39 +0,0 @@
defmodule EMQX.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
[
mod: EMQX.Mix.Common.from_erl!(:emqx, :mod),
applications: EMQX.Mix.Common.from_erl!(:emqx, :applications)
]
end
# since emqx app is more complicated than others, we manually set
# its dependencies here
defp deps() do
[
{:lc, git: "https://github.com/qzhuyan/lc.git", tag: "0.1.2"},
{:gproc, git: "https://github.com/uwiger/gproc", tag: "0.8.0"},
{:typerefl, git: "https://github.com/k32/typerefl", tag: "0.8.5"},
{:jiffy, git: "https://github.com/emqx/jiffy", tag: "1.0.5"},
{:cowboy, git: "https://github.com/emqx/cowboy", tag: "2.9.0"},
{:esockd, git: "https://github.com/emqx/esockd", tag: "5.9.0"},
{:ekka, git: "https://github.com/emqx/ekka", tag: "0.11.1"},
{:gen_rpc, git: "https://github.com/emqx/gen_rpc", tag: "2.5.1"},
{:hocon, git: "https://github.com/emqx/hocon.git", tag: "0.22.0"},
{:pbkdf2, git: "https://github.com/emqx/erlang-pbkdf2.git", tag: "2.0.4"},
{:recon, git: "https://github.com/ferd/recon", tag: "2.5.1"},
{:snabbkaffe, git: "https://github.com/kafka4beam/snabbkaffe.git", tag: "0.16.0"}
]
end
end

View File

@ -1,21 +0,0 @@
defmodule EMQXAuthn.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_authn
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1,4 +1,5 @@
{deps, []}. {deps, [ {emqx, {path, "../emqx"}}
]}.
{edoc_opts, [{preprocess, true}]}. {edoc_opts, [{preprocess, true}]}.
{erl_opts, [warn_unused_vars, {erl_opts, [warn_unused_vars,

View File

@ -1,23 +0,0 @@
defmodule EMQXAuthz.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_authz
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app,
extra_applications: [:crypto]
)
end
defp deps() do
[]
end
end

View File

@ -1,5 +1,5 @@
{erl_opts, [debug_info, nowarn_unused_import]}. {erl_opts, [debug_info, nowarn_unused_import]}.
{deps, []}. {deps, [{emqx, {path, "../emqx"}}]}.
{shell, [ {shell, [
% {config, "config/sys.config"}, % {config, "config/sys.config"},

View File

@ -1,21 +0,0 @@
defmodule EMQXAutoSubscribe.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_auto_subscribe
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1,5 +1,6 @@
{erl_opts, [debug_info]}. {erl_opts, [debug_info]}.
{deps, []}. {deps, [ {emqx, {path, "../emqx"}}
]}.
{shell, [ {shell, [
{apps, [emqx_auto_subscribe]} {apps, [emqx_auto_subscribe]}

View File

@ -1,21 +0,0 @@
defmodule EMQXBridge.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_bridge
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1,5 +1,6 @@
{erl_opts, [debug_info]}. {erl_opts, [debug_info]}.
{deps, []}. {deps, [ {emqx, {path, "../emqx"}}
]}.
{shell, [ {shell, [
% {config, "config/sys.config"}, % {config, "config/sys.config"},

View File

@ -1,23 +0,0 @@
defmodule EMQXConf.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_conf
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[
{:emqx, in_umbrella: true}
]
end
end

View File

@ -1,5 +1,6 @@
{erl_opts, [debug_info]}. {erl_opts, [debug_info]}.
{deps, []}. {deps, [ {emqx, {path, "../emqx"}}
]}.
{shell, [ {shell, [
% {config, "config/sys.config"}, % {config, "config/sys.config"},

View File

@ -3,7 +3,6 @@
{vsn, "0.1.0"}, {vsn, "0.1.0"},
{registered, []}, {registered, []},
{mod, {emqx_conf_app, []}}, {mod, {emqx_conf_app, []}},
{included_applications, [hocon]},
{applications, [kernel, stdlib]}, {applications, [kernel, stdlib]},
{env, []}, {env, []},
{modules, []} {modules, []}

View File

@ -1,28 +0,0 @@
defmodule EMQXConnector.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_connector
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
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"},
{:emqtt, github: "emqx/emqtt", tag: "1.4.3"},
{:eredis_cluster, github: "emqx/eredis_cluster", tag: "0.6.7"},
{:mongodb, github: "emqx/mongodb-erlang", tag: "v3.0.10"}
]
end
end

View File

@ -4,6 +4,7 @@
]}. ]}.
{deps, [ {deps, [
{emqx, {path, "../emqx"}},
{eldap2, {git, "https://github.com/emqx/eldap2", {tag, "v0.2.2"}}}, {eldap2, {git, "https://github.com/emqx/eldap2", {tag, "v0.2.2"}}},
{mysql, {git, "https://github.com/emqx/mysql-otp", {tag, "1.7.1"}}}, {mysql, {git, "https://github.com/emqx/mysql-otp", {tag, "1.7.1"}}},
{epgsql, {git, "https://github.com/emqx/epgsql", {tag, "4.6.0"}}}, {epgsql, {git, "https://github.com/emqx/epgsql", {tag, "4.6.0"}}},

View File

@ -12,6 +12,7 @@
eredis_cluster, eredis_cluster,
eredis, eredis,
epgsql, epgsql,
eldap2,
mysql, mysql,
mongodb, mongodb,
ehttpc, ehttpc,

View File

@ -1,23 +0,0 @@
defmodule EMQXDashboard.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_dashboard
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[
{:emqx, in_umbrella: true}
]
end
end

View File

@ -1,4 +1,6 @@
{deps, []}. {deps, [ {typerefl, {git, "https://github.com/k32/typerefl", {tag, "0.8.5"}}}
, {emqx, {path, "../emqx"}}
]}.
{edoc_opts, [{preprocess, true}]}. {edoc_opts, [{preprocess, true}]}.
{erl_opts, [warn_unused_vars, {erl_opts, [warn_unused_vars,

View File

@ -1,29 +0,0 @@
defmodule EMQXExhook.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_exhook
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps(),
compilers: [:protos | Mix.compilers()],
aliases: ["compile.protos": &protos/1]
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
defp protos(_args) do
__ENV__.file
|> Path.dirname()
|> EMQX.Mix.Common.compile_protos()
end
end

View File

@ -5,7 +5,8 @@
]}. ]}.
{deps, {deps,
[{grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.4"}}} [ {emqx, {path, "../emqx"}}
, {grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.4"}}}
]}. ]}.
{grpc, {grpc,

View File

@ -1,32 +0,0 @@
defmodule EMQXGateway.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_gateway
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps(),
compilers: [:protos | Mix.compilers()],
aliases: ["compile.protos": &protos/1]
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp protos(_args) do
__ENV__.file
|> Path.dirname()
|> EMQX.Mix.Common.compile_protos()
end
defp deps() do
EMQX.Mix.Common.from_rebar_deps!() ++
[
{:emqx, in_umbrella: true}
]
end
end

View File

@ -1,5 +1,6 @@
{erl_opts, [debug_info]}. {erl_opts, [debug_info]}.
{deps, [ {deps, [
{emqx, {path, "../emqx"}},
{grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.4"}}} {grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.4"}}}
]}. ]}.

View File

@ -1,21 +0,0 @@
defmodule EMQXMachine.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_machine
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -0,0 +1,2 @@
{deps, [ {emqx, {path, "../emqx"}}
]}.

View File

@ -1,21 +0,0 @@
defmodule EMQXManagement.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_management
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1,4 +1,5 @@
{deps, []}. {deps, [ {emqx, {path, "../emqx"}}
]}.
{edoc_opts, [{preprocess, true}]}. {edoc_opts, [{preprocess, true}]}.
{erl_opts, [warn_unused_vars, {erl_opts, [warn_unused_vars,

View File

@ -1,21 +0,0 @@
defmodule EMQXModules.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_modules
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1 +1,2 @@
{deps, []}. {deps, [ {emqx, {path, "../emqx"}}
]}.

View File

@ -1,21 +0,0 @@
defmodule EMQXPluginLibs.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_plugin_libs
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1,21 +0,0 @@
defmodule EMQXPlugins.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_plugins
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -0,0 +1,2 @@
{deps, [ {emqx, {path, "../emqx"}}
]}.

View File

@ -1,21 +0,0 @@
defmodule EMQXPrometheus.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_prometheus
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app, deps: deps())
end
defp deps() do
EMQX.Mix.Common.from_rebar_deps!()
end
end

View File

@ -1,6 +1,8 @@
{deps, {deps,
[ %% FIXME: tag this as v3.1.3 [ %% FIXME: tag this as v3.1.3
{prometheus, {git, "https://github.com/emqx/prometheus.erl", {ref, "9994c76adca40d91a2545102230ccce2423fd8a7"}}} {prometheus, {git, "https://github.com/emqx/prometheus.erl", {ref, "9994c76adca40d91a2545102230ccce2423fd8a7"}}},
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.22.0"}}},
{minirest, {git, "https://github.com/emqx/minirest", {tag, "1.2.7"}}}
]}. ]}.
{edoc_opts, [{preprocess, true}]}. {edoc_opts, [{preprocess, true}]}.

View File

@ -1,21 +0,0 @@
defmodule EmqxPSK.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_psk
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1,4 +1,5 @@
{deps, []}. {deps, [ {emqx, {path, "../emqx"}}
]}.
{edoc_opts, [{preprocess, true}]}. {edoc_opts, [{preprocess, true}]}.
{erl_opts, [warn_unused_vars, {erl_opts, [warn_unused_vars,

View File

@ -1,21 +0,0 @@
defmodule EMQXResource.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_resource
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1,21 +0,0 @@
defmodule EMQXRetainer.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_retainer
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1,4 +1,5 @@
{deps, []}. {deps, [ {emqx, {path, "../emqx"}}
]}.
{edoc_opts, [{preprocess, true}]}. {edoc_opts, [{preprocess, true}]}.
{erl_opts, [warn_unused_vars, {erl_opts, [warn_unused_vars,

View File

@ -1,21 +0,0 @@
defmodule EMQXRuleEngine.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_rule_engine
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -1,4 +1,5 @@
{deps, []}. {deps, [ {emqx, {path, "../emqx"}}
]}.
{erl_opts, [warn_unused_vars, {erl_opts, [warn_unused_vars,
warn_shadow_vars, warn_shadow_vars,

View File

@ -1,21 +0,0 @@
defmodule EMQXSlowSubs.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_slow_subs
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
[]
end
end

View File

@ -0,0 +1,2 @@
{deps, [ {emqx, {path, "../emqx"}}
]}.

View File

@ -1,21 +0,0 @@
defmodule EMQXStatsd.MixProject do
use Mix.Project
Code.require_file("../../lib/emqx/mix/common.ex")
@app :emqx_statsd
def project() do
EMQX.Mix.Common.project(
@app,
deps: deps()
)
end
def application() do
EMQX.Mix.Common.application(@app)
end
defp deps() do
EMQX.Mix.Common.from_rebar_deps!()
end
end

View File

@ -1,107 +0,0 @@
defmodule EMQX.Mix.Common do
@kernel_apps [:kernel, :stdlib, :sasl, :elixir]
def project(app, overrides \\ []) when is_atom(app) and app != nil do
%{
vsn: version,
description: description
} =
app
|> erl_app_props!()
|> Map.take([:vsn, :description])
|> Map.new(fn {k, v} -> {k, to_string(v)} end)
Keyword.merge(
[
app: app,
version: version,
description: description,
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.13"
],
overrides
)
end
def application(app, overrides \\ []) when app != nil do
{deps, overrides} = Keyword.pop(overrides, :deps, [])
# get only the dependency names
deps = Enum.map(deps, &elem(&1, 0))
app
|> erl_app_props!()
|> Map.take([:registered, :mod, :applications])
|> Map.update!(:applications,
fn apps ->
deps ++ apps -- @kernel_apps
end)
|> Enum.reject(fn {_k, v} -> is_nil(v) end)
|> Keyword.new()
|> Keyword.merge(overrides)
end
def erl_apps(app) when app != nil do
from_erl!(app, :applications)
end
def erl_app_props!(app) do
path = Path.join("src", "#{app}.app.src")
{:ok, [{:application, ^app, props}]} = :file.consult(path)
Map.new(props)
end
def from_erl!(app, key) when app != nil do
app
|> erl_app_props!()
|> Map.fetch!(key)
end
def from_rebar_deps!() do
path = "rebar.config"
{:ok, props} = :file.consult(path)
props
|> Keyword.fetch!(:deps)
|> Enum.map(&rebar_to_mix_dep/1)
end
def rebar_to_mix_dep({name, {:git, url, {:tag, tag}}}),
do: {name, git: to_string(url), tag: to_string(tag)}
def rebar_to_mix_dep({name, {:git, url, {:ref, ref}}}),
do: {name, git: to_string(url), ref: to_string(ref)}
def rebar_to_mix_dep({name, {:git, url, {:branch, branch}}}),
do: {name, git: to_string(url), branch: to_string(branch)}
def rebar_to_mix_dep({name, vsn}) when is_list(vsn),
do: {name, to_string(vsn)}
def compile_protos(mix_filepath) do
app_path = Path.dirname(mix_filepath)
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

68
mix.exs
View File

@ -10,7 +10,7 @@ defmodule EMQXUmbrella.MixProject do
def project do def project do
[ [
apps_path: "apps", app: :emqx_mix,
version: pkg_vsn(), version: pkg_vsn(),
deps: deps(), deps: deps(),
releases: releases() releases: releases()
@ -31,19 +31,19 @@ defmodule EMQXUmbrella.MixProject do
{:mria, github: "emqx/mria", tag: "0.1.5", override: true}, {:mria, github: "emqx/mria", tag: "0.1.5", override: true},
{:ekka, github: "emqx/ekka", tag: "0.11.1", override: true}, {:ekka, github: "emqx/ekka", tag: "0.11.1", override: true},
{:gen_rpc, github: "emqx/gen_rpc", tag: "2.5.1", override: true}, {:gen_rpc, github: "emqx/gen_rpc", tag: "2.5.1", override: true},
{:minirest, github: "emqx/minirest", tag: "1.2.7"}, {:minirest, github: "emqx/minirest", tag: "1.2.7", override: true},
{:ecpool, github: "emqx/ecpool", tag: "0.5.1"}, {:ecpool, github: "emqx/ecpool", tag: "0.5.1"},
{:replayq, "0.3.3", override: true}, {:replayq, "0.3.3", override: true},
{:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4", override: true}, {:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4", override: true},
{:emqtt, github: "emqx/emqtt", tag: "1.4.3"}, {:emqtt, github: "emqx/emqtt", tag: "1.4.3", override: true},
{:rulesql, github: "emqx/rulesql", tag: "0.1.4"}, {:rulesql, github: "emqx/rulesql", tag: "0.1.4"},
{:observer_cli, "1.7.1"}, {:observer_cli, "1.7.1"},
{:system_monitor, github: "klarna-incubator/system_monitor", tag: "2.2.0"}, {:system_monitor, github: "klarna-incubator/system_monitor", tag: "2.2.0"},
# in conflict by emqtt and hocon # in conflict by emqtt and hocon
{:getopt, "1.0.2", override: true}, {:getopt, "1.0.2", override: true},
{:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "0.16.0", override: true}, {:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "0.16.0", override: true},
{:hocon, github: "emqx/hocon", tag: "0.22.0"}, {:hocon, github: "emqx/hocon", tag: "0.22.0", override: true},
{:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.4.1"}, {:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.4.1", override: true},
{:esasl, github: "emqx/esasl", tag: "0.2.0"}, {:esasl, github: "emqx/esasl", tag: "0.2.0"},
{:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"}, {:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"},
# in conflict by ehttpc and emqtt # in conflict by ehttpc and emqtt
@ -57,11 +57,41 @@ defmodule EMQXUmbrella.MixProject do
# in conflict by cowboy_swagger and cowboy # in conflict by cowboy_swagger and cowboy
{:ranch, "1.8.0", override: true}, {:ranch, "1.8.0", override: true},
# in conflict by emqx and observer_cli # in conflict by emqx and observer_cli
{:recon, github: "ferd/recon", tag: "2.5.1", override: true} {:recon, github: "ferd/recon", tag: "2.5.1", override: true},
] ++ bcrypt_dep() ++ quicer_dep() {:jsx, github: "talentdeficit/jsx", tag: "v3.1.0", override: true}
] ++
Enum.map(
[
:emqx,
:emqx_conf,
:emqx_machine,
:emqx_plugin_libs,
:emqx_resource,
:emqx_connector,
:emqx_authn,
:emqx_authz,
:emqx_auto_subscribe,
:emqx_gateway,
:emqx_exhook,
:emqx_bridge,
:emqx_rule_engine,
:emqx_modules,
:emqx_management,
:emqx_dashboard,
:emqx_statsd,
:emqx_retainer,
:emqx_prometheus,
:emqx_psk,
:emqx_slow_subs,
:emqx_plugins
],
&umbrella/1
) ++ bcrypt_dep() ++ quicer_dep()
end end
defp releases do defp umbrella(app), do: {app, path: "apps/#{app}", manager: :rebar3, override: true}
defp releases() do
[ [
emqx: [ emqx: [
applications: [ applications: [
@ -102,7 +132,8 @@ defmodule EMQXUmbrella.MixProject do
emqx_prometheus: :permanent, emqx_prometheus: :permanent,
emqx_psk: :permanent, emqx_psk: :permanent,
emqx_slow_subs: :permanent, emqx_slow_subs: :permanent,
emqx_plugins: :permanent emqx_plugins: :permanent,
emqx_mix: :none
], ],
skip_mode_validation_for: [ skip_mode_validation_for: [
:emqx_gateway, :emqx_gateway,
@ -122,7 +153,7 @@ defmodule EMQXUmbrella.MixProject do
:assemble, :assemble,
&create_RELEASES/1, &create_RELEASES/1,
&copy_files/1, &copy_files/1,
&copy_nodetool/1, &copy_nodetool/1
] ]
] ]
] ]
@ -149,35 +180,40 @@ defmodule EMQXUmbrella.MixProject do
Path.join(etc, "vm.args"), Path.join(etc, "vm.args"),
force: overwrite? force: overwrite?
) )
Mix.Generator.copy_file( Mix.Generator.copy_file(
"apps/emqx/etc/emqx_cloud/vm.args", "apps/emqx/etc/emqx_cloud/vm.args",
Path.join(release.version_path, "vm.args"), Path.join(release.version_path, "vm.args"),
force: overwrite? force: overwrite?
) )
release release
end end
# needed by nodetool and by release_handler # needed by nodetool and by release_handler
def create_RELEASES(release) do def create_RELEASES(release) do
apps = Enum.map(release.applications, fn {app_name, app_props} -> apps =
Enum.map(release.applications, fn {app_name, app_props} ->
app_vsn = Keyword.fetch!(app_props, :vsn) app_vsn = Keyword.fetch!(app_props, :vsn)
app_path = app_path =
"./lib" "./lib"
|> Path.join("#{app_name}-#{app_vsn}") |> Path.join("#{app_name}-#{app_vsn}")
|> to_charlist() |> to_charlist()
{app_name, app_vsn, app_path} {app_name, app_vsn, app_path}
end) end)
release_entry =
[{ release_entry = [
{
:release, :release,
to_charlist(release.name), to_charlist(release.name),
to_charlist(release.version), to_charlist(release.version),
release.erts_version, release.erts_version,
apps, apps,
:permanent :permanent
}] }
]
release.path release.path
|> Path.join("releases") |> Path.join("releases")
@ -207,7 +243,7 @@ defmodule EMQXUmbrella.MixProject do
def bcrypt_dep() do def bcrypt_dep() do
if enable_bcrypt?(), if enable_bcrypt?(),
do: [{:bcrypt, github: "emqx/erlang-bcrypt", tag: "0.6.0"}], do: [{:bcrypt, github: "emqx/erlang-bcrypt", tag: "0.6.0", override: true}],
else: [] else: []
end end

View File

@ -10,11 +10,12 @@
"eetcd": {:git, "https://github.com/zhongwencool/eetcd", "69d50aca98247953ee8a3ff58423a693f8318d90", [tag: "v0.3.4"]}, "eetcd": {:git, "https://github.com/zhongwencool/eetcd", "69d50aca98247953ee8a3ff58423a693f8318d90", [tag: "v0.3.4"]},
"ehttpc": {:git, "https://github.com/emqx/ehttpc.git", "7b1a76b2353b385725e62f948cd399c7040467f8", [tag: "0.1.12"]}, "ehttpc": {:git, "https://github.com/emqx/ehttpc.git", "7b1a76b2353b385725e62f948cd399c7040467f8", [tag: "0.1.12"]},
"ekka": {:git, "https://github.com/emqx/ekka.git", "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.git", "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", "b84d42239fb09fecf50d9469fac914fb9b8efe34", [tag: "0.4.1"]}, "emqx_http_lib": {:git, "https://github.com/emqx/emqx_http_lib.git", "b84d42239fb09fecf50d9469fac914fb9b8efe34", [tag: "0.4.1"]},
"epgsql": {:git, "https://github.com/epgsql/epgsql.git", "f7530f63ae40ea2b81bae7d4a33292212349b761", [tag: "4.6.0"]}, "epgsql": {:git, "https://github.com/epgsql/epgsql.git", "f7530f63ae40ea2b81bae7d4a33292212349b761", [tag: "4.6.0"]},
"eredis": {:hex, :eredis, "1.2.0", "0b8e9cfc2c00fa1374cd107ea63b49be08d933df2cf175e6a89b73dd9c380de4", [:rebar3], [], "hexpm", "d9b5abef2c2c8aba8f32aa018203e0b3dc8b1157773b254ab1d4c2002317f1e1"}, "eredis": {:git, "https://github.com/emqx/eredis", "75f2b8eedbe631136326680225efbcd2684e93e7", [tag: "1.2.5"]},
"eredis_cluster": {:git, "https://github.com/emqx/eredis_cluster.git", "624749b4aef25668e9c7a545427fdc663a04faef", [tag: "0.6.7"]}, "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"]}, "esasl": {:git, "https://github.com/emqx/esasl.git", "96d7ac9f6c156017dd35b30df2dd722ae469c7f0", [tag: "0.2.0"]},
"esockd": {:git, "https://github.com/emqx/esockd.git", "abb01f31c47303b4b4eecdbfe8401feedb6b4216", [tag: "5.9.0"]}, "esockd": {:git, "https://github.com/emqx/esockd.git", "abb01f31c47303b4b4eecdbfe8401feedb6b4216", [tag: "5.9.0"]},
"estatsd": {:git, "https://github.com/emqx/estatsd", "5184d846b7ecb83509bd4d32695c60428c0198cd", [tag: "0.1.0"]}, "estatsd": {:git, "https://github.com/emqx/estatsd", "5184d846b7ecb83509bd4d32695c60428c0198cd", [tag: "0.1.0"]},
@ -29,15 +30,15 @@
"hut": {:hex, :hut, "1.3.0", "71f2f054e657c03f959cf1acc43f436ea87580696528ca2a55c8afb1b06c85e7", [:"erlang.mk", :rebar, :rebar3], [], "hexpm", "7e15d28555d8a1f2b5a3a931ec120af0753e4853a4c66053db354f35bf9ab563"}, "hut": {:hex, :hut, "1.3.0", "71f2f054e657c03f959cf1acc43f436ea87580696528ca2a55c8afb1b06c85e7", [:"erlang.mk", :rebar, :rebar3], [], "hexpm", "7e15d28555d8a1f2b5a3a931ec120af0753e4853a4c66053db354f35bf9ab563"},
"jiffy": {:git, "https://github.com/emqx/jiffy.git", "baa1f4e750ae3c5c9e54f9c2e52280b7fc24a8d9", [tag: "1.0.5"]}, "jiffy": {:git, "https://github.com/emqx/jiffy.git", "baa1f4e750ae3c5c9e54f9c2e52280b7fc24a8d9", [tag: "1.0.5"]},
"jose": {:git, "https://github.com/potatosalad/erlang-jose.git", "991649695aaccd92c8effb1c1e88e6159fe8e9a6", [tag: "1.11.2"]}, "jose": {:git, "https://github.com/potatosalad/erlang-jose.git", "991649695aaccd92c8effb1c1e88e6159fe8e9a6", [tag: "1.11.2"]},
"jsx": {:hex, :jsx, "2.9.0", "d2f6e5f069c00266cad52fb15d87c428579ea4d7d73a33669e12679e203329dd", [:mix, :rebar3], [], "hexpm", "8ee1db1cabafdd578a2776a6aaae87c2a8ce54b47b59e9ec7dab5d7eb71cd8dc"}, "jsx": {:git, "https://github.com/talentdeficit/jsx.git", "bb9b3e570a7efe331eed0900c3a5188043a850d7", [tag: "v3.1.0"]},
"lc": {:git, "https://github.com/qzhuyan/lc.git", "6f98d098e5aaf4fcd6afbbb2acca96855c474600", [tag: "0.1.2"]}, "lc": {:git, "https://github.com/qzhuyan/lc.git", "6f98d098e5aaf4fcd6afbbb2acca96855c474600", [tag: "0.1.2"]},
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
"makeup_elixir": {:hex, :makeup_elixir, "0.15.2", "dc72dfe17eb240552857465cc00cce390960d9a0c055c4ccd38b70629227e97c", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "fd23ae48d09b32eff49d4ced2b43c9f086d402ee4fd4fcb2d7fad97fa8823e75"}, "makeup_elixir": {:hex, :makeup_elixir, "0.15.2", "dc72dfe17eb240552857465cc00cce390960d9a0c055c4ccd38b70629227e97c", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "fd23ae48d09b32eff49d4ced2b43c9f086d402ee4fd4fcb2d7fad97fa8823e75"},
"minirest": {:git, "https://github.com/emqx/minirest.git", "f3f80b3e07295d8b6db22ed456318e0cc9dd167f", [tag: "1.2.7"]}, "minirest": {:git, "https://github.com/emqx/minirest.git", "f3f80b3e07295d8b6db22ed456318e0cc9dd167f", [tag: "1.2.7"]},
"mnesia_rocksdb": {:git, "https://github.com/k32/mnesia_rocksdb", "68a80d127c49005480e0dd1f73149e8621052100", [tag: "0.1.5-k32"]}, "mnesia_rocksdb": {:git, "https://github.com/k32/mnesia_rocksdb", "68a80d127c49005480e0dd1f73149e8621052100", [tag: "0.1.5-k32"]},
"mongodb": {:git, "https://github.com/emqx/mongodb-erlang.git", "2ffe62f42dafb98eaafead9d340a674c5f9279a5", [tag: "v3.0.10"]}, "mongodb": {:git, "https://github.com/emqx/mongodb-erlang", "2ffe62f42dafb98eaafead9d340a674c5f9279a5", [tag: "v3.0.10"]},
"mria": {:git, "https://github.com/emqx/mria.git", "2bf3a71abc3635f910be4b943fa4ccbf8b8257fa", [tag: "0.1.5"]}, "mria": {:git, "https://github.com/emqx/mria.git", "2bf3a71abc3635f910be4b943fa4ccbf8b8257fa", [tag: "0.1.5"]},
"mysql": {:git, "https://github.com/emqx/mysql-otp.git", "bdabac44cc8836a9e23897b7e1b77c7df7e04f70", [tag: "1.7.1"]}, "mysql": {:git, "https://github.com/emqx/mysql-otp", "bdabac44cc8836a9e23897b7e1b77c7df7e04f70", [tag: "1.7.1"]},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.0", "b44d75e2a6542dcb6acf5d71c32c74ca88960421b6874777f79153bbbbd7dccc", [:mix], [], "hexpm", "52b2871a7515a5ac49b00f214e4165a40724cf99798d8e4a65e4fd64ebd002c1"}, "nimble_parsec": {:hex, :nimble_parsec, "1.2.0", "b44d75e2a6542dcb6acf5d71c32c74ca88960421b6874777f79153bbbbd7dccc", [:mix], [], "hexpm", "52b2871a7515a5ac49b00f214e4165a40724cf99798d8e4a65e4fd64ebd002c1"},
"observer_cli": {:hex, :observer_cli, "1.7.1", "c9ca1f623a3ef0158283a3c37cd7b7235bfe85927ad6e26396dd247e2057f5a1", [:mix, :rebar3], [{:recon, "~>2.5.1", [hex: :recon, repo: "hexpm", optional: false]}], "hexpm", "4ccafaaa2ce01b85ddd14591f4d5f6731b4e13b610a70fb841f0701178478280"}, "observer_cli": {:hex, :observer_cli, "1.7.1", "c9ca1f623a3ef0158283a3c37cd7b7235bfe85927ad6e26396dd247e2057f5a1", [:mix, :rebar3], [{:recon, "~>2.5.1", [hex: :recon, repo: "hexpm", optional: false]}], "hexpm", "4ccafaaa2ce01b85ddd14591f4d5f6731b4e13b610a70fb841f0701178478280"},
"pbkdf2": {:git, "https://github.com/emqx/erlang-pbkdf2.git", "45d9981209ea07a83a58cf85aaf8236457da4342", [tag: "2.0.4"]}, "pbkdf2": {:git, "https://github.com/emqx/erlang-pbkdf2.git", "45d9981209ea07a83a58cf85aaf8236457da4342", [tag: "2.0.4"]},

View File

@ -22,5 +22,6 @@ sed -i -E 's#level => warning#level => debug#g' _build/dev/rel/emqx/releases/5.0
# cp _build/emqx/rel/emqx/releases/emqx_vars _build/dev/rel/emqx/releases/ # cp _build/emqx/rel/emqx/releases/emqx_vars _build/dev/rel/emqx/releases/
cp _build/emqx/rel/emqx/etc/emqx.conf _build/dev/rel/emqx/etc/ cp _build/emqx/rel/emqx/etc/emqx.conf _build/dev/rel/emqx/etc/
cp -r apps/emqx/etc/certs _build/dev/rel/emqx/etc/
echo "telemetry { enable = false }" >> _build/dev/rel/emqx/etc/emqx.conf echo "telemetry { enable = false }" >> _build/dev/rel/emqx/etc/emqx.conf

View File

@ -248,6 +248,7 @@ relx_apps(ReleaseType, Edition) ->
, inets , inets
, compiler , compiler
, runtime_tools , runtime_tools
, {hocon, load}
, {emqx, load} % started by emqx_machine , {emqx, load} % started by emqx_machine
, {emqx_conf, load} , {emqx_conf, load}
, emqx_machine , emqx_machine