feat: fix applications start order issue

This commit is contained in:
x1001100011 2021-10-12 00:00:57 -07:00
parent f20d5b5395
commit 2d25e895a8
17 changed files with 60 additions and 153 deletions

View File

@ -19,7 +19,7 @@ defmodule EMQX.MixProject do
def application do
[
mod: {:emqx_app, []},
extra_applications: [:logger, :os_mon, :syntax_tools, :mnesia]
extra_applications: [:logger, :os_mon, :syntax_tools]
]
end

View File

@ -40,10 +40,6 @@
start(_Type, _Args) ->
ok = maybe_load_config(),
%% Load application first for ekka_mnesia scanner
%% mnesia:change_table_copy_type(schema, node(), disc_copies),
ok = maybe_start_quicer(),
ensure_ekka_started(),
{ok, Sup} = emqx_sup:start_link(),

View File

@ -26,7 +26,7 @@ defmodule EMQXAutoSubscribe.MixProject do
defp deps do
[
{:emqx, in_umbrella: true}
{:emqx, in_umbrella: true, runtime: false}
]
end
end

View File

@ -26,8 +26,8 @@ defmodule EMQXBridge.MixProject do
defp deps do
[
{:emqx, in_umbrella: true},
{:emqx_connector, in_umbrella: true}
{:emqx, in_umbrella: true, runtime: false},
{:emqx_connector, in_umbrella: true}
]
end
end

View File

@ -1,4 +0,0 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

View File

@ -1,33 +0,0 @@
defmodule EMQXBridgeMqtt.MixProject do
use Mix.Project
def project do
[
app: :emqx_bridge_mqtt,
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 Bridge to MQTT Broker"
]
end
def application do
[
mod: {:emqx_bridge_mqtt_app, []},
extra_applications: [:logger]
]
end
defp deps do
[
{:emqx, in_umbrella: true, override: true, runtime: false},
{:emqx_rule_engine, in_umbrella: true},
{:emqtt, github: "emqx/emqtt", tag: "v1.2.3"}
]
end
end

View File

@ -24,9 +24,10 @@ defmodule EMQXConnector.MixProject do
defp deps do
[
{:emqx_resource, in_umbrella: true},
{:mysql, github: "emqx/mysql-otp", tag: "1.7.1"},
{:ecpool, github: "emqx/ecpool", tag: "0.5.1"},
{:emqx_resource, in_umbrella: true}
{:emqtt, github: "emqx/emqtt", tag: "1.4.3"}
]
end
end

View File

@ -20,7 +20,7 @@ defmodule EMQXDashboard.MixProject do
[
registered: [:emqx_dashboard_sup],
mod: {:emqx_dashboard_app, []},
extra_applications: [:logger, :mnesia]
extra_applications: [:logger]
]
end

View File

@ -1,4 +0,0 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

View File

@ -1,28 +0,0 @@
defmodule EMQXDataBridge.MixProject do
use Mix.Project
def project do
[
app: :emqx_data_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()
]
end
def application do
[
mod: {:emqx_data_bridge_app, []},
extra_applications: [:logger]
]
end
defp deps do
[]
end
end

View File

@ -26,7 +26,7 @@ defmodule EMQXGateway.MixProject do
defp deps do
[
{:emqx, in_umbrella: true, runtime: false},
{:emqx, in_umbrella: true},
{: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"}

View File

@ -355,7 +355,7 @@ log {
## @doc log.console_handler.<name>.level
## ValueType: debug | info | notice | warning | error | critical | alert | emergency
## Default: warning
level = warning
level = debug
## Timezone offset to display in logs
##

View File

@ -1,9 +1,9 @@
defmodule EmqxRuleActions.MixProject do
defmodule EmqxPSK.MixProject do
use Mix.Project
def project do
[
app: :emqx_rule_actions,
app: :emqx_psk,
version: "5.0.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
@ -12,7 +12,7 @@ defmodule EmqxRuleActions.MixProject do
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
deps: deps(),
description: "Rule Actions"
description: "EMQ X PSK"
]
end
@ -26,8 +26,7 @@ defmodule EmqxRuleActions.MixProject do
defp deps do
[
{:emqx, in_umbrella: true, runtime: false},
{:emqx_rule_engine, in_umbrella: true}
{:emqx, in_umbrella: true, runtime: false}
]
end
end

View File

@ -2,7 +2,7 @@ defmodule EmqxReleaseHelper.Applications do
use EmqxReleaseHelper.DSL.Application
application :emqx do
start_type :permanent
start_type :load
overlay %{release_type: release_type} do
copy "etc/certs", "etc/certs"
@ -21,19 +21,19 @@ defmodule EmqxReleaseHelper.Applications do
end
application :emqx_bridge do
start_type :permanent
start_type :load
end
application :emqx_auto_subscribe do
start_type :permanent
start_type :load
end
application :emqx_exhook do
start_type :permanent
start_type :load
end
application :emqx_gateway do
start_type :permanent
start_type :load
overlay do
copy "src/lwm2m/lwm2m_xml", "etc/lwm2m_xml"
@ -41,29 +41,27 @@ defmodule EmqxReleaseHelper.Applications do
end
application :emqx_connector do
start_type :permanent
start_type :load
end
application :emqx_modules do
start_type :permanent
start_type :load
end
application :emqx_resource do
start_type :permanent
start_type :load
end
application :emqx_plugin_libs do
start_type :permanent
start_type :load
end
application :emqx_authn do
start_type :permanent
overlay :application
start_type :load
end
application :emqx_authz do
start_type :permanent
overlay :application
start_type :load
overlay do
template "etc/acl.conf", "etc/acl.conf"
@ -71,44 +69,57 @@ defmodule EmqxReleaseHelper.Applications do
end
application :emqx_dashboard do
start_type :permanent
overlay :application
start_type :load
end
application :emqx_management do
start_type :permanent
overlay :application
start_type :load
end
application :emqx_statsd do
start_type :permanent
overlay :application
start_type :load
end
application :emqx_retainer do
start_type :permanent
overlay :application
start_type :load
end
application :emqx_rule_engine do
start_type :permanent
overlay :application
start_type :load
end
application :emqx_rule_actions do
start_type :permanent
overlay :application
application :emqx_psk do
start_type :load
end
application :emqx_prometheus, %{release_type: :cloud} do
start_type :permanent
overlay :application
start_type :load
end
application :bcrypt, %{enable_bcrypt: true, release_type: :cloud} do
start_type :permanent
end
application :gproc do
start_type :load
end
application :grpc do
start_type :load
end
application :ekka do
start_type :load
end
application :mnesia do
start_type :load
end
application :ecpool do
start_type :load
end
application :xmerl, %{release_type: :cloud} do
start_type :permanent
end

View File

@ -44,19 +44,6 @@ defmodule EmqxReleaseHelper.DSL.Application do
end
end
defmacro overlay(:application) do
block =
Macro.escape(
quote do
&application_overlay/1
end
)
quote do
@overlays [unquote(block) | @overlays]
end
end
defmacro overlay(do: block) do
block =
Macro.escape(
@ -131,25 +118,6 @@ defmodule EmqxReleaseHelper.DSL.Application do
end
end
def application_overlay(
%{app_source_path: app_source_path, release_path: release_path} = config
) do
"#{app_source_path}/etc"
|> File.ls()
|> case do
{:ok, files} -> files
{:error, _} -> []
end
|> Enum.filter(fn file -> String.ends_with?(file, ".conf") end)
|> Enum.each(fn file ->
EmqxReleaseHelper.DSL.Overlay.run_template(
"#{app_source_path}/etc/#{file}",
"#{release_path}/etc/plugins/#{file}",
config
)
end)
end
defmacro __before_compile__(%Macro.Env{module: module}) do
block =
module

View File

@ -8,7 +8,7 @@
"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"},
"ekka": {:git, "https://github.com/emqx/ekka.git", "80e7439472164ce2b121cff523b979291cc7c9f3", [tag: "0.10.8"]},
"emqtt": {:git, "https://github.com/emqx/emqtt.git", "9e867b1fcaadbfcce45ea75d3721f982907ae417", [tag: "v1.2.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"]},
"esasl": {:git, "https://github.com/emqx/esasl.git", "1d4ab8d3ff7fd52018d3dddfec499933f9bb62b6", [tag: "0.1.0"]},
@ -31,6 +31,7 @@
"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.git", "a41488df09472448057d264ef520cf2f71d925f8", [tag: "v3.1.1"]},
"quicer": {:git, "https://github.com/emqx/quic.git", "348c08a3f5a3b90861906fb436ff0ced453adfa2", [tag: "0.0.8"]},
"ranch": {:hex, :ranch, "2.1.0", "2261f9ed9574dcfcc444106b9f6da155e6e540b2f82ba3d42b339b93673b72a3", [:make, :rebar3], [], "hexpm", "244ee3fa2a6175270d8e1fc59024fd9dbc76294a321057de8f803b1479e76916"},
"recon": {:hex, :recon, "2.5.2", "cba53fa8db83ad968c9a652e09c3ed7ddcc4da434f27c3eaa9ca47ffb2b1ff03", [:mix, :rebar3], [], "hexpm", "2c7523c8dee91dff41f6b3d63cba2bd49eb6d2fe5bf1eec0df7f87eb5e230e1c"},
"replayq": {:git, "https://github.com/emqx/replayq", "9e5ba14d65ff1885ad85b6d33a859c01c322f273", [tag: "0.3.1"]},

View File

@ -71,8 +71,8 @@ set_name () {
SHORT_NAME="$(echo "$NAME" | awk -F'@' '{print $1}')"
export ESCRIPT_NAME="$SHORT_NAME"
export NAME_TYPE
export NAME
export NAME_TYPE
export NAME
}
SED_REPLACE="sed -i "
@ -178,12 +178,12 @@ call_hocon() {
nodetool () {
command="$1"; shift
"$RUNNER_ROOT_DIR/erts-$ERTS_VSN/bin/erl" \
+B -noshell \
+B -noshell \
-boot "$REL_VSN_DIR/$RELEASE_BOOT_SCRIPT_CLEAN" \
-boot_var RELEASE_LIB "$RELEASE_ROOT/lib" \
-run escript start \
-extra "$RUNNER_ROOT_DIR/bin/nodetool" \
"$command" "$@"
-run escript start \
-extra "$RUNNER_ROOT_DIR/bin/nodetool" \
"$command" "$@"
}
set_name "$1"